Repository: yt-dlp/yt-dlp

Issue:
Patreon support: No supported media found in this post
### 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

_No response_

### Provide a description that is worded well enough to be understood

The latest version update yt-dlp 2024.04.09 broke the functionality of efficiently downloading Vimeo/Patreon videos. I'm not sure if the change is intentional, because the download otherwise functions normally on yt-dlp 2023.12.30, the older version that I had. The outputs for both versions here are tested with a public video URL (no need for cookies file or such).

The following is the debug output of the older version 2023.12.30 where download succeeds:

```
C:\Users\user>yt-dlp -v -f bestvideo+bestaudio --merge-output-format mkv "https://www.patreon.com/posts/4k-spiderman-4k-96414599"
[debug] Command-line config: ['-v', '-f', 'bestvideo+bestaudio', '--merge-output-format', 'mkv', 'https://www.patreon.com/posts/4k-spiderman-4k-96414599']
[debug] Encodings: locale cp65001, fs utf-8, pref cp65001, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.12.30 from yt-dlp/yt-dlp [f10589e34] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 7.0-full_build-www.gyan.dev (setts), ffprobe 7.0-full_build-www.gyan.dev, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.19.1, brotli-1.1.0, certifi-2023.11.17, mutagen-1.47.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.1.0, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1798 extractors
[Patreon] Extracting URL: https://www.patreon.com/posts/4k-spiderman-4k-96414599
[Patreon] 96414599: Downloading API JSON
[vimeo] Extracting URL: https://player.vimeo.com/video/902250943?badge=0&amp;autopause=0&amp;player_id=0&amp;app_id=136277#__youtubedl_smuggle=%7B%22referer%22%3A+%22https%3A%2F%2Fpatreon.com%22%7D
[vimeo] 902250943: Downloading webpage
[vimeo] 902250943: Downloading akfire_interconnect_quic m3u8 information
[vimeo] 902250943: Downloading akfire_interconnect_quic m3u8 information
[vimeo] 902250943: Downloading fastly_skyfire m3u8 information
[vimeo] 902250943: Downloading fastly_skyfire m3u8 information
[vimeo] 902250943: Downloading akfire_interconnect_quic MPD information
[vimeo] 902250943: Downloading akfire_interconnect_quic MPD information
[vimeo] 902250943: Downloading fastly_skyfire MPD information
[vimeo] 902250943: Downloading fastly_skyfire MPD information
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, lang, vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, id
[info] 902250943: Downloading 1 format(s): dash-fastly_skyfire_sep-video-b9c571da+dash-fastly_skyfire_sep-audio-718104e7

[debug] Invoking dashsegments downloader on "https://skyfire.vimeocdn.com/1713399342-0x13cb265fc03481667947f03e04274d7b156584cd/aa0abfbe-1340-4163-b460-4c396b84255b/sep/video/04c6014f,1bd2a7b8,2bf13449,5e56e1a7,72591753,b9c571da,f64e7179/audio/708dd0f0,718104e7,9bd321a6/master.mpd?base64_init=1&query_string_ranges=1"
[dashsegments] Total fragments: 13
[download] Destination: ❤️(4K) Spiderman Girl Yeonhwa’s Gift ❤️(4K) 스파이더맨걸 연화의 선물 [902250943].fdash-fastly_skyfire_sep-video-b9c571da.mp4
[debug] File locking is not supported. Proceeding without locking
[download] 100% of  199.20MiB in 00:00:04 at 40.30MiB/s
[debug] Invoking dashsegments downloader on "https://skyfire.vimeocdn.com/1713399342-0x13cb265fc03481667947f03e04274d7b156584cd/aa0abfbe-1340-4163-b460-4c396b84255b/sep/video/04c6014f,1bd2a7b8,2bf13449,5e56e1a7,72591753,b9c571da,f64e7179/audio/708dd0f0,718104e7,9bd321a6/master.mpd?base64_init=1&query_string_ranges=1"
[dashsegments] Total fragments: 13
[download] Destination: ❤️(4K) Spiderman Girl Yeonhwa’s Gift ❤️(4K) 스파이더맨걸 연화의 선물 [902250943].fdash-fastly_skyfire_sep-audio-718104e7.m4a
[download] 100% of  872.93KiB in 00:00:00 at 1.11MiB/s
[Merger] Merging formats into "❤️(4K) Spiderman Girl Yeonhwa’s Gift ❤️(4K) 스파이더맨걸 연화의 선물 [902250943].mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:❤️(4K) Spiderman Girl Yeonhwa’s Gift ❤️(4K) 스파이더맨걸 연화의 선물 [902250943].fdash-fastly_skyfire_sep-video-b9c571da.mp4" -i "file:❤️(4K) Spiderman Girl Yeonhwa’s Gift ❤️(4K) 스파이더맨걸 연화의 선물 [902250943].fdash-fastly_skyfire_sep-audio-718104e7.m4a" -c copy -map "0:v:0" -map "1:a:0" -movflags "+faststart" "file:❤️(4K) Spiderman Girl Yeonhwa’s Gift ❤️(4K) 스파이더맨걸 연화의 선물 [902250943].temp.mkv"
Deleting original file ❤️(4K) Spiderman Girl Yeonhwa’s Gift ❤️(4K) 스파이더맨걸 연화의 선물 [902250943].fdash-fastly_skyfire_sep-audio-718104e7.m4a (pass -k to keep)
Deleting original file ❤️(4K) Spiderman Girl Yeonhwa’s Gift ❤️(4K) 스파이더맨걸 연화의 선물 [902250943].fdash-fastly_skyfire_sep-video-b9c571da.mp4 (pass -k to keep)
```



