Skip to content

Instantly share code, notes, and snippets.

@rosswd
Last active April 23, 2024 23:49
Show Gist options
  • Save rosswd/3e8db8f8cd4af4e6b62da3e44ff10e30 to your computer and use it in GitHub Desktop.
Save rosswd/3e8db8f8cd4af4e6b62da3e44ff10e30 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))
@adilbutt1505
Copy link

how will it work?

@ytcyde
Copy link

ytcyde commented Apr 5, 2023

How do you use this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment