Created
November 28, 2022 12:32
-
-
Save e96031413/e911dc05d18519dba7df95fa5613e6d2 to your computer and use it in GitHub Desktop.
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 scrapetube | |
import random | |
import pandas as pd | |
AllVideoList = [] | |
videos = scrapetube.get_channel("UCJIfeSCssxSC_Dhc5s7woww") # channel ID | |
titleList = [] | |
urlList = [] | |
while True: | |
try: | |
info = videos.__next__() | |
titleList.append(info['title']['runs'][0]['text']) | |
urlList.append("https://www.youtube.com/watch?v="+str(info['videoId'])) | |
except: | |
data = {'title': titleList, 'url': urlList} | |
df = pd.DataFrame(data=data) | |
df.to_csv("LexFriedmanClips.csv", sep='\t', encoding='utf-8') | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment