mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-26 18:34:32 +01:00
YoutubePlaylistIE: break only if there's no entry field in the response
Otherwise the Favorite videos playlist cannot be downloaded complete. Also break if it reach the maximum value of the start-index.
This commit is contained in:
parent
eb6a41ba0f
commit
771822ebb8
@ -696,7 +696,11 @@ class YoutubePlaylistIE(InfoExtractor):
|
|||||||
videos = []
|
videos = []
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
url = self._TEMPLATE_URL % (playlist_id, self._MAX_RESULTS, self._MAX_RESULTS * (page_num - 1) + 1)
|
start_index = self._MAX_RESULTS * (page_num - 1) + 1
|
||||||
|
if start_index >= 1000:
|
||||||
|
self._downloader.report_warning(u'Max number of results reached')
|
||||||
|
break
|
||||||
|
url = self._TEMPLATE_URL % (playlist_id, self._MAX_RESULTS, start_index)
|
||||||
page = self._download_webpage(url, playlist_id, u'Downloading page #%s' % page_num)
|
page = self._download_webpage(url, playlist_id, u'Downloading page #%s' % page_num)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -715,9 +719,6 @@ class YoutubePlaylistIE(InfoExtractor):
|
|||||||
index = entry['yt$position']['$t']
|
index = entry['yt$position']['$t']
|
||||||
if 'media$group' in entry and 'media$player' in entry['media$group']:
|
if 'media$group' in entry and 'media$player' in entry['media$group']:
|
||||||
videos.append((index, entry['media$group']['media$player']['url']))
|
videos.append((index, entry['media$group']['media$player']['url']))
|
||||||
|
|
||||||
if len(response['feed']['entry']) < self._MAX_RESULTS:
|
|
||||||
break
|
|
||||||
page_num += 1
|
page_num += 1
|
||||||
|
|
||||||
videos = [v[1] for v in sorted(videos)]
|
videos = [v[1] for v in sorted(videos)]
|
||||||
|
Loading…
Reference in New Issue
Block a user