summary refs log tree commit diff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2021-01-29 11:52:48 +0100
committerRemita Amine <remitamine@gmail.com>2021-01-29 11:53:49 +0100
commitba15b2fee673f76c2cff2f193d5b4a19029b501f (patch)
tree0482f4c91ccd1bd8a2b26e0a6c2026e116ba6ff2
parent56a7ee903360fe89cb5372805473b508153fb856 (diff)
downloadyoutube-dl-ba15b2fee673f76c2cff2f193d5b4a19029b501f.tar.gz
youtube-dl-ba15b2fee673f76c2cff2f193d5b4a19029b501f.tar.xz
youtube-dl-ba15b2fee673f76c2cff2f193d5b4a19029b501f.zip
[googledrive] report download page errors(closes #28005)
-rw-r--r--youtube_dl/extractor/googledrive.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/youtube_dl/extractor/googledrive.py b/youtube_dl/extractor/googledrive.py
index de8c80e36..3f2de00f1 100644
--- a/youtube_dl/extractor/googledrive.py
+++ b/youtube_dl/extractor/googledrive.py
@@ -7,6 +7,7 @@ from ..compat import compat_parse_qs
 from ..utils import (
     determine_ext,
     ExtractorError,
+    get_element_by_class,
     int_or_none,
     lowercase_escape,
     try_get,
@@ -237,7 +238,7 @@ class GoogleDriveIE(InfoExtractor):
                 if confirmation_webpage:
                     confirm = self._search_regex(
                         r'confirm=([^&"\']+)', confirmation_webpage,
-                        'confirmation code', fatal=False)
+                        'confirmation code', default=None)
                     if confirm:
                         confirmed_source_url = update_url_query(source_url, {
                             'confirm': confirm,
@@ -245,6 +246,11 @@ class GoogleDriveIE(InfoExtractor):
                         urlh = request_source_file(confirmed_source_url, 'confirmed source')
                         if urlh and urlh.headers.get('Content-Disposition'):
                             add_source_format(urlh)
+                    else:
+                        self.report_warning(
+                            get_element_by_class('uc-error-subcaption', confirmation_webpage)
+                            or get_element_by_class('uc-error-caption', confirmation_webpage)
+                            or 'unable to extract confirmation code')
 
         if not formats and reason:
             raise ExtractorError(reason, expected=True)