**Please see below the "Complete Verbose Output" for the debug output of the latest version 2024.04.09 where download fails.**



### 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
**VERSION yt-dlp 2024.04.09**

C:\Users\user>yt-dlp -vU -f bestvideo+bestaudio --merge-output-format mkv "https://www.patreon.com/posts/4k-spiderman-4k-96414599"
[debug] Command-line config: ['-vU', '-f', 'bestvideo+bestaudio', '--merge-output-format', 'mkv', 'https://www.patreon.com/posts/4k-spiderman-4k-96414599']
[debug] Encodings: locale cp65001, fs utf-8, pref cp65001, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.04.09 from yt-dlp/yt-dlp [ff0779267] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 7.0-full_build-www.gyan.dev (setts), ffprobe 7.0-full_build-www.gyan.dev, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.02.02, curl_cffi-0.5.10, mutagen-1.47.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.2.1, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
[debug] Loaded 1810 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2024.04.09 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2024.04.09 from yt-dlp/yt-dlp)
[Patreon] Extracting URL: https://www.patreon.com/posts/4k-spiderman-4k-96414599
[Patreon] 96414599: Downloading API JSON
[Patreon] 96414599: Checking Vimeo embed URL
[Patreon] 96414599: Checking embed URL
ERROR: [Patreon] 96414599: No supported media found in this post
  File "yt_dlp\extractor\common.py", line 734, in extract
  File "yt_dlp\extractor\patreon.py", line 305, in _real_extract
  File "yt_dlp\extractor\common.py", line 1251, in raise_no_formats
```



Discussion:

Resolving patch:
diff --git a/yt_dlp/extractor/patreon.py b/yt_dlp/extractor/patreon.py
--- a/yt_dlp/extractor/patreon.py
+++ b/yt_dlp/extractor/patreon.py
@@ -1,8 +1,8 @@
 import itertools
+import urllib.parse
 
 from .common import InfoExtractor
 from .vimeo import VimeoIE
-from ..compat import compat_urllib_parse_unquote
 from ..networking.exceptions import HTTPError
 from ..utils import (
     KNOWN_EXTENSIONS,
@@ -14,7 +14,6 @@
     parse_iso8601,
     str_or_none,
     traverse_obj,
-    try_get,
     url_or_none,
     urljoin,
 )
@@ -199,6 +198,27 @@ class PatreonIE(PatreonBaseIE):
             'channel_id': '2147162',
             'uploader_url': 'https://www.patreon.com/yaboyroshi',
         },
+    }, {
+        # NSFW vimeo embed URL
+        'url': 'https://www.patreon.com/posts/4k-spiderman-4k-96414599',
+        'info_dict': {
+            'id': '902250943',
+            'ext': 'mp4',
+            'title': '❤️(4K) Spiderman Girl Yeonhwa’s Gift ❤️(4K) 스파이더맨걸 연화의 선물',
+            'description': '❤️(4K) Spiderman Girl Yeonhwa’s Gift \n❤️(4K) 스파이더맨걸 연화의 선물',
+            'uploader': 'Npickyeonhwa',
+            'uploader_id': '90574422',
+            'uploader_url': 'https://www.patreon.com/Yeonhwa726',
+            'channel_id': '10237902',
+            'channel_url': 'https://www.patreon.com/Yeonhwa726',
+            'duration': 70,
+            'timestamp': 1705150153,
+            'upload_date': '20240113',
+            'comment_count': int,
+            'like_count': int,
+            'thumbnail': r're:^https?://.+',
+        },
+        'params': {'skip_download': 'm3u8'},
     }]
 
     def _real_extract(self, url):
@@ -268,16 +288,19 @@ def _real_extract(self, url):
                 })
 
         # handle Vimeo embeds
-        if try_get(attributes, lambda x: x['embed']['provider']) == 'Vimeo':
-            embed_html = try_get(attributes, lambda x: x['embed']['html'])
-            v_url = url_or_none(compat_urllib_parse_unquote(
-                self._search_regex(r'(https(?:%3A%2F%2F|://)player\.vimeo\.com.+app_id(?:=|%3D)+\d+)', embed_html, 'vimeo url', fatal=False)))
-            if v_url:
-                v_url = VimeoIE._smuggle_referrer(v_url, 'https://patreon.com')
-                if self._request_webpage(v_url, video_id, 'Checking Vimeo embed URL', fatal=False, errnote=False):
-                    return self.url_result(v_url, VimeoIE, url_transparent=True, **info)
-
-        embed_url = try_get(attributes, lambda x: x['embed']['url'])
+        if traverse_obj(attributes, ('embed', 'provider')) == 'Vimeo':
+            v_url = urllib.parse.unquote(self._html_search_regex(
+                r'(https(?:%3A%2F%2F|://)player\.vimeo\.com.+app_id(?:=|%3D)+\d+)',
+                traverse_obj(attributes, ('embed', 'html', {str})), 'vimeo url', fatal=False) or '')
+            if url_or_none(v_url) and self._request_webpage(
+                    v_url, video_id, 'Checking Vimeo embed URL',
+                    headers={'Referer': 'https://patreon.com/'},
+                    fatal=False, errnote=False):
+                return self.url_result(
+                    VimeoIE._smuggle_referrer(v_url, 'https://patreon.com/'),
+                    VimeoIE, url_transparent=True, **info)
+
+        embed_url = traverse_obj(attributes, ('embed', 'url', {url_or_none}))
         if embed_url and self._request_webpage(embed_url, video_id, 'Checking embed URL', fatal=False, errnote=False):
             return self.url_result(embed_url, **info)
 


Test patch: