Skip unavailable videos when downloading from Playlist

This commit is contained in:
Hafitz Setya 2021-02-22 15:27:53 +07:00 committed by GitHub
parent 7c5e7c5108
commit 78a3f13f92
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,7 +111,7 @@ class YoutubeDLHelper(DownloadHelper):
if 'entries' in result:
video = result['entries'][0]
for v in result['entries']:
if v.get('filesize'):
if v and v.get('filesize'):
self.size += float(v['filesize'])
# For playlists, ydl.prepare-filename returns the following format: <Playlist Name>-<Id of playlist>.NA
self.name = name.split(f"-{result['id']}")[0]
@ -139,6 +139,9 @@ class YoutubeDLHelper(DownloadHelper):
self.onDownloadError("Download Cancelled by User!")
def add_download(self, link, path):
pattern = '^.*(youtu\.be\/|youtube.com\/)(playlist?)'
if re.match(pattern, link):
self.opts['ignoreerrors'] = True
self.__onDownloadStart()
self.extractMetaData(link)
LOGGER.info(f"Downloading with YT-DL: {link}")