mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-28 14:15:53 +01:00
[youtube] Temporary fix for age-gate
Related: https://stackoverflow.com/a/67629882 https://github.com/yt-dlp/yt-dlp/issues/319 https://github.com/ytdl-org/youtube-dl/issues/29333 https://github.com/ytdl-org/youtube-dl/issues/29086
This commit is contained in:
parent
9fea350f0d
commit
4e6767b5f2
@ -1876,6 +1876,16 @@ def _extract_comments(self, ytcfg, video_id, contents, webpage, xsrf_token):
|
||||
'comment_count': len(comments),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def _get_video_info_params(video_id):
|
||||
return {
|
||||
'video_id': video_id,
|
||||
'eurl': 'https://youtube.googleapis.com/v/' + video_id,
|
||||
'html5': '1',
|
||||
'c': 'TVHTML5',
|
||||
'cver': '6.20180913',
|
||||
}
|
||||
|
||||
def _real_extract(self, url):
|
||||
url, smuggled_data = unsmuggle_url(url, {})
|
||||
video_id = self._match_id(url)
|
||||
@ -1908,13 +1918,11 @@ def get_text(x):
|
||||
base_url + 'get_video_info', video_id,
|
||||
'Fetching youtube music info webpage',
|
||||
'unable to download youtube music info webpage', query={
|
||||
'video_id': video_id,
|
||||
'eurl': 'https://youtube.googleapis.com/v/' + video_id,
|
||||
**self._get_video_info_params(video_id),
|
||||
'el': 'detailpage',
|
||||
'c': 'WEB_REMIX',
|
||||
'cver': '0.1',
|
||||
'cplayer': 'UNIPLAYER',
|
||||
'html5': '1',
|
||||
}, fatal=False)),
|
||||
lambda x: x['player_response'][0],
|
||||
compat_str) or '{}', video_id)
|
||||
@ -1936,12 +1944,8 @@ def get_text(x):
|
||||
pr = self._parse_json(try_get(compat_parse_qs(
|
||||
self._download_webpage(
|
||||
base_url + 'get_video_info', video_id,
|
||||
'Refetching age-gated info webpage',
|
||||
'unable to download video info webpage', query={
|
||||
'video_id': video_id,
|
||||
'eurl': 'https://youtube.googleapis.com/v/' + video_id,
|
||||
'html5': '1',
|
||||
}, fatal=False)),
|
||||
'Refetching age-gated info webpage', 'unable to download video info webpage',
|
||||
query=self._get_video_info_params(video_id), fatal=False)),
|
||||
lambda x: x['player_response'][0],
|
||||
compat_str) or '{}', video_id)
|
||||
if pr:
|
||||
|
Loading…
Reference in New Issue
Block a user