mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 12:23:19 +00:00
[utils] Use in OnDemandPagedList by default
Not using cache results in redundant network I/O due to downloading the same pages while using --playlist-items n-m
This commit is contained in:
parent
cf5f6ed5be
commit
6be08ce602
|
@ -291,7 +291,7 @@ def _real_extract(self, url):
|
||||||
functools.partial(
|
functools.partial(
|
||||||
self._tracks_page_func,
|
self._tracks_page_func,
|
||||||
'%s/%s' % (user_id, list_type), video_id, 'list of %s' % list_type),
|
'%s/%s' % (user_id, list_type), video_id, 'list of %s' % list_type),
|
||||||
self._PAGE_SIZE, use_cache=True)
|
self._PAGE_SIZE)
|
||||||
|
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
entries, video_id, '%s (%s)' % (username, list_type), description)
|
entries, video_id, '%s (%s)' % (username, list_type), description)
|
||||||
|
|
|
@ -122,7 +122,7 @@ def _extract_playlist(self, orig_path, video_id, webpage):
|
||||||
playlist_title = self._og_search_title(webpage, fatal=False)
|
playlist_title = self._og_search_title(webpage, fatal=False)
|
||||||
entries = OnDemandPagedList(
|
entries = OnDemandPagedList(
|
||||||
functools.partial(self._fetch_page, team, video_id),
|
functools.partial(self._fetch_page, team, video_id),
|
||||||
self._PAGE_SIZE, use_cache=True)
|
self._PAGE_SIZE)
|
||||||
|
|
||||||
return self.playlist_result(entries, team, playlist_title)
|
return self.playlist_result(entries, team, playlist_title)
|
||||||
|
|
||||||
|
|
|
@ -1933,7 +1933,7 @@ def __len__(self):
|
||||||
|
|
||||||
|
|
||||||
class OnDemandPagedList(PagedList):
|
class OnDemandPagedList(PagedList):
|
||||||
def __init__(self, pagefunc, pagesize, use_cache=False):
|
def __init__(self, pagefunc, pagesize, use_cache=True):
|
||||||
self._pagefunc = pagefunc
|
self._pagefunc = pagefunc
|
||||||
self._pagesize = pagesize
|
self._pagesize = pagesize
|
||||||
self._use_cache = use_cache
|
self._use_cache = use_cache
|
||||||
|
|
Loading…
Reference in a new issue