Fixed private videos breaking the script

This commit is contained in:
Christian Colglazier 2021-06-29 18:24:25 -04:00
parent 3c522c6459
commit 668e497ae0
2 changed files with 5 additions and 0 deletions

View File

@ -22,6 +22,10 @@ class YouTubeAPI(object):
def getVideoInfo(self, id):
snippet = self.getVideo('snippet', id)
status = self.getVideo('status', id)
# Check for private videos
if len(snippet['items']) == 0:
return '', '', '', '', '', '', 'private', id
snippet = snippet['items'][0]['snippet']
status = status['items'][0]['status']
title = snippet['title']

View File

@ -66,6 +66,7 @@ filteredVideos = [video for video in videoInfo if getPrivacy(video) == 'unlisted
ydl_opts = {
'outtmpl': '{}/%(uploader)s-%(title)s-%(id)s.%(ext)s'.format(playlistDir)
}
for v in filteredVideos:
# Save metadata to file