mirror of https://github.com/yt-dlp/yt-dlp.git
Fix/improve `InAdvancePagedList`
This commit is contained in:
parent
f40ee5e9a0
commit
d37707bda4
|
@ -72,6 +72,7 @@ from .utils import (
|
|||
GeoRestrictedError,
|
||||
get_domain,
|
||||
HEADRequest,
|
||||
InAdvancePagedList,
|
||||
int_or_none,
|
||||
iri_to_uri,
|
||||
ISO3166Utils,
|
||||
|
@ -1662,6 +1663,9 @@ class YoutubeDL(object):
|
|||
msg = 'Downloading %d videos'
|
||||
if not isinstance(ie_entries, (PagedList, LazyList)):
|
||||
ie_entries = LazyList(ie_entries)
|
||||
elif isinstance(ie_entries, InAdvancePagedList):
|
||||
if ie_entries._pagesize == 1:
|
||||
playlist_count = ie_entries._pagecount
|
||||
|
||||
def get_entry(i):
|
||||
return YoutubeDL.__handle_extraction_exceptions(
|
||||
|
|
|
@ -2845,8 +2845,7 @@ class InAdvancePagedList(PagedList):
|
|||
|
||||
def _getslice(self, start, end):
|
||||
start_page = start // self._pagesize
|
||||
end_page = (
|
||||
self._pagecount if end is None else (end // self._pagesize + 1))
|
||||
end_page = self._pagecount if end is None else min(self._pagecount, end // self._pagesize + 1)
|
||||
skip_elems = start - start_page * self._pagesize
|
||||
only_more = None if end is None else end - start
|
||||
for pagenum in range(start_page, end_page):
|
||||
|
|
Loading…
Reference in New Issue