aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-06-18 20:32:52 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-06-18 20:32:52 +0530
commit4e6767b5f2e2523ebd3dd1240584ead53e8c8905 (patch)
tree638a61efa499b63c500c39cadf272484079d9848
parent9fea350f0d76b5d0c1fc813e4badc129ad02c865 (diff)
downloadhypervideo-pre-4e6767b5f2e2523ebd3dd1240584ead53e8c8905.tar.lz
hypervideo-pre-4e6767b5f2e2523ebd3dd1240584ead53e8c8905.tar.xz
hypervideo-pre-4e6767b5f2e2523ebd3dd1240584ead53e8c8905.zip
[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
-rw-r--r--yt_dlp/extractor/youtube.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index 14514940d..375fc1909 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -1876,6 +1876,16 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'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 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
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 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
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: