mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-25 09:52:31 +00:00
[youtube] Remote download limit
This commit is contained in:
parent
5cbe7563be
commit
c37ca4732b
@ -3319,8 +3319,6 @@ def _real_initialize(self):
|
|||||||
def _entries(self, page):
|
def _entries(self, page):
|
||||||
# The extraction process is the same as for playlists, but the regex
|
# The extraction process is the same as for playlists, but the regex
|
||||||
# for the video ids doesn't contain an index
|
# for the video ids doesn't contain an index
|
||||||
limit = self._downloader.params.get('max_downloads') or 1000
|
|
||||||
|
|
||||||
ids = []
|
ids = []
|
||||||
more_widget_html = content_html = page
|
more_widget_html = content_html = page
|
||||||
for page_num in itertools.count(1):
|
for page_num in itertools.count(1):
|
||||||
@ -3333,19 +3331,11 @@ def _entries(self, page):
|
|||||||
if not new_ids:
|
if not new_ids:
|
||||||
break
|
break
|
||||||
|
|
||||||
done = False
|
|
||||||
if len(new_ids) + len(ids) > limit:
|
|
||||||
new_ids = new_ids[:limit - len(ids)]
|
|
||||||
done = True
|
|
||||||
|
|
||||||
ids.extend(new_ids)
|
ids.extend(new_ids)
|
||||||
|
|
||||||
for entry in self._ids_to_results(new_ids):
|
for entry in self._ids_to_results(new_ids):
|
||||||
yield entry
|
yield entry
|
||||||
|
|
||||||
if done:
|
|
||||||
break
|
|
||||||
|
|
||||||
mobj = re.search(r'data-uix-load-more-href="/?(?P<more>[^"]+)"', more_widget_html)
|
mobj = re.search(r'data-uix-load-more-href="/?(?P<more>[^"]+)"', more_widget_html)
|
||||||
if not mobj:
|
if not mobj:
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user