Skip to content

Instantly share code, notes, and snippets.

@e96031413
Created November 28, 2022 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e96031413/e911dc05d18519dba7df95fa5613e6d2 to your computer and use it in GitHub Desktop.
Save e96031413/e911dc05d18519dba7df95fa5613e6d2 to your computer and use it in GitHub Desktop.
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