Repository: yt-dlp/yt-dlp

Issue:
Missing source format in Googledrive extractor
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting that yt-dlp is broken on a **supported** site
- [X] I've verified that I'm running yt-dlp version **2023.03.04** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

Indonesia

### Provide a description that is worded well enough to be understood

I would like to report an issue regarding the Googledrive extractor in yt-dlp. Currently, there is a missing source format in the extractor, which prevents accessing certain types of content hosted on Google Drive.

When attempting to download videos from Google Drive using yt-dlp, the extractor fails to recognize and extract the specific source format required for these videos. This results in the inability to download the desired content.

I would expect yt-dlp to support and successfully extract the source format for all eligible videos hosted on Google Drive, allowing users to download their desired content without any issues.

Please let me know if any further information or clarification is required. I would be happy to assist in resolving this issue and provide any necessary details.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-Uv', '-F', 'https://drive.google.com/file/d/1-2tBQWWEIRGA5qrW9qkCv-fUHbN9RoYj/view?usp=drive_link', '--cookies=/Users/naufalazharalmizan/Downloads/cookies (3).txt']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2023.06.17.224306 [01aba2519] (zip)
[debug] Python 3.11.4 (CPython x86_64 64bit) - macOS-10.15.7-x86_64-i386-64bit (OpenSSL 1.1.1u  30 May 2023)
[debug] exe versions: ffmpeg N-111057-g024c30aa3b-tessus (setts)
[debug] Optional libraries: certifi-2023.05.07, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Loaded 1845 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Available version: nightly@2023.06.17.224306, Current version: nightly@2023.06.17.224306
Current Build Hash: 6774b889af8aec948511256bde94834063bb4729ea1e0a89a5b79e38a71e3593
yt-dlp is up to date (nightly@2023.06.17.224306)
[GoogleDrive] Extracting URL: https://drive.google.com/file/d/1-2tBQWWEIRGA5qrW9qkCv-fUHbN9RoYj/view?usp=drive_link
[GoogleDrive] 1-2tBQWWEIRGA5qrW9qkCv-fUHbN9RoYj: Downloading video webpage
[GoogleDrive] 1-2tBQWWEIRGA5qrW9qkCv-fUHbN9RoYj: Requesting source file
[GoogleDrive] 1-2tBQWWEIRGA5qrW9qkCv-fUHbN9RoYj: Requesting confirmed source file
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[info] Available formats for 1-2tBQWWEIRGA5qrW9qkCv-fUHbN9RoYj:
ID EXT RESOLUTION │ PROTO │ VCODEC  ACODEC
───────────────────────────────────────────
18 mp4 640x360    │ https │ unknown unknown
22 mp4 1280x720   │ https │ unknown unknown
37 mp4 1920x1080  │ https │ unknown unknown
```



Discussion:

Resolving patch:
diff --git a/yt_dlp/extractor/googledrive.py b/yt_dlp/extractor/googledrive.py
--- a/yt_dlp/extractor/googledrive.py
+++ b/yt_dlp/extractor/googledrive.py
@@ -5,7 +5,9 @@
 from ..utils import (
     ExtractorError,
     determine_ext,
+    extract_attributes,
     get_element_by_class,
+    get_element_html_by_id,
     int_or_none,
     lowercase_escape,
     try_get,
@@ -34,6 +36,7 @@ class GoogleDriveIE(InfoExtractor):
             'ext': 'mp4',
             'title': 'Big Buck Bunny.mp4',
             'duration': 45,
+            'thumbnail': 'https://drive.google.com/thumbnail?id=0ByeS4oOUV-49Zzh4R1J6R09zazQ',
         }
     }, {
         # video can't be watched anonymously due to view count limit reached,
@@ -207,10 +210,10 @@ def get_value(key):
                 'export': 'download',
             })
 
-        def request_source_file(source_url, kind):
+        def request_source_file(source_url, kind, data=None):
             return self._request_webpage(
                 source_url, video_id, note='Requesting %s file' % kind,
-                errnote='Unable to request %s file' % kind, fatal=False)
+                errnote='Unable to request %s file' % kind, fatal=False, data=data)
         urlh = request_source_file(source_url, 'source')
         if urlh:
             def add_source_format(urlh):
@@ -237,14 +240,10 @@ def add_source_format(urlh):
                     urlh, url, video_id, note='Downloading confirmation page',
                     errnote='Unable to confirm download', fatal=False)
                 if confirmation_webpage:
-                    confirm = self._search_regex(
-                        r'confirm=([^&"\']+)', confirmation_webpage,
-                        'confirmation code', default=None)
-                    if confirm:
-                        confirmed_source_url = update_url_query(source_url, {
-                            'confirm': confirm,
-                        })
-                        urlh = request_source_file(confirmed_source_url, 'confirmed source')
+                    confirmed_source_url = extract_attributes(
+                        get_element_html_by_id('download-form', confirmation_webpage) or '').get('action')
+                    if confirmed_source_url:
+                        urlh = request_source_file(confirmed_source_url, 'confirmed source', data=b'')
                         if urlh and urlh.headers.get('Content-Disposition'):
                             add_source_format(urlh)
                     else:


Test patch: