Skip to content

Instantly share code, notes, and snippets.

@ingenika
Forked from rosswd/shell.sh
Created January 25, 2025 19:13
Show Gist options
  • Save ingenika/04c632585acee1d7f86fbcaa07593023 to your computer and use it in GitHub Desktop.
Save ingenika/04c632585acee1d7f86fbcaa07593023 to your computer and use it in GitHub Desktop.
Get video titles from a Youtube channel
# get a list of video titles for a channel
youtube-dl -i -e https://youtube.com/channel/CHANNEL_ID
# alternative
youtube-dl --skip-download --ignore-errors https://youtube.com/channel/CHANNEL_ID
# Program to get a list of video titles from a Youtube Channel
import youtube_dl
import pickle
'''
Visit the Channel page and view page source
Search for externalID and copy the value into PLAYLIST_ID below
Change the C to a U so it begins UU instead of UC (U=Upload Playlist)
'''
PLAYLIST_ID = ''
with youtube_dl.YoutubeDL({'ignoreerrors': True}) as ydl:
playd = ydl.extract_info(PLAYLIST_ID, download=False)
with open('playlist.pickle', 'wb') as f:
pickle.dump(playd, f, pickle.HIGHEST_PROTOCOL)
with open('playlist.pickle', 'rb') as f:
data = pickle.load(f)
for video in data['entries']:
for property in ['title']:
print(video.get(property))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment