Skip to content
Snippets Groups Projects
Commit 2d613d3e authored by Robert Goldmann's avatar Robert Goldmann
Browse files

Fixed #3 - continue downloading playlist if one video fails

parent 5984fef4
No related branches found
No related tags found
No related merge requests found
......@@ -102,7 +102,6 @@ class SaveMyPlaylist:
response = request.execute()
items = []
logger.info('Found {} videos in playlist'.format(len(response['items'])))
for item in response['items']:
snippet = item['snippet']
title = snippet['title']
......@@ -134,6 +133,7 @@ class SaveMyPlaylist:
logger.info('Skipping {}/{}: "{}" as it already exists'.format(idx + 1, len(self._items), fileName))
continue
try:
logger.info('Downloading {}/{}: "{}"'.format(idx + 1, len(self._items), fileName))
newVideos.append(item)
......@@ -150,6 +150,8 @@ class SaveMyPlaylist:
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['https://www.youtube.com/watch?v={}'.format(item[self.VIDEO_ID])])
except Exception as e:
logger.error(f'Error while downloading video "{fileName}" with ID: "{item[self.VIDEO_ID]}"', exc_info=e)
logger.info('>>> Finished Downloading')
logger.info('Downloaded {} new videos'.format(len(newVideos)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment