Last active
April 23, 2024 23:49
-
-
Save rosswd/3e8db8f8cd4af4e6b62da3e44ff10e30 to your computer and use it in GitHub Desktop.
Get video titles from a Youtube channel
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
# 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 |
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
# 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
how will it work?