- 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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import json | |
from bs4 import BeautifulSoup | |
from selenium import webdriver | |
BROWSER = webdriver.Chrome(executable_path="chromedriver.exe") | |
TOTAL_PERSONS = 100 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import json | |
from bs4 import BeautifulSoup | |
from selenium import webdriver | |
BROWSER = webdriver.Chrome(executable_path="chromedriver.exe") | |
TOTAL_PERSONS = 100 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
post_data = [1, 'Getting started with Rich', 'Ashutosh Krishna'] | |
post_id, post_title, post_author = post_data | |
print(post_id, post_title, post_author) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Sum of Two Numbers | |
def add(x, y): | |
return x+y | |
print(add(2, 3)) | |
""" | |
"""Sum of Three Numbers | |
def add(x, y, z): |
NewerOlder