aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/YoutubeDL.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-09-04 03:07:27 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-09-04 03:07:27 +0530
commit8e5fecc88c53611de538a50c1e51eb048b1544e6 (patch)
treede1e17f6769added81c1d844f5f30fc7f6c4fc22 /yt_dlp/YoutubeDL.py
parent165efb823b3a8a6a6788cfe23e6b93dfbe150568 (diff)
downloadhypervideo-pre-8e5fecc88c53611de538a50c1e51eb048b1544e6.tar.lz
hypervideo-pre-8e5fecc88c53611de538a50c1e51eb048b1544e6.tar.xz
hypervideo-pre-8e5fecc88c53611de538a50c1e51eb048b1544e6.zip
Handle more playlist errors with `-i`
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r--yt_dlp/YoutubeDL.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index cf8304c39..9768bb8ca 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -1211,7 +1211,8 @@ class YoutubeDL(object):
else:
self.report_error('no suitable InfoExtractor for URL %s' % url)
- def __handle_extraction_exceptions(func, handle_all_errors=True):
+ def __handle_extraction_exceptions(func):
+
def wrapper(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
@@ -1228,10 +1229,10 @@ class YoutubeDL(object):
self.to_stderr('\r')
self.report_warning('The download speed is below throttle limit. Re-extracting data')
return wrapper(self, *args, **kwargs)
- except (MaxDownloadsReached, ExistingVideoReached, RejectedVideoReached):
+ except (MaxDownloadsReached, ExistingVideoReached, RejectedVideoReached, LazyList.IndexError):
raise
except Exception as e:
- if handle_all_errors and self.params.get('ignoreerrors', False):
+ if self.params.get('ignoreerrors', False):
self.report_error(error_to_compat_str(e), tb=encode_compat_str(traceback.format_exc()))
else:
raise
@@ -1436,14 +1437,18 @@ class YoutubeDL(object):
msg = (
'Downloading %d videos' if not isinstance(ie_entries, list)
else 'Collected %d videos; downloading %%d of them' % len(ie_entries))
- if not isinstance(ie_entries, (list, PagedList)):
- ie_entries = LazyList(ie_entries)
-
- def get_entry(i):
- return YoutubeDL.__handle_extraction_exceptions(
- lambda self, i: ie_entries[i - 1],
- False
- )(self, i)
+
+ if isinstance(ie_entries, list):
+ def get_entry(i):
+ return ie_entries[i - 1]
+ else:
+ if not isinstance(ie_entries, PagedList):
+ ie_entries = LazyList(ie_entries)
+
+ def get_entry(i):
+ return YoutubeDL.__handle_extraction_exceptions(
+ lambda self, i: ie_entries[i - 1]
+ )(self, i)
entries = []
for i in playlistitems or itertools.count(playliststart):