Skip to content

Instantly share code, notes, and snippets.

View ashutoshkrris's full-sized avatar
🏠
Learning from home

Ashutosh Krishna ashutoshkrris

🏠
Learning from home
View GitHub Profile
@ashutoshkrris
ashutoshkrris / YouTube_Playlist_Downloader.md
Last active July 22, 2024 12:22
Download all videos from YouTube Playlist in all supported resolutions (including 1080p and 4K)
  • Using this script, you can download all the videos from a YouTube Playlist in all supported resolutions (including 1080p and 2160p).
  • Enter the playlist url and the resolution you wish to download.
  • Install the required libraries: pytubefix, tqdm, tenacity
  • Make sure you have ffmpeg setup on your machine. Check the tutorial for the setup guide.
  • You can download the videos in the following resolutions: 144p, 240p, 360p, 480p, 720p, 1080p, 1440p, 2160p
  • Check the video for available resolutions.
import csv
import json
from bs4 import BeautifulSoup
from selenium import webdriver
BROWSER = webdriver.Chrome(executable_path="chromedriver.exe")
TOTAL_PERSONS = 100
import json
def write_to_json(data: dict) -> None:
data_list = []
for i in range(TOTAL_PERSONS):
temp = {
"Rank": data["ranks"][i],
"Name": data["names"][i],
"Link": f"https://www.bloomberg.com/billionaires/{data['links'][i]}",
"Total net worth($)": data["worths"][i],
import csv
def write_to_csv(data: dict) -> None:
columns = ['Rank', 'Name', 'Link',
'Total net worth($)', '$ Last change', '$ YTD change', 'Country/Region', 'Industry']
with open(f"top-{TOTAL_PERSONS}-persons.csv", "w", newline="") as csv_file:
writer = csv.DictWriter(csv_file, fieldnames=columns)
writer.writeheader()
for i in range(TOTAL_PERSONS):
temp = {
import csv
import json
from bs4 import BeautifulSoup
from selenium import webdriver
BROWSER = webdriver.Chrome(executable_path="chromedriver.exe")
TOTAL_PERSONS = 100
post_data = [1, 'Getting started with Rich', ('Ashutosh Krishna', 22, 'India')]
# General Way, Don't Do ❌
post_id = post_data[0]
post_title = post_data[1]
author_data = post_data[2]
author_name = author_data[0]
author_age = author_data[1]
author_country = author_data[2]
const postData = [1, 'Getting Started With Rich', 'Ashutosh Krishna'];
const [postId, postTitle, postAuthor] = postData;
console.log(postId, postTitle, postAuthor);
// With Objects
const anotherPostData = {
anotherPostId: 1,
anotherPostTitle: 'Getting Started With Rich',
anotherPostAuthor: 'Ashutosh Krishna'
};
post_data = [1, 'Getting started with Rich', 'Ashutosh Krishna']
post_id, post_title, post_author = post_data
print(post_id, post_title, post_author)
post_data = [1, 'Getting started with Rich', 'Ashutosh Krishna']
post_id = post_data[0]
post_title = post_data[1]
post_author = post_data[2]
print(post_id, post_title, post_author)
@ashutoshkrris
ashutoshkrris / main.py
Created March 23, 2022 03:06
Code file for *args and **kwargs
"""Sum of Two Numbers
def add(x, y):
return x+y
print(add(2, 3))
"""
"""Sum of Three Numbers
def add(x, y, z):