From 3582a238a09ee929b75b2030a99146f6b4aa5b23 Mon Sep 17 00:00:00 2001 From: grqx Date: Tue, 1 Oct 2024 23:51:00 +1300 Subject: [PATCH] update url and video id instead of returning a url result --- yt_dlp/extractor/googledrive.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/googledrive.py b/yt_dlp/extractor/googledrive.py index 6399c66ab8..33ac5cb8a5 100644 --- a/yt_dlp/extractor/googledrive.py +++ b/yt_dlp/extractor/googledrive.py @@ -179,9 +179,16 @@ class GoogleDriveIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - _, webpage_urlh = self._download_webpage_handle(url, video_id) + try: + _, webpage_urlh = self._download_webpage_handle(url, video_id) + except ExtractorError as e: + if isinstance(e.cause, HTTPError): + if e.cause.status in (401, 403): + self.raise_login_required('Access Denied') + raise if webpage_urlh.url != url: - return self.url_result(webpage_urlh.url) + url = webpage_urlh.url + video_id = self._match_id(url) video_info = urllib.parse.parse_qs(self._download_webpage( 'https://drive.google.com/get_video_info', @@ -378,7 +385,7 @@ class GoogleDriveFolderIE(InfoExtractor): except ExtractorError as e: if isinstance(e.cause, HTTPError): if e.cause.status == 404: - self.raise_no_formats(e.cause.msg) + self.raise_no_formats(e.cause.msg, expected=True) elif e.cause.status == 403: # logged in with an account without access self.raise_login_required('Access Denied')