Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Harendra Kumar Kanojiya harendra21

🏠
Working from home
View GitHub Profile
View imdb.py
from bs4 import BeautifulSoup
import requests
import pandas as pd
import os
# Setting up session
s = requests.session()
# List contaiting all the films for which data has to be scraped from IMDB
films = []
View scrap-img.py
from selenium import webdriver
import requests as rq
import os
from bs4 import BeautifulSoup
import time
# path= E:\web scraping\chromedriver_win32\chromedriver.exe
path = input("Enter Path : ")
url = input("Enter URL : ")
View smart-weather-app.py
from bs4 import BeautifulSoup
import requests
import time
from win10toast import ToastNotifier
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
def weather(city):
city=city.replace(" ","+")
res = requests.get(f'https://www.google.com/search?q={city}&oq={city}&aqs=chrome.0.35i39l2j0l4j46j69i60.6128j1j7&sourceid=chrome&ie=UTF-8',headers=headers)
View Currency_converter.py
import requests
import json
import sys
from pprint import pprint
# The below 4 lines bring out the value of currency from the api at fixer.io. I had to register there, the key is unique to me.
url = "http://data.fixer.io/api/latest?access_key=33ec7c73f8a4eb6b9b5b5f95118b2275"
data = requests.get(url).text
data2 = json.loads(data) #brings whether request was successful,timestamp etc
fx = data2["rates"]
View todo.py
import click
@click.group()
@click.pass_context
def todo(ctx):
'''Simple CLI Todo App'''
ctx.ensure_object(dict)
#Open todo.txt – first line contains latest ID, rest contain tasks and IDs
with open('./todo.txt') as f:
content = f.readlines()
View tts.py
from gtts import gTTS
import os
file = open("abc.txt", "r").read()
speech = gTTS(text=file, lang='en', slow=False)
speech.save("voice.mp3")
os.system("voice.mp3")
View youtube_comments.py
from selenium import webdriver
import csv
import time
items=[]
driver=webdriver.Chrome(r"C:/Users/hp/Anaconda3/chromedriver.exe")
driver.get('https://www.youtube.com/watch?v=iFPMz36std4')
driver.execute_script('window.scrollTo(1, 500);')
View compress_file.py
import zipfile
import sys
import os
# compress file function
def zip_file(file_path):
compress_file = zipfile.ZipFile(file_path + '.zip', 'w')
compress_file.write(path, compress_type=zipfile.ZIP_DEFLATED)
compress_file.close()
View stopwatch.py
import tkinter as Tkinter
from datetime import datetime
counter = 0
running = False
def counter_label(label):
def count():
if running:
global counter
View arrange-files.py
import os
import glob
import shutil
from os import path
filename=glob.glob("/path/to/folder/*")
documents=['.pdf','.docx','.doc','.txt','.csv','.xlsx','.sql','.json']
pictures=['.jpeg','.jpg','.svg','.png','.PNG','.gif']
videos=['.mp4','.avi','.webm']