From 99d9105f33ea72c58ed98fd0c951a7f50ea2f647 Mon Sep 17 00:00:00 2001 From: grqx_wsl <173253225+grqx@users.noreply.github.com> Date: Sun, 28 Jul 2024 03:36:55 +1200 Subject: [PATCH] [GoogleDrive] add support for shortcut urls: follow redirection Example url: https://drive.google.com/file/d/17OrYKQBPRm4J_D1rsGbo4eOmm1_SfoIY/ Redirects to(real video): https://drive.google.com/file/d/1Jp0I0tS-qMxtXNehGQW5_hWhwgC0FeeB/edit --- yt_dlp/extractor/googledrive.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yt_dlp/extractor/googledrive.py b/yt_dlp/extractor/googledrive.py index 1a58882944..437b31db9b 100644 --- a/yt_dlp/extractor/googledrive.py +++ b/yt_dlp/extractor/googledrive.py @@ -167,6 +167,10 @@ class GoogleDriveIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) + _, webpage_urlh = self._download_webpage_handle(url, video_id) + if webpage_urlh.url != url: + return self.url_result(webpage_urlh.url) + video_info = urllib.parse.parse_qs(self._download_webpage( 'https://drive.google.com/get_video_info', video_id, 'Downloading video webpage', query={'docid': video_id}))