mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
Fix/improve InAdvancePagedList
This commit is contained in:
parent
f40ee5e9a0
commit
d37707bda4
2 changed files with 5 additions and 2 deletions
|
@ -72,6 +72,7 @@
|
||||||
GeoRestrictedError,
|
GeoRestrictedError,
|
||||||
get_domain,
|
get_domain,
|
||||||
HEADRequest,
|
HEADRequest,
|
||||||
|
InAdvancePagedList,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
iri_to_uri,
|
iri_to_uri,
|
||||||
ISO3166Utils,
|
ISO3166Utils,
|
||||||
|
@ -1662,6 +1663,9 @@ def get_entry(i):
|
||||||
msg = 'Downloading %d videos'
|
msg = 'Downloading %d videos'
|
||||||
if not isinstance(ie_entries, (PagedList, LazyList)):
|
if not isinstance(ie_entries, (PagedList, LazyList)):
|
||||||
ie_entries = LazyList(ie_entries)
|
ie_entries = LazyList(ie_entries)
|
||||||
|
elif isinstance(ie_entries, InAdvancePagedList):
|
||||||
|
if ie_entries._pagesize == 1:
|
||||||
|
playlist_count = ie_entries._pagecount
|
||||||
|
|
||||||
def get_entry(i):
|
def get_entry(i):
|
||||||
return YoutubeDL.__handle_extraction_exceptions(
|
return YoutubeDL.__handle_extraction_exceptions(
|
||||||
|
|
|
@ -2845,8 +2845,7 @@ def __init__(self, pagefunc, pagecount, pagesize):
|
||||||
|
|
||||||
def _getslice(self, start, end):
|
def _getslice(self, start, end):
|
||||||
start_page = start // self._pagesize
|
start_page = start // self._pagesize
|
||||||
end_page = (
|
end_page = self._pagecount if end is None else min(self._pagecount, end // self._pagesize + 1)
|
||||||
self._pagecount if end is None else (end // self._pagesize + 1))
|
|
||||||
skip_elems = start - start_page * self._pagesize
|
skip_elems = start - start_page * self._pagesize
|
||||||
only_more = None if end is None else end - start
|
only_more = None if end is None else end - start
|
||||||
for pagenum in range(start_page, end_page):
|
for pagenum in range(start_page, end_page):
|
||||||
|
|
Loading…
Reference in a new issue