Repository: yt-dlp/yt-dlp

Issue:
Piped.video supported but not cf.piped.video (piped cloudflare mirror)
### 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 a new site support request
- [X] I've verified that I'm running yt-dlp version **2023.10.13** ([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 none of provided URLs [violate any copyrights](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#is-the-website-primarily-used-for-piracy) or contain any [DRM](https://en.wikipedia.org/wiki/Digital_rights_management) to the best of my knowledge
- [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 am willing to share it if required

### Region

United States

### Example URLs

https://cf.piped.video/watch?v=6btzCPi26to
https://cf.piped.video/watch?v=zkQWD8c9e3s

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

I understand that by deleting the "cf." part of the url, the video will be downloadable with yt-dlp. This isn't a very high priority issue. I would love it if `cf.piped.video` were treated the same as `piped.video` when downloading a video. Downloading via `piped.video` works, but not `cf.piped.video`. In the interest of convenience, I don't want to have to delete the `cf.` portion while using piped's cloudflare mirror.

### 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
yt-dlp -vU "https://cf.piped.video/watch?v=6btzCPi26to"
[debug] Command-line config: ['-vU', 'https://cf.piped.video/watch?v=6btzCPi26to']
[debug] Encodings: locale utf-8, fs utf-8, pref utf-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.10.13 [b634ba742] (darwin_exe)
[debug] Python 3.11.5 (CPython arm64 64bit) - macOS-14.1-arm64-arm-64bit (OpenSSL 3.0.10 1 Aug 2023)
[debug] exe versions: ffmpeg 6.0 (setts), ffprobe 6.0, phantomjs 2.1.1, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.19.0, brotli-1.1.0, certifi-2023.07.22, mutagen-1.47.0, sqlite3-3.42.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1890 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.10.13, Current version: stable@2023.10.13
Current Build Hash: 5d538669b078c77e6fc8ff914686079dfca4226113192cfc16f8643161a49046
yt-dlp is up to date (stable@2023.10.13)
[generic] Extracting URL: https://cf.piped.video/watch?v=6btzCPi26to
[generic] watch?v=6btzCPi26to: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] watch?v=6btzCPi26to: Extracting information
[debug] Looking for embeds
ERROR: Unsupported URL: https://cf.piped.video/watch?v=6btzCPi26to
Traceback (most recent call last):
  File "yt_dlp/YoutubeDL.py", line 1567, in wrapper
  File "yt_dlp/YoutubeDL.py", line 1702, in __extract_info
  File "yt_dlp/extractor/common.py", line 715, in extract
  File "yt_dlp/extractor/generic.py", line 2575, in _real_extract
yt_dlp.utils.UnsupportedError: Unsupported URL: https://cf.piped.video/watch?v=6btzCPi26to
```
```



Discussion:
To be honest I didn't really know which issue template to go with, and I picked this one since it seemed to be the closest one.
Maybe you're already aware of this: yt-dlp supports piped URLs by redirecting them to youtube.

So we could add support by doing this:
```diff
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index ac28ed7d2..5aac8095e 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -428,7 +428,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
         r'(?:www\.)?piped\.adminforge\.de',
         r'(?:www\.)?watch\.whatevertinfoil\.de',
         r'(?:www\.)?piped\.qdi\.fi',
-        r'(?:www\.)?piped\.video',
+        r'(?:(?:www|cf)\.)?piped\.video',
         r'(?:www\.)?piped\.aeong\.one',
         r'(?:www\.)?piped\.moomoo\.me',
         r'(?:www\.)?piped\.chauvet\.pro',
```
> Maybe you're already aware of this: yt-dlp supports piped URLs by redirecting them to youtube.
> 
> So we could add support by doing this:
> 
> ```diff
> diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
> index ac28ed7d2..5aac8095e 100644
> --- a/yt_dlp/extractor/youtube.py
> +++ b/yt_dlp/extractor/youtube.py
> @@ -428,7 +428,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
>          r'(?:www\.)?piped\.adminforge\.de',
>          r'(?:www\.)?watch\.whatevertinfoil\.de',
>          r'(?:www\.)?piped\.qdi\.fi',
> -        r'(?:www\.)?piped\.video',
> +        r'(?:(?:www|cf)\.)?piped\.video',
>          r'(?:www\.)?piped\.aeong\.one',
>          r'(?:www\.)?piped\.moomoo\.me',
>          r'(?:www\.)?piped\.chauvet\.pro',
> ```

Before making this issue I searched for "piped.video" in the repo (with the intent of making a PR) and didn't find any references. I forgot to check regex haha

Resolving patch:
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -428,7 +428,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
         r'(?:www\.)?piped\.adminforge\.de',
         r'(?:www\.)?watch\.whatevertinfoil\.de',
         r'(?:www\.)?piped\.qdi\.fi',
-        r'(?:www\.)?piped\.video',
+        r'(?:(?:www|cf)\.)?piped\.video',
         r'(?:www\.)?piped\.aeong\.one',
         r'(?:www\.)?piped\.moomoo\.me',
         r'(?:www\.)?piped\.chauvet\.pro',


Test patch: