Repository: yt-dlp/yt-dlp

Issue:
[vimeo:ondemand] "Unable to extract login token"
### 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)
- [ ] 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

England

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

A few months ago I used yt-dlp to download rented/purchased videos from vimeo on demand, passing my login info via the usual commands. However I tried doing this today using the same method I was previously using and get the follow error:

```
[debug] Command-line config: ['-vU', '-u', 'PRIVATE', '-p', 'PRIVATE', 'https://vimeo.com/ondemand/cristianoronaldo']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8 
[debug] yt-dlp version nightly@2024.02.22.232849 from yt-dlp/yt-dlp-nightly-builds [55f183337] (pip) 
[debug] Python 3.10.2 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1m  14 Dec 2021) 
[debug] exe versions: ffmpeg 2023-09-29-git-40aa451154-full_build-www.gyan.dev (setts), ffprobe 2023-09-29-git-40aa451154-full_build-www.gyan.dev 
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.07.22, mutagen-1.46.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.0.4, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1834 extractors 
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.02.22.232849 from yt-dlp/yt-dlp-nightly-builds 
yt-dlp is up to date (nightly@2024.02.22.232849 from yt-dlp/yt-dlp-nightly-builds)
[vimeo:ondemand] Downloading login page 
ERROR: [vimeo:ondemand] cristianoronaldo: Unable to extract login token; 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
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 729, in extract
    self.initialize()
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 635, in initialize
    self._perform_login(username, password)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\vimeo.py", line 53, in _perform_login
    token, vuid = self._extract_xsrft_and_vuid(webpage)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\vimeo.py", line 104, in _extract_xsrft_and_vuid
    xsrft = self._search_regex(
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 1280, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
```

Ive tried this on a rented video, purchased video and a public video (just in case it was only affecting video purchases) and it gives the same error for allof them.

### 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', '-u', 'PRIVATE', '-p', 'PRIVATE', 'https://vimeo.com/ondemand/cristianoronaldo']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8 
[debug] yt-dlp version nightly@2024.02.22.232849 from yt-dlp/yt-dlp-nightly-builds [55f183337] (pip) 
[debug] Python 3.10.2 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1m  14 Dec 2021) 
[debug] exe versions: ffmpeg 2023-09-29-git-40aa451154-full_build-www.gyan.dev (setts), ffprobe 2023-09-29-git-40aa451154-full_build-www.gyan.dev 
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.07.22, mutagen-1.46.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.0.4, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1834 extractors 
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.02.22.232849 from yt-dlp/yt-dlp-nightly-builds 
yt-dlp is up to date (nightly@2024.02.22.232849 from yt-dlp/yt-dlp-nightly-builds)
[vimeo:ondemand] Downloading login page 
ERROR: [vimeo:ondemand] cristianoronaldo: Unable to extract login token; 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
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 729, in extract
    self.initialize()
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 635, in initialize
    self._perform_login(username, password)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\vimeo.py", line 53, in _perform_login
    token, vuid = self._extract_xsrft_and_vuid(webpage)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\vimeo.py", line 104, in _extract_xsrft_and_vuid
    xsrft = self._search_regex(
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 1280, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
```



Discussion:
this fixes login for me
```diff
diff --git a/yt_dlp/extractor/vimeo.py b/yt_dlp/extractor/vimeo.py
index 208e11184..3f60d5fb9 100644
--- a/yt_dlp/extractor/vimeo.py
+++ b/yt_dlp/extractor/vimeo.py
@@ -48,17 +48,15 @@ def _unsmuggle_headers(self, url):
         return url, data, headers
 
     def _perform_login(self, username, password):
-        webpage = self._download_webpage(
-            self._LOGIN_URL, None, 'Downloading login page')
-        token, vuid = self._extract_xsrft_and_vuid(webpage)
+        viewer = self._download_json('https://vimeo.com/_next/viewer', None, 'Downloading login token')
         data = {
             'action': 'login',
             'email': username,
             'password': password,
             'service': 'vimeo',
-            'token': token,
+            'token': viewer['xsrft'],
         }
-        self._set_vimeo_cookie('vuid', vuid)
+        self._set_vimeo_cookie('vuid', viewer['vuid'])
         try:
             self._download_webpage(
                 self._LOGIN_URL, None, 'Logging in',
```

Resolving patch:
diff --git a/yt_dlp/extractor/vimeo.py b/yt_dlp/extractor/vimeo.py
--- a/yt_dlp/extractor/vimeo.py
+++ b/yt_dlp/extractor/vimeo.py
@@ -48,17 +48,15 @@ def _unsmuggle_headers(self, url):
         return url, data, headers
 
     def _perform_login(self, username, password):
-        webpage = self._download_webpage(
-            self._LOGIN_URL, None, 'Downloading login page')
-        token, vuid = self._extract_xsrft_and_vuid(webpage)
+        viewer = self._download_json('https://vimeo.com/_next/viewer', None, 'Downloading login token')
         data = {
             'action': 'login',
             'email': username,
             'password': password,
             'service': 'vimeo',
-            'token': token,
+            'token': viewer['xsrft'],
         }
-        self._set_vimeo_cookie('vuid', vuid)
+        self._set_vimeo_cookie('vuid', viewer['vuid'])
         try:
             self._download_webpage(
                 self._LOGIN_URL, None, 'Logging in',


Test patch: