mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-23 04:30:10 +09:00
Until further investigation.
This commit is contained in:
parent
8f56907afa
commit
061c030133
@ -2478,24 +2478,37 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
|||||||
headers = {
|
headers = {
|
||||||
'x-youtube-client-name': '1',
|
'x-youtube-client-name': '1',
|
||||||
'x-youtube-client-version': '2.20201112.04.01',
|
'x-youtube-client-version': '2.20201112.04.01',
|
||||||
|
'content-type': 'application/json',
|
||||||
}
|
}
|
||||||
if identity_token:
|
if identity_token:
|
||||||
headers['x-youtube-identity-token'] = identity_token
|
headers['x-youtube-identity-token'] = identity_token
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'context': {
|
||||||
|
'client': {
|
||||||
|
'clientName': 'WEB',
|
||||||
|
'clientVersion': '2.20201021.03.00',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
for page_num in itertools.count(1):
|
for page_num in itertools.count(1):
|
||||||
if not continuation:
|
if not continuation:
|
||||||
break
|
break
|
||||||
|
data['continuation'] = continuation['continuation']
|
||||||
|
data['clickTracking'] = {
|
||||||
|
'clickTrackingParams': continuation['itct']
|
||||||
|
}
|
||||||
count = 0
|
count = 0
|
||||||
retries = 3
|
retries = 3
|
||||||
while count <= retries:
|
while count <= retries:
|
||||||
try:
|
try:
|
||||||
# Downloading page may result in intermittent 5xx HTTP error
|
# Downloading page may result in intermittent 5xx HTTP error
|
||||||
# that is usually worked around with a retry
|
# that is usually worked around with a retry
|
||||||
browse = self._download_json(
|
response = self._download_json(
|
||||||
'https://www.youtube.com/browse_ajax', None,
|
'https://www.youtube.com/youtubei/v1/browse?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8',
|
||||||
'Downloading page %d%s'
|
None, 'Downloading page %d%s' % (page_num, ' (retry #%d)' % count if count else ''),
|
||||||
% (page_num, ' (retry #%d)' % count if count else ''),
|
headers=headers, data=json.dumps(data).encode('utf8'))
|
||||||
headers=headers, query=continuation)
|
|
||||||
break
|
break
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
if isinstance(e.cause, compat_HTTPError) and e.cause.code in (500, 503):
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code in (500, 503):
|
||||||
@ -2503,9 +2516,6 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
|||||||
if count <= retries:
|
if count <= retries:
|
||||||
continue
|
continue
|
||||||
raise
|
raise
|
||||||
if not browse:
|
|
||||||
break
|
|
||||||
response = try_get(browse, lambda x: x[1]['response'], dict)
|
|
||||||
if not response:
|
if not response:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user