diff options
author | Unknown <blackjack4494@web.de> | 2020-09-14 12:54:54 +0200 |
---|---|---|
committer | Unknown <blackjack4494@web.de> | 2020-09-14 12:54:54 +0200 |
commit | 1985f657e5df8529444d7f3b6726b07bae202506 (patch) | |
tree | 1c26923c100d36910a66dd9c8ee3897d7e8e8fc7 /youtube_dlc/extractor/googledrive.py | |
parent | 0e0b56a2909f3c7191b6d276c1e751c94d6faafe (diff) | |
parent | e69dd7809034c0bec432438e2aa96b70fdea8294 (diff) | |
download | hypervideo-pre-1985f657e5df8529444d7f3b6726b07bae202506.tar.lz hypervideo-pre-1985f657e5df8529444d7f3b6726b07bae202506.tar.xz hypervideo-pre-1985f657e5df8529444d7f3b6726b07bae202506.zip |
Merge branch 'ytdl-org-master'
Diffstat (limited to 'youtube_dlc/extractor/googledrive.py')
-rw-r--r-- | youtube_dlc/extractor/googledrive.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/youtube_dlc/extractor/googledrive.py b/youtube_dlc/extractor/googledrive.py index 886fdd532..ec0d58a57 100644 --- a/youtube_dlc/extractor/googledrive.py +++ b/youtube_dlc/extractor/googledrive.py @@ -220,19 +220,27 @@ class GoogleDriveIE(InfoExtractor): 'id': video_id, 'export': 'download', }) - urlh = self._request_webpage( - source_url, video_id, note='Requesting source file', - errnote='Unable to request source file', fatal=False) + + def request_source_file(source_url, kind): + return self._request_webpage( + source_url, video_id, note='Requesting %s file' % kind, + errnote='Unable to request %s file' % kind, fatal=False) + urlh = request_source_file(source_url, 'source') if urlh: - def add_source_format(src_url): + def add_source_format(urlh): formats.append({ - 'url': src_url, + # Use redirect URLs as download URLs in order to calculate + # correct cookies in _calc_cookies. + # Using original URLs may result in redirect loop due to + # google.com's cookies mistakenly used for googleusercontent.com + # redirect URLs (see #23919). + 'url': urlh.geturl(), 'ext': determine_ext(title, 'mp4').lower(), 'format_id': 'source', 'quality': 1, }) if urlh.headers.get('Content-Disposition'): - add_source_format(source_url) + add_source_format(urlh) else: confirmation_webpage = self._webpage_read_content( urlh, url, video_id, note='Downloading confirmation page', @@ -242,9 +250,12 @@ class GoogleDriveIE(InfoExtractor): r'confirm=([^&"\']+)', confirmation_webpage, 'confirmation code', fatal=False) if confirm: - add_source_format(update_url_query(source_url, { + confirmed_source_url = update_url_query(source_url, { 'confirm': confirm, - })) + }) + urlh = request_source_file(confirmed_source_url, 'confirmed source') + if urlh and urlh.headers.get('Content-Disposition'): + add_source_format(urlh) if not formats: reason = self._search_regex( |