├── .gitignore ├── API └── weather │ ├── weather1.py │ ├── weather2.py │ └── weather3.py ├── Automation ├── fb_login_updated.py └── tweet_image_text.py ├── Dynamic Web Scraping ├── part 1 - problem.py └── part 2 - solution.py ├── LICENSE ├── Python_Extras ├── speech.py ├── twitter_mask.png ├── wordcloud1.py ├── wordcloud2.py └── wordcloud3.py ├── README.md ├── Web_Scraping ├── Saavn │ ├── saavn1.py │ ├── saavn2.py │ ├── saavn3.py │ └── saavn_final.py ├── bing.py ├── bitcoin.py ├── hackathon.py ├── img.py ├── isitup.py ├── location.py ├── news.py └── qoute_of_the_day.py ├── Whatsapp Automation ├── Must Read ├── multi_users.py ├── updated.py ├── updated2.py └── whatsapp_attachment.py └── Youtube Download └── download_by_search.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | .spyproject 93 | 94 | # Rope project settings 95 | .ropeproject 96 | 97 | # mkdocs documentation 98 | /site 99 | 100 | # mypy 101 | .mypy_cache/ 102 | -------------------------------------------------------------------------------- /API/weather/weather1.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pprint import pprint 3 | 4 | city = input('Enter your city : ') 5 | 6 | url = 'http://api.openweathermap.org/data/2.5/weather?q={}&appid= your api key here &units=metric'.format(city) 7 | 8 | res = requests.get(url) 9 | 10 | data = res.json() 11 | 12 | temp = data['main']['temp'] 13 | wind_speed = data['wind']['speed'] 14 | 15 | latitude = data['coord']['lat'] 16 | longitude = data['coord']['lon'] 17 | 18 | description = data['weather'][0]['description'] 19 | 20 | print('Temperature : {} degree celcius'.format(temp)) 21 | print('Wind Speed : {} m/s'.format(wind_speed)) 22 | print('Latitude : {}'.format(latitude)) 23 | print('Longitude : {}'.format(longitude)) 24 | print('Description : {}'.format(description)) 25 | -------------------------------------------------------------------------------- /API/weather/weather2.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | res = requests.get('https://ipinfo.io/') 4 | data = res.json() 5 | 6 | location = data['loc'].split(',') 7 | latitude = location[0] 8 | longitude = location[1] 9 | 10 | url = 'http://api.openweathermap.org/data/2.5/weather?lat={}&lon={}&appid= your api key here &units=metric'.format(latitude, longitude) 11 | 12 | res = requests.get(url) 13 | 14 | data = res.json() 15 | 16 | temp = data['main']['temp'] 17 | wind_speed = data['wind']['speed'] 18 | 19 | latitude = data['coord']['lat'] 20 | longitude = data['coord']['lon'] 21 | 22 | description = data['weather'][0]['description'] 23 | 24 | print('Temperature : {} degree celcius'.format(temp)) 25 | print('Wind Speed : {} m/s'.format(wind_speed)) 26 | print('Latitude : {}'.format(latitude)) 27 | print('Longitude : {}'.format(longitude)) 28 | print('Description : {}'.format(description)) 29 | -------------------------------------------------------------------------------- /API/weather/weather3.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | 4 | def by_city(): 5 | city = input('Enter your city : ') 6 | url = 'http://api.openweathermap.org/data/2.5/weather?q={}&appid= your api key here &units=metric'.format(city) 7 | res = requests.get(url) 8 | data = res.json() 9 | show_data(data) 10 | 11 | 12 | def by_location(): 13 | res = requests.get('https://ipinfo.io/') 14 | data = res.json() 15 | location = data['loc'].split(',') 16 | latitude = location[0] 17 | longitude = location[1] 18 | 19 | url = 'http://api.openweathermap.org/data/2.5/weather?lat={}&lon={}&appid= your api key here &units=metric'.format(latitude, longitude) 20 | res = requests.get(url) 21 | data = res.json() 22 | show_data(data) 23 | 24 | 25 | 26 | def show_data(data): 27 | temp = data['main']['temp'] 28 | wind_speed = data['wind']['speed'] 29 | latitude = data['coord']['lat'] 30 | longitude = data['coord']['lon'] 31 | description = data['weather'][0]['description'] 32 | 33 | print() 34 | print('Temperature : {} degree celcius'.format(temp)) 35 | print('Wind Speed : {} m/s'.format(wind_speed)) 36 | print('Latitude : {}'.format(latitude)) 37 | print('Longitude : {}'.format(longitude)) 38 | print('Description : {}'.format(description)) 39 | 40 | 41 | def main(): 42 | print('1. Get data By city') 43 | print('2. Get data By location') 44 | choice = input('Enter your choice : ') 45 | 46 | if choice == '1': 47 | by_city() 48 | 49 | else: 50 | by_location() 51 | 52 | if __name__ == '__main__': 53 | main() 54 | 55 | -------------------------------------------------------------------------------- /Automation/fb_login_updated.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from getpass import getpass 3 | 4 | usr = input('Enter your username or email id: ') 5 | pwd = getpass('Enter your password : ') 6 | 7 | driver = webdriver.Chrome() 8 | driver.get('https://www.facebook.com/') 9 | 10 | username_box = driver.find_element_by_id('email') 11 | username_box.send_keys(usr) 12 | 13 | password_box = driver.find_element_by_id('pass') 14 | password_box.send_keys(pwd) 15 | 16 | login_btn = driver.find_element_by_id('u_0_b') 17 | login_btn.submit() 18 | -------------------------------------------------------------------------------- /Automation/tweet_image_text.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from getpass import getpass 3 | from time import sleep 4 | 5 | usr = input('Enter your username or email : ') 6 | pwd = getpass('Enter your password : ') 7 | image_path = input('Enter your image path : ') 8 | 9 | driver = webdriver.Chrome() 10 | driver.get('https://twitter.com/login') 11 | 12 | usr_box = driver.find_element_by_class_name('js-username-field') 13 | usr_box.send_keys(usr) 14 | sleep(3) 15 | 16 | pwd_box = driver.find_element_by_class_name('js-password-field') 17 | pwd_box.send_keys(pwd) 18 | sleep(3) 19 | 20 | login_button = driver.find_element_by_css_selector('button.submit.EdgeButton.EdgeButton--primary.EdgeButtom--medium') 21 | login_button.submit() 22 | sleep(3) 23 | 24 | image_box = driver.find_element_by_css_selector('input.file-input.js-tooltip') 25 | image_box.send_keys(image_path) 26 | sleep(3) 27 | 28 | text_box = driver.find_element_by_id('tweet-box-home-timeline') 29 | text_box.send_keys('automation with image and text #getsetpython') 30 | sleep(3) 31 | 32 | tweet_button = driver.find_element_by_css_selector('button.tweet-action.EdgeButton.EdgeButton--primary.js-tweet-btn') 33 | tweet_button.click() 34 | -------------------------------------------------------------------------------- /Dynamic Web Scraping/part 1 - problem.py: -------------------------------------------------------------------------------- 1 | # Problem with normal web scraping and need of dynamic scraping 2 | 3 | ## this will not give any output. It is just to explain the need of dynamic scraping 4 | 5 | from bs4 import BeautifulSoup 6 | import requests 7 | 8 | res = requests.get('https://www.hackerearth.com/challenges/') 9 | soup = BeautifulSoup(res.text, 'lxml') 10 | 11 | box = soup.find('div', {'class': 'upcoming challenge-list'}) 12 | 13 | all_hackathons = box.find_all('div', {'class': 'challenge-card-modern'}) 14 | 15 | for hackathon in all_hackathons: 16 | h_type = hackathon.find('div', {'class': 'challenge-type'}) 17 | name = hackathon.find('div', {'class': 'challenge-name'}) 18 | date = hackathon.find('div', {'class': 'data'}) 19 | 20 | print(h_type, name, date) 21 | -------------------------------------------------------------------------------- /Dynamic Web Scraping/part 2 - solution.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | from selenium import webdriver 3 | 4 | ##------------------------ changes in this part only --------------------------------- ## 5 | 6 | driver = webdriver.Chrome() 7 | driver.get('https://www.hackerearth.com/challenges/') 8 | res = driver.execute_script("return document.documentElement.outerHTML") 9 | driver.quit() 10 | 11 | soup = BeautifulSoup(res, 'lxml') 12 | 13 | ##------------------------ changes end here. Rest of the things are same. ------------------ ## 14 | 15 | box = soup.find('div', {'class': 'upcoming challenge-list'}) 16 | 17 | all_hackathons = box.find_all('div', {'class': 'challenge-card-modern'}) 18 | 19 | for hackathon in all_hackathons: 20 | h_type = hackathon.find('div', {'class': 'challenge-type'}).text.replace('\n', '') 21 | name = hackathon.find('div', {'class': 'challenge-name'}).text.replace('\n', '') 22 | date = hackathon.find('div', {'class': 'date'}).text.replace('\n', '') 23 | 24 | print(h_type, name, date) 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Umang Ahuja 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Python_Extras/speech.py: -------------------------------------------------------------------------------- 1 | import speech_recognition as sr 2 | 3 | r = sr.Recognizer() 4 | with sr.Microphone() as source: 5 | print("Speak Anything :") 6 | audio = r.listen(source) 7 | try: 8 | text = r.recognize_google(audio) 9 | print("You said : {}".format(text)) 10 | except: 11 | print("Sorry could not recognize what you said") 12 | -------------------------------------------------------------------------------- /Python_Extras/twitter_mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/umangahuja1/Youtube/3b4653596d6d034cd9387399d8ebd1372b64d811/Python_Extras/twitter_mask.png -------------------------------------------------------------------------------- /Python_Extras/wordcloud1.py: -------------------------------------------------------------------------------- 1 | from wordcloud import WordCloud 2 | import matplotlib.pyplot as plt 3 | 4 | text = "keys coding competetive development Python webscraping automation getsetpython projects cool awesome blockchain data machinelearning regex loops datascience opencv ML list dictionary analysis sentiment variable set counter enumerate try except if-else for function class object instance GUI encryption security" 5 | 6 | cloud = WordCloud(background_color="white").generate(text) 7 | 8 | plt.imshow(cloud) 9 | plt.axis('off') 10 | plt.show() 11 | -------------------------------------------------------------------------------- /Python_Extras/wordcloud2.py: -------------------------------------------------------------------------------- 1 | from wordcloud import WordCloud 2 | import matplotlib.pyplot as plt 3 | 4 | text = input('Enter your string : ') 5 | 6 | cloud = WordCloud(background_color="white").generate(text) 7 | 8 | plt.imshow(cloud) 9 | plt.axis('off') 10 | plt.show() 11 | -------------------------------------------------------------------------------- /Python_Extras/wordcloud3.py: -------------------------------------------------------------------------------- 1 | from wordcloud import WordCloud 2 | import matplotlib.pyplot as plt 3 | from PIL import Image 4 | import numpy as np 5 | 6 | text = "keys coding competetive development Python webscraping automation getsetpython projects cool awesome blockchain data machinelearning regex loops datascience opencv ML list dictionary analysis sentiment variable set counter enumerate try except if-else for function class object instance GUI encryption security" 7 | 8 | our_mask = np.array(Image.open('twitter_mask.png')) 9 | 10 | cloud = WordCloud(background_color="white", mask = our_mask).generate(text) 11 | 12 | plt.imshow(cloud) 13 | plt.axis('off') 14 | plt.show() 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Youtube 2 | Code related to youtube channel GET SET PYTHON are available here 3 | 4 | Watch here : https://www.youtube.com/getsetpython 5 | -------------------------------------------------------------------------------- /Web_Scraping/Saavn/saavn1.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | 4 | res = requests.get('https://www.saavn.com/s/featured/english/Weekly_Top_Songs') 5 | 6 | soup = BeautifulSoup(res.text, 'lxml') 7 | 8 | data = soup.find('ol', {'class': 'content-list'}) 9 | all_songs = data.find_all('div', {'class': 'details'}) 10 | 11 | for count, s in enumerate(all_songs, 1): 12 | song = s.find('p', {'class': 'song-name'}) 13 | print(count, song.text) 14 | -------------------------------------------------------------------------------- /Web_Scraping/Saavn/saavn2.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | 4 | res = requests.get('https://www.saavn.com/s/featured/hindi/Weekly_Top_Songs') 5 | 6 | soup = BeautifulSoup(res.text, 'lxml') 7 | 8 | data = soup.find('ol', {'class': 'content-list'}) 9 | all_songs = data.find_all('div', {'class': 'details'}) 10 | 11 | for count, s in enumerate(all_songs, 1): 12 | song = s.find('p', {'class': 'song-name'}) 13 | print(count, song.text) 14 | -------------------------------------------------------------------------------- /Web_Scraping/Saavn/saavn3.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | 4 | choice = { 5 | '1': 'english', 6 | '2': 'hindi', 7 | '3': 'punjabi', 8 | '4': 'bengali', 9 | '5': 'gujarati' 10 | } 11 | 12 | ch = input('Enter your choice (1-5) : ') 13 | 14 | res = requests.get('https://www.saavn.com/s/featured/' + choice[ch] + '/Weekly_Top_Songs') 15 | 16 | soup = BeautifulSoup(res.text, 'lxml') 17 | 18 | data = soup.find('ol', {'class': 'content-list'}) 19 | all_songs = data.find_all('div', {'class': 'details'}) 20 | 21 | for count, s in enumerate(all_songs, 1): 22 | song = s.find('p', {'class': 'song-name'}) 23 | print(count, song.text) 24 | -------------------------------------------------------------------------------- /Web_Scraping/Saavn/saavn_final.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | 4 | choice = { 5 | '1': 'english', 6 | '2': 'hindi', 7 | '3': 'punjabi', 8 | '4': 'bengali', 9 | '5': 'gujarati' 10 | } 11 | 12 | 13 | def print_choice(): 14 | for sno in sorted(choice): 15 | print('{}. {}'.format(sno, choice[sno])) 16 | ch = input('Enter your choice (1-5) : ') 17 | return choice[ch] 18 | 19 | 20 | def get_songs(lang): 21 | 22 | res = requests.get('https://www.saavn.com/s/featured/' + lang + '/Weekly_Top_Songs') 23 | 24 | soup = BeautifulSoup(res.text, 'lxml') 25 | 26 | data = soup.find('ol', {'class': 'content-list'}) 27 | all_songs = data.find_all('div', {'class': 'details'}) 28 | return all_songs 29 | 30 | 31 | def print_songs(all_songs): 32 | for count, s in enumerate(all_songs, 1): 33 | song = s.find('p', {'class': 'song-name'}) 34 | print(count, song.text) 35 | 36 | 37 | def saavn_songs(): 38 | lang = print_choice() 39 | all_songs = get_songs(lang) 40 | print_songs(all_songs) 41 | 42 | 43 | saavn_songs() 44 | -------------------------------------------------------------------------------- /Web_Scraping/bing.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | from datetime import datetime as dt 3 | import requests 4 | import urllib.request 5 | 6 | res = requests.get('https://bingwallpaper.com/') 7 | soup = BeautifulSoup(res.text, 'lxml') 8 | 9 | image_box = soup.find('a', {'class': 'cursor_zoom'}) 10 | image = image_box.find('img') 11 | 12 | link = image['src'] 13 | 14 | filename = dt.now().strftime('%d-%m-%y') 15 | urllib.request.urlretrieve(link, filename) 16 | -------------------------------------------------------------------------------- /Web_Scraping/bitcoin.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | res = requests.get('https://www.zebapi.com/api/v1/market/ticker/btc/inr') 4 | 5 | data = res.json() 6 | 7 | print("Buy at : Rs", data['buy']) 8 | print("Sell at : Rs", data['sell']) 9 | -------------------------------------------------------------------------------- /Web_Scraping/hackathon.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | 4 | res = requests.get('http://www.hackathon.io/events') 5 | soup = BeautifulSoup(res.text, 'lxml') 6 | 7 | all_hacks = soup.find_all('div', {'class': 'event-teaser'}) 8 | 9 | for i, hack in enumerate(all_hacks, 1): 10 | time = hack.find('div', {'class': 'two columns time'}).text.replace('\n', '').strip() 11 | name = hack.find('h4').text.replace('\n', '').strip() 12 | description = hack.find('h5').text.replace('\n', '').strip() 13 | location = hack.find('div', {'class': 'two columns location'}).text.replace('\n', '').strip() 14 | 15 | print("{}. {}\n{}\n{}\n{}\n\n".format(str(i), name, description, time, location)) 16 | -------------------------------------------------------------------------------- /Web_Scraping/img.py: -------------------------------------------------------------------------------- 1 | import urllib.request 2 | 3 | url = 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Muralitharan_bowling_to_Adam_Gilchrist.jpg/499px-Muralitharan_bowling_to_Adam_Gilchrist.jpg' 4 | 5 | urllib.request.urlretrieve(url, 'cricket.jpg') 6 | -------------------------------------------------------------------------------- /Web_Scraping/isitup.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | 4 | url = input('Enter the url : (duckduckgo.com) : ') 5 | 6 | res = requests.get('https://isitup.org/' + url) 7 | 8 | soup = BeautifulSoup(res.text, 'lxml') 9 | 10 | out_box = soup.find('div', {'id': 'container'}) 11 | result = out_box.find('p').text 12 | 13 | print(result) 14 | -------------------------------------------------------------------------------- /Web_Scraping/location.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | res = requests.get('https://ipinfo.io/') 4 | data = res.json() 5 | 6 | city = data['city'] 7 | 8 | location = data['loc'].split(',') 9 | latitude = location[0] 10 | longitude = location[1] 11 | 12 | print("Latitude : ", latitude) 13 | print("Longitude : ", longitude) 14 | print("City : ", city) 15 | -------------------------------------------------------------------------------- /Web_Scraping/news.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | 4 | res = requests.get('http://indiatoday.intoday.in/section/120/1/top-stories.html') 5 | soup = BeautifulSoup(res.text, 'lxml') 6 | 7 | news_box = soup.find('ul', {'class': 'topstr-list gap topmarging'}) 8 | all_news = news_box.find_all('a') 9 | 10 | for news in all_news: 11 | print(news.text) 12 | print() 13 | -------------------------------------------------------------------------------- /Web_Scraping/qoute_of_the_day.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | 4 | res = requests.get('https://www.brainyquote.com/quote_of_the_day') 5 | soup = BeautifulSoup(res.text, 'lxml') 6 | 7 | image_quote = soup.find('img', {'class': ' p-qotd bqPhotoDefault bqPhotoDefaultFw img-responsive'}) 8 | print(image_quote['alt']) 9 | -------------------------------------------------------------------------------- /Whatsapp Automation/Must Read: -------------------------------------------------------------------------------- 1 | 1. Python3 or above must be installed on your System. 2 | 2. Selenium must be installed on your system if not then for windows users open command prompt and type "pip install selenium" and then hit enter. and for mac and linux users open shell and type "pip3 install selenium" and then hit enter. 3 | 3. ChromeDriverManager must be installed on the system if not then for windows open command prompt and type "pip install webdriver_manager" and then hit enter. and for mac and linux users open shell and type "pip3 install webdriver_manager" and then hit enter. 4 | 5 | Now you are good to go with your code. 6 | -------------------------------------------------------------------------------- /Whatsapp Automation/multi_users.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | 3 | driver = webdriver.Chrome() 4 | driver.get('https://web.whatsapp.com/') 5 | 6 | all_names = ['Hack', 'Me', 'Bot'] 7 | msg = 'Good Morning' 8 | count = 3 9 | 10 | input('Enter anything after scanning QR code') 11 | 12 | for name in all_names: 13 | user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name)) 14 | user.click() 15 | 16 | msg_box = driver.find_element_by_class_name('input-container') 17 | 18 | for i in range(count): 19 | msg_box.send_keys(msg) 20 | button = driver.find_element_by_class_name('compose-btn-send') 21 | button.click() 22 | -------------------------------------------------------------------------------- /Whatsapp Automation/updated.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | 3 | driver = webdriver.Chrome() 4 | driver.get('https://web.whatsapp.com/') 5 | 6 | name = input('Enter the name of user or group : ') 7 | msg = input('Enter your message : ') 8 | count = int(input('Enter the count : ')) 9 | 10 | input('Enter anything after scanning QR code') 11 | 12 | user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name)) 13 | user.click() 14 | 15 | msg_box = driver.find_element_by_class_name('_2S1VP') 16 | 17 | for i in range(count): 18 | msg_box.send_keys(msg) 19 | button = driver.find_element_by_class_name('_35EW6') 20 | button.click() 21 | -------------------------------------------------------------------------------- /Whatsapp Automation/updated2.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | 3 | driver = webdriver.Chrome() 4 | driver.get('https://web.whatsapp.com/') 5 | 6 | name = input('Enter the name of user or group : ') 7 | msg = input('Enter your message : ') 8 | count = int(input('Enter the count : ')) 9 | 10 | input('Enter anything after scanning QR code') 11 | 12 | user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name)) 13 | user.click() 14 | 15 | msg_box = driver.find_element_by_class_name('_3u328') 16 | 17 | for i in range(count): 18 | msg_box.send_keys(msg) 19 | button = driver.find_element_by_class_name('_3M-N-') 20 | button.click() 21 | -------------------------------------------------------------------------------- /Whatsapp Automation/whatsapp_attachment.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from time import sleep 3 | 4 | driver = webdriver.Chrome() 5 | driver.get('https://web.whatsapp.com/') 6 | 7 | name = input('Enter the name of user or group : ') 8 | filepath = input('Enter your filepath (images/video): ') 9 | 10 | input('Enter anything after scanning QR code') 11 | 12 | user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name)) 13 | user.click() 14 | 15 | attachment_box = driver.find_element_by_xpath('//div[@title = "Attach"]') 16 | attachment_box.click() 17 | 18 | image_box = driver.find_element_by_xpath( 19 | '//input[@accept="image/*,video/mp4,video/3gpp,video/quicktime"]') 20 | image_box.send_keys(filepath) 21 | 22 | sleep(3) 23 | 24 | send_button = driver.find_element_by_xpath('//span[@data-icon="send-light"]') 25 | send_button.click() 26 | -------------------------------------------------------------------------------- /Youtube Download/download_by_search.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Dependencies : youtube-dl 3 | ''' 4 | 5 | from subprocess import call 6 | 7 | name = input('Enter the name of video : ') 8 | search = ["ytsearch:" + name] 9 | 10 | command = ['youtube-dl', '-o', '/home/umang/Videos/NewVideos/%(title)s.%(ext)s+'] 11 | command.extend(search) 12 | 13 | call(command) 14 | --------------------------------------------------------------------------------