Repository: yt-dlp/yt-dlp
Issue category: Bug Report

Dropbox "No video formats found!" Error for password protected videos
### 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 have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels))
- [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

United States

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

Downloading Dropbox videos with passwords was working fine up to a month ago, but as of late only returns a "No video format found!" error using the same command lines that previously worked fine (i.e. `yt-dlp --video-password "PASSWORD" "URL"`)

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] 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: ['-vU', '--video-password', 'PRIVATE', 'https://www.dropbox.com/scl/fi/mo9nwwjtwgajfsog9ysdp/BTS-Episodes-Series-11-Reaction.mp4?rlkey=v633fmz95bwn0kqtia777nxrm&st=khvzkp6s&dl=0']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.11.24.232931 from yt-dlp/yt-dlp-nightly-builds [4b5eec0aa] (win_x86_exe)
[debug] Python 3.10.11 (CPython AMD64 32bit) - Windows-10-10.0.19042-SP0 (OpenSSL 1.1.1t  7 Feb 2023)
[debug] exe versions: ffmpeg 2024-04-01-git-7bf85d2d3a-essentials_build-www.gyan.dev (setts), ffprobe 2024-04-01-git-7bf85d2d3a-essentials_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.21.0, brotli-1.1.0, certifi-2024.08.30, mutagen-1.47.0, requests-2.32.3, sqlite3-3.40.1, urllib3-2.2.3, websockets-14.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1837 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.11.24.232931 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.11.24.232931 from yt-dlp/yt-dlp-nightly-builds)
[Dropbox] Extracting URL: https://www.dropbox.com/scl/fi/mo9nwwjtwgajfsog9ysdp/BTS-Episodes-Series-11-Reaction.mp4?rlkey=v633fmz95bwn0kqtia777nxrm&st=khvzkp6s&dl=0
[Dropbox] mo9nwwjtwgajfsog9ysdp: Downloading webpage
[Dropbox] mo9nwwjtwgajfsog9ysdp: Downloading webpage
ERROR: [Dropbox] mo9nwwjtwgajfsog9ysdp: No video formats found!; please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.py", line 1624, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1780, in __extract_info
  File "yt_dlp\YoutubeDL.py", line 1839, in process_ie_result
  File "yt_dlp\YoutubeDL.py", line 2846, in process_video_result
  File "yt_dlp\YoutubeDL.py", line 1121, in raise_no_formats
yt_dlp.utils.ExtractorError: [Dropbox] mo9nwwjtwgajfsog9ysdp: No video formats found!; please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
```



Functions to edit:
yt_dlp/extractor/dropbox.py:DropboxIE._real_extract

Patch:
diff --git a/yt_dlp/extractor/dropbox.py b/yt_dlp/extractor/dropbox.py
index c122096230be..2bfeebc7cbba 100644
--- a/yt_dlp/extractor/dropbox.py
+++ b/yt_dlp/extractor/dropbox.py
@@ -48,32 +48,30 @@ def _real_extract(self, url):
         webpage = self._download_webpage(url, video_id)
         fn = urllib.parse.unquote(url_basename(url))
         title = os.path.splitext(fn)[0]
-        password = self.get_param('videopassword')
+        content_id = None
 
         for part in self._yield_decoded_parts(webpage):
             if '/sm/password' in part:
-                webpage = self._download_webpage(
-                    update_url('https://www.dropbox.com/sm/password', query=part.partition('?')[2]), video_id)
+                content_id = self._search_regex(r'content_id=([\w.+=/-]+)', part, 'content ID')
                 break
 
-        if (self._og_search_title(webpage, default=None) == 'Dropbox - Password Required'
-                or 'Enter the password for this link' in webpage):
-            if password:
-                response = self._download_json(
-                    'https://www.dropbox.com/sm/auth', video_id, 'POSTing video password',
-                    headers={'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'},
-                    data=urlencode_postdata({
-                        'is_xhr': 'true',
-                        't': self._get_cookies('https://www.dropbox.com')['t'].value,
-                        'content_id': self._search_regex(r'content_id=([\w.+=/-]+)["\']', webpage, 'content id'),
-                        'password': password,
-                        'url': url,
-                    }))
-
-                if response.get('status') != 'authed':
-                    raise ExtractorError('Invalid password', expected=True)
-            elif not self._get_cookies('https://dropbox.com').get('sm_auth'):
+        if content_id:
+            password = self.get_param('videopassword')
+            if not password:
                 raise ExtractorError('Password protected video, use --video-password <password>', expected=True)
+
+            response = self._download_json(
+                'https://www.dropbox.com/sm/auth', video_id, 'POSTing video password',
+                data=urlencode_postdata({
+                    'is_xhr': 'true',
+                    't': self._get_cookies('https://www.dropbox.com')['t'].value,
+                    'content_id': content_id,
+                    'password': password,
+                    'url': update_url(url, scheme='', netloc=''),
+                }))
+            if response.get('status') != 'authed':
+                raise ExtractorError('Invalid password', expected=True)
+
             webpage = self._download_webpage(url, video_id)
 
         formats, subtitles = [], {}