Repository: yt-dlp/yt-dlp

Issue:
[vimeo] Unable to extract info section
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

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

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2023.01.06** ([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 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)

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

Hello, I am getting increasingly more 'unable to extract info section' errors. The urls are from vimeo. On the same url, sometimes, this error appears and sometimes it doesn't.  at times,can get same error on same url for 6-10 consecutive time.  I'm go through big input text file and it is important for me to avoid as it breaks my operation.  

Using windows exe . Anything to avoid this would be appreciated.  Thank you.

 yt-dlp --get-title https://player.vimeo.com/video/786646692 -vU


### 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] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['--get-title', 'https://player.vimeo.com/video/786646692', '-vU']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2023.01.06 [6becd25] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19044-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2023-01-30-git-2d202985b7-full_build-www.gyan.dev (setts), ffprobe 2023-01-30-git-2d202985b7-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.16.0, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1760 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2023.01.06, Current version: 2023.01.06
yt-dlp is up to date (2023.01.06)
[vimeo] Extracting URL: https://player.vimeo.com/video/786646692
[vimeo] 786646692: Downloading webpage
ERROR: [vimeo] 786646692: Unable to extract info section; 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 "yt_dlp\extractor\common.py", line 680, in extract
  File "yt_dlp\extractor\vimeo.py", line 837, in _real_extract
  File "yt_dlp\extractor\common.py", line 1228, in _search_regex
```

[vimeo] Unable to extract info section
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

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

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2023.01.06** ([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 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)

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

Hello, I am getting increasingly more 'unable to extract info section' errors. The urls are from vimeo. On the same url, sometimes, this error appears and sometimes it doesn't.  at times,can get same error on same url for 6-10 consecutive time.  I'm go through big input text file and it is important for me to avoid as it breaks my operation.  

Using windows exe . Anything to avoid this would be appreciated.  Thank you.

 yt-dlp --get-title https://player.vimeo.com/video/786646692 -vU


### 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] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['--get-title', 'https://player.vimeo.com/video/786646692', '-vU']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2023.01.06 [6becd25] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19044-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2023-01-30-git-2d202985b7-full_build-www.gyan.dev (setts), ffprobe 2023-01-30-git-2d202985b7-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.16.0, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1760 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2023.01.06, Current version: 2023.01.06
yt-dlp is up to date (2023.01.06)
[vimeo] Extracting URL: https://player.vimeo.com/video/786646692
[vimeo] 786646692: Downloading webpage
ERROR: [vimeo] 786646692: Unable to extract info section; 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 "yt_dlp\extractor\common.py", line 680, in extract
  File "yt_dlp\extractor\vimeo.py", line 837, in _real_extract
  File "yt_dlp\extractor\common.py", line 1228, in _search_regex
```



Discussion:
In some player pages, the config object var is no longer followed by a `;`, so the extractor's regex isn't finding the "info section" JSON

A quick fix:
```diff
diff --git a/yt_dlp/extractor/vimeo.py b/yt_dlp/extractor/vimeo.py
index 97b99fc50..8422f93fc 100644
--- a/yt_dlp/extractor/vimeo.py
+++ b/yt_dlp/extractor/vimeo.py
@@ -834,8 +834,8 @@ def _real_extract(self, url):
             raise
 
         if '://player.vimeo.com/video/' in url:
-            config = self._parse_json(self._search_regex(
-                r'\b(?:playerC|c)onfig\s*=\s*({.+?})\s*;', webpage, 'info section'), video_id)
+            config = self._search_json(
+                r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id)
             if config.get('view') == 4:
                 config = self._verify_player_video_password(
                     redirect_url, video_id, headers)
```
> In some player pages, the config object var is no longer followed by a `;`, so the extractor's regex isn't finding the "info section" JSON
> 
> A quick fix:
> 
> ```diff
> diff --git a/yt_dlp/extractor/vimeo.py b/yt_dlp/extractor/vimeo.py
> index 97b99fc50..8422f93fc 100644
> --- a/yt_dlp/extractor/vimeo.py
> +++ b/yt_dlp/extractor/vimeo.py
> @@ -834,8 +834,8 @@ def _real_extract(self, url):
>              raise
>  
>          if '://player.vimeo.com/video/' in url:
> -            config = self._parse_json(self._search_regex(
> -                r'\b(?:playerC|c)onfig\s*=\s*({.+?})\s*;', webpage, 'info section'), video_id)
> +            config = self._search_json(
> +                r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id)
>              if config.get('view') == 4:
>                  config = self._verify_player_video_password(
>                      redirect_url, video_id, headers)
> ```

Thanks, I'm running .exe on windows. How can I implement your changes. I'm not sure the steps to follow to add the patch. thanks.  what do the red highlighted text mean.  do we delete that lines and replace with green lines?
It's a patch for the source code. Can't be applied to the .exe

As a workaround for now, with this video you can use this URL: `yt-dlp "https://vimeo.com/786646692"`

That URL conversion won't work for every player URL though
Somewhat unexpectedly, yt-dl (the master version fixed according to https://github.com/ytdl-org/youtube-dl/issues/31311) isn't seeing the same problem with OP's URL.
> Somewhat unexpectedly, yt-dl (the master version fixed according to https://github.com/ytdl-org/youtube-dl/issues/31311) isn't seeing the same problem with OP's URL.

I get the same regex error with youtube-dl master. Perhaps it's a regional thing?
It happens sometimes,not all the time. Say out of 100 tries, it happens around 20% on the same url. I guess I will have to wait for next update as I don't know how to use without exe files.
Yes, I reproduced it. The new JS is probably being deployed across the CDN servers. The new format has `, "fastly_skyfire":{"avc_url":...` after the braced JSON instead of `;`.

Note the work-around mentioned above.

> Yes, I reproduced it. The new JS is probably being deployed across the CDN servers. The new format has `, "fastly_skyfire":{"avc_url":...` after the braced JSON instead of `;`.
> 
> Note the work-around mentioned above.

Hi, what's the difference in the solution mentioned by 'bashonly' and your commit solution. Looking to see which one to use.  For reference 
1. bashonly code:
`config = self._search_json(
r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id)`

2. your commit code:
`config = self._parse_json(self._search_regex(
r'\b(?:playerC|c)onfig\s*=\s*({.+?})\s*[;,]', webpage, 'info section'), video_id)`

Thank you
They are almost the same. youtube-dl just doesn't have `_search_json`
> `config = self._parse_json(self._search_regex( r'\b(?:playerC|c)onfig\s*=\s*({.+?})\s*[;,]', webpage, 'info section'), video_id)`

This actually doesn't work:
```
[vimeo] 786646692: Downloading webpage
[vimeo] Saving request to 786646692_https_-_player.vimeo.com_video_786646692.dump
ERROR: 786646692: Failed to parse JSON  (caused by JSONDecodeError("Expecting ',' delimiter: line 1 column 870 (char 869)")); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
```

and `, "fastly_skyfire":{"avc_url":...` is part of the JSON that should be parsed
Applying the patch provided by bashonly worked perfectly.
In yt-dl the right patch adds `(?s)` at the start of the pattern, thanks @bashonly, so the actual problem was line breaks in the JS. How the patch shown above worked under test is a mystery.
yt-dlp --list-formats https://player.vimeo.com/video/509558858
[vimeo] Extracting URL: https://player.vimeo.com/video/509558858
[vimeo] 509558858: Downloading webpage
ERROR: [vimeo] 509558858: Unable to extract info section; 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

C:\FFmpeg>yt-dlp -U
Latest version: 2023.01.06, Current version: 2023.01.06
yt-dlp is up to date (2023.01.06)
In some player pages, the config object var is no longer followed by a `;`, so the extractor's regex isn't finding the "info section" JSON

A quick fix:
```diff
diff --git a/yt_dlp/extractor/vimeo.py b/yt_dlp/extractor/vimeo.py
index 97b99fc50..8422f93fc 100644
--- a/yt_dlp/extractor/vimeo.py
+++ b/yt_dlp/extractor/vimeo.py
@@ -834,8 +834,8 @@ def _real_extract(self, url):
             raise
 
         if '://player.vimeo.com/video/' in url:
-            config = self._parse_json(self._search_regex(
-                r'\b(?:playerC|c)onfig\s*=\s*({.+?})\s*;', webpage, 'info section'), video_id)
+            config = self._search_json(
+                r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id)
             if config.get('view') == 4:
                 config = self._verify_player_video_password(
                     redirect_url, video_id, headers)
```
> In some player pages, the config object var is no longer followed by a `;`, so the extractor's regex isn't finding the "info section" JSON
> 
> A quick fix:
> 
> ```diff
> diff --git a/yt_dlp/extractor/vimeo.py b/yt_dlp/extractor/vimeo.py
> index 97b99fc50..8422f93fc 100644
> --- a/yt_dlp/extractor/vimeo.py
> +++ b/yt_dlp/extractor/vimeo.py
> @@ -834,8 +834,8 @@ def _real_extract(self, url):
>              raise
>  
>          if '://player.vimeo.com/video/' in url:
> -            config = self._parse_json(self._search_regex(
> -                r'\b(?:playerC|c)onfig\s*=\s*({.+?})\s*;', webpage, 'info section'), video_id)
> +            config = self._search_json(
> +                r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id)
>              if config.get('view') == 4:
>                  config = self._verify_player_video_password(
>                      redirect_url, video_id, headers)
> ```

Thanks, I'm running .exe on windows. How can I implement your changes. I'm not sure the steps to follow to add the patch. thanks.  what do the red highlighted text mean.  do we delete that lines and replace with green lines?
It's a patch for the source code. Can't be applied to the .exe

As a workaround for now, with this video you can use this URL: `yt-dlp "https://vimeo.com/786646692"`

That URL conversion won't work for every player URL though
Somewhat unexpectedly, yt-dl (the master version fixed according to https://github.com/ytdl-org/youtube-dl/issues/31311) isn't seeing the same problem with OP's URL.
> Somewhat unexpectedly, yt-dl (the master version fixed according to https://github.com/ytdl-org/youtube-dl/issues/31311) isn't seeing the same problem with OP's URL.

I get the same regex error with youtube-dl master. Perhaps it's a regional thing?
It happens sometimes,not all the time. Say out of 100 tries, it happens around 20% on the same url. I guess I will have to wait for next update as I don't know how to use without exe files.
Yes, I reproduced it. The new JS is probably being deployed across the CDN servers. The new format has `, "fastly_skyfire":{"avc_url":...` after the braced JSON instead of `;`.

Note the work-around mentioned above.

> Yes, I reproduced it. The new JS is probably being deployed across the CDN servers. The new format has `, "fastly_skyfire":{"avc_url":...` after the braced JSON instead of `;`.
> 
> Note the work-around mentioned above.

Hi, what's the difference in the solution mentioned by 'bashonly' and your commit solution. Looking to see which one to use.  For reference 
1. bashonly code:
`config = self._search_json(
r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id)`

2. your commit code:
`config = self._parse_json(self._search_regex(
r'\b(?:playerC|c)onfig\s*=\s*({.+?})\s*[;,]', webpage, 'info section'), video_id)`

Thank you
They are almost the same. youtube-dl just doesn't have `_search_json`
> `config = self._parse_json(self._search_regex( r'\b(?:playerC|c)onfig\s*=\s*({.+?})\s*[;,]', webpage, 'info section'), video_id)`

This actually doesn't work:
```
[vimeo] 786646692: Downloading webpage
[vimeo] Saving request to 786646692_https_-_player.vimeo.com_video_786646692.dump
ERROR: 786646692: Failed to parse JSON  (caused by JSONDecodeError("Expecting ',' delimiter: line 1 column 870 (char 869)")); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
```

and `, "fastly_skyfire":{"avc_url":...` is part of the JSON that should be parsed
Applying the patch provided by bashonly worked perfectly.
In yt-dl the right patch adds `(?s)` at the start of the pattern, thanks @bashonly, so the actual problem was line breaks in the JS. How the patch shown above worked under test is a mystery.
yt-dlp --list-formats https://player.vimeo.com/video/509558858
[vimeo] Extracting URL: https://player.vimeo.com/video/509558858
[vimeo] 509558858: Downloading webpage
ERROR: [vimeo] 509558858: Unable to extract info section; 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

C:\FFmpeg>yt-dlp -U
Latest version: 2023.01.06, Current version: 2023.01.06
yt-dlp is up to date (2023.01.06)

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
@@ -358,7 +358,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
         },
         {
             'url': 'http://player.vimeo.com/video/54469442',
-            'md5': 'b3e7f4d2cbb53bd7dc3bb6ff4ed5cfbd',
+            'md5': '619b811a4417aa4abe78dc653becf511',
             'note': 'Videos that embed the url in the player page',
             'info_dict': {
                 'id': '54469442',
@@ -389,8 +389,8 @@ class VimeoIE(VimeoBaseInfoExtractor):
                 'uploader_id': 'user18948128',
                 'uploader': 'Jaime Marquínez Ferrándiz',
                 'duration': 10,
-                'description': 'md5:dca3ea23adb29ee387127bc4ddfce63f',
-                'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_960',
+                'description': 'md5:6173f270cd0c0119f22817204b3eb86c',
+                'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_1280',
                 'view_count': int,
                 'comment_count': int,
                 'like_count': int,
@@ -407,7 +407,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
                 'id': '75629013',
                 'ext': 'mp4',
                 'title': 'Key & Peele: Terrorist Interrogation',
-                'description': 'md5:8678b246399b070816b12313e8b4eb5c',
+                'description': 'md5:6173f270cd0c0119f22817204b3eb86c',
                 'uploader_url': r're:https?://(?:www\.)?vimeo\.com/atencio',
                 'uploader_id': 'atencio',
                 'uploader': 'Peter Atencio',
@@ -559,8 +559,8 @@ class VimeoIE(VimeoBaseInfoExtractor):
                 'uploader_id': 'user18948128',
                 'uploader': 'Jaime Marquínez Ferrándiz',
                 'duration': 10,
-                'description': 'md5:dca3ea23adb29ee387127bc4ddfce63f',
-                'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_960',
+                'description': 'md5:6173f270cd0c0119f22817204b3eb86c',
+                'thumbnail': 'https://i.vimeocdn.com/video/440665496-b2c5aee2b61089442c794f64113a8e8f7d5763c3e6b3ebfaf696ae6413f8b1f4-d_1280',
                 'view_count': int,
                 'comment_count': int,
                 'like_count': int,
@@ -834,8 +834,8 @@ def _real_extract(self, url):
             raise
 
         if '://player.vimeo.com/video/' in url:
-            config = self._parse_json(self._search_regex(
-                r'\b(?:playerC|c)onfig\s*=\s*({.+?})\s*;', webpage, 'info section'), video_id)
+            config = self._search_json(
+                r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id)
             if config.get('view') == 4:
                 config = self._verify_player_video_password(
                     redirect_url, video_id, headers)


Test patch: