mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-25 03:32:05 +00:00
This commit is contained in:
parent
64e419bd73
commit
f1bc56c99b
1 changed files with 19 additions and 4 deletions
|
@ -16,6 +16,7 @@ from ..jsinterp import JSInterpreter
|
||||||
from ..swfinterp import SWFInterpreter
|
from ..swfinterp import SWFInterpreter
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_chr,
|
compat_chr,
|
||||||
|
compat_HTTPError,
|
||||||
compat_parse_qs,
|
compat_parse_qs,
|
||||||
compat_urllib_parse_unquote,
|
compat_urllib_parse_unquote,
|
||||||
compat_urllib_parse_unquote_plus,
|
compat_urllib_parse_unquote_plus,
|
||||||
|
@ -3009,10 +3010,24 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
||||||
for page_num in itertools.count(1):
|
for page_num in itertools.count(1):
|
||||||
if not continuation:
|
if not continuation:
|
||||||
break
|
break
|
||||||
browse = self._download_json(
|
count = 0
|
||||||
'https://www.youtube.com/browse_ajax', None,
|
retries = 3
|
||||||
'Downloading page %d' % page_num,
|
while count <= retries:
|
||||||
headers=headers, query=continuation, fatal=False)
|
try:
|
||||||
|
# Downloading page may result in intermittent 5xx HTTP error
|
||||||
|
# that is usually worked around with a retry
|
||||||
|
browse = self._download_json(
|
||||||
|
'https://www.youtube.com/browse_ajax', None,
|
||||||
|
'Downloading page %d%s'
|
||||||
|
% (page_num, ' (retry #%d)' % count if count else ''),
|
||||||
|
headers=headers, query=continuation)
|
||||||
|
break
|
||||||
|
except ExtractorError as e:
|
||||||
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code in (500, 503):
|
||||||
|
count += 1
|
||||||
|
if count <= retries:
|
||||||
|
continue
|
||||||
|
raise
|
||||||
if not browse:
|
if not browse:
|
||||||
break
|
break
|
||||||
response = try_get(browse, lambda x: x[1]['response'], dict)
|
response = try_get(browse, lambda x: x[1]['response'], dict)
|
||||||
|
|
Loading…
Reference in a new issue