Repository: yt-dlp/yt-dlp

Issue:
[PornHub] Unable to extract encoded url
### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.06.29** ([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/ytdl-org/youtube-dl#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)
- [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

_No response_

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

[PornHub] Unable to download JSON metadata: HTTP Error 403: Forbidden
How to fix it?

### 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
F:\downloader\pornhub>ytdl-patched https://www.pornhub.com/model/katekuray -F --verbose
[debug] Command-line config: ['https://www.pornhub.com/model/katekuray', '-F', '--verbose']
[debug] User config "D:\OS Files\Users\X\AppData\Roaming\yt-dlp\config": ['--continue', '--http-chunk-size', '1M', '--buffer-size', '16K', '--sub-lang', 'english', '--embed-metadata', '--abort-on-unavailable-fragment', '-o', '%(uploader)s\\%(title)s [%(id)s].%(ext)s', '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]', '--ffmpeg-location', 'D:\\OS Files\\Program Files\\ffmpeg\\bin', '--no-lock']
[debug] Encodings: locale cp65001, fs utf-8, pref cp65001, out utf-8, error utf-8, screen utf-8
[debug] ytdl-patched version 2022.06.29
[debug] ** The command you are running is not yt-dlp.
[debug] ** Please make bug reports at https://github.com/ytdl-patched/ytdl-patched/issues/new/choose instead.
[debug] Lazy loading extractors is disabled
[debug] Python 3.10.4 (CPython 64bit) - Windows-10-10.0.19043-SP0
[debug] Checking exe version: "D:\OS Files\Program Files\ffmpeg\bin\ffmpeg" -bsfs
[debug] Checking exe version: "D:\OS Files\Program Files\ffmpeg\bin\ffprobe" -bsfs
[debug] exe versions: ffmpeg 5.0.1-essentials_build-www.gyan.dev (setts), ffprobe 5.0.1-essentials_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.14.1, WebSocketsWrapper-None, brotli-1.0.9, certifi-2021.10.08, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.2
[debug] Proxy map: {}
[debug] [PornHubUser] Extracting URL: https://www.pornhub.com/model/katekuray
[debug] [PornHubPagedVideoList] Extracting URL: https://www.pornhub.com/model/katekuray/videos
[download] Downloading playlist: model/katekuray/videos
[PornHubPagedVideoList] model/katekuray/videos: Downloading page 1
[PornHubPagedVideoList] [debug] Fetching webpage from https://www.pornhub.com/model/katekuray/videos
[PornHubPagedVideoList] model/katekuray/videos: Downloading page 2
[PornHubPagedVideoList] [debug] Fetching webpage from https://www.pornhub.com/model/katekuray/videos
[PornHubPagedVideoList] Playlist model/katekuray/videos: Downloading 107 videos of 107
[download] Downloading video 11 of 107
[PornHub] ph5f71889303342: Downloading pc webpage
[PornHub] ph5f71889303342: Downloading m3u8 information
[PornHub] ph5f71889303342: Downloading m3u8 information
[PornHub] ph5f71889303342: Downloading m3u8 information
[PornHub] ph5f71889303342: Downloading m3u8 information
[PornHub] ph5f71889303342: Downloading JSON metadata
WARNING: [PornHub] Unable to download JSON metadata: HTTP Error 403: Forbidden
[info] Available formats for ph5f71889303342:
ID         EXT RESOLUTION FPS │  FILESIZE   TBR PROTO │ VCODEC        VBR ACODEC    ABR
───────────────────────────────────────────────────────────────────────────────────────
hls-509-0  mp4 426x240     59 │ ~ 4.48MiB  509k m3u8  │ avc1.64001e  509k mp4a.40.2  0k
hls-509-1  mp4 426x240     59 │ ~ 4.48MiB  509k m3u8  │ avc1.64001e  509k mp4a.40.2  0k
hls-902-0  mp4 854x480     59 │ ~ 7.93MiB  902k m3u8  │ avc1.64001f  902k mp4a.40.2  0k
hls-902-1  mp4 854x480     59 │ ~ 7.93MiB  902k m3u8  │ avc1.64001f  902k mp4a.40.2  0k
hls-1614-0 mp4 1280x720    59 │ ~14.19MiB 1614k m3u8  │ avc1.640020 1614k mp4a.40.2  0k
hls-1614-1 mp4 1280x720    59 │ ~14.19MiB 1614k m3u8  │ avc1.640020 1614k mp4a.40.2  0k
hls-2769   mp4 1920x1080   59 │ ~24.34MiB 2769k m3u8  │ avc1.64002a 2769k mp4a.40.2  0k
```



Discussion:
```bash
[debug] ** The command you are running is not yt-dlp.
[debug] ** Please make bug reports at https://github.com/ytdl-patched/ytdl-patched/issues/new/choose instead.
```

```bash
yt-dlp -vU https://www.pornhub.com/model/katekuray
[debug] Command-line config: ['-vU', 'https://www.pornhub.com/model/katekuray']
[debug] User config "/home/nico/.config/yt-dlp/config": ['-o', '/dev/shm/test-dlp/%(title)s.%(ext)s', '-f', 'bestvideo[height<=1080][ext=mp4][vcodec!*=av01]+bestaudio[ext=m4a]/best[ext=mp4]/best', '--no-mtime', '--add-metadata', '--convert-thumbnails', 'jpg', '--embed-thumbnail', '--ppa', 'ThumbnailsConvertor:-q:v 1', '--ppa', 'ffmpeg:-metadata synopsis=""', '--force-ipv4', '--sponsorblock-remove', 'all', '--console-title', '--downloader', 'aria2c', '--downloader-args', 'aria2c:--http-accept-gzip=true -x 10 -s 10 -j 10 -k 1M --log-level=info --file-allocation=none']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.07.10 [258d88f30] (zip)
[debug] Python 3.8.10 (CPython 64bit) - Linux-5.4.0-121-generic-x86_64-with-glibc2.29 (glibc 2.31)
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg N-107246-g59a58d1a85-Nico-20220626 (fdk,setts), ffprobe N-107246-g59a58d1a85-Nico-20220626, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.12.0, brotli-1.0.9, certifi-2019.11.28, mutagen-1.45.1, secretstorage-2.3.1, sqlite3-2.6.0, websockets-10.1
[debug] Proxy map: {}
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.06.29, Current version: 2022.07.10
yt-dlp is up to date (2022.07.10)
[debug] [PornHubUser] Extracting URL: https://www.pornhub.com/model/katekuray
[debug] [PornHubPagedVideoList] Extracting URL: https://www.pornhub.com/model/katekuray/videos
[download] Downloading playlist: model/katekuray/videos
[PornHubPagedVideoList] model/katekuray/videos: Downloading page 1
[PornHubPagedVideoList] model/katekuray/videos: Downloading page 2
[PornHubPagedVideoList] Playlist model/katekuray/videos: Downloading 107 videos of 107
[download] Downloading video 1 of 107
[debug] [PornHub] Extracting URL: http://www.pornhub.com/view_video.php?viewkey=ph5fd3531b21ace
[PornHub] ph5fd3531b21ace: Downloading pc webpage
[PornHub] ph5fd3531b21ace: Downloading tv webpage
ERROR: [PornHub] ph5fd3531b21ace: Unable to extract encoded url; 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 "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 640, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/pornhub.py", line 408, in _real_extract
    js_vars = extract_js_vars(
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/pornhub.py", line 345, in extract_js_vars
    assignments = self._search_regex(
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 1192, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)

[download] Downloading video 2 of 107
[debug] [PornHub] Extracting URL: http://www.pornhub.com/view_video.php?viewkey=ph5fcf2135b4d02
[PornHub] ph5fcf2135b4d02: Downloading pc webpage
[PornHub] ph5fcf2135b4d02: Downloading tv webpage
ERROR: [PornHub] ph5fcf2135b4d02: Unable to extract encoded url; 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 "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 640, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/pornhub.py", line 408, in _real_extract
    js_vars = extract_js_vars(
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/pornhub.py", line 345, in extract_js_vars
    assignments = self._search_regex(
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 1192, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)

[download] Downloading video 3 of 107
[debug] [PornHub] Extracting URL: http://www.pornhub.com/view_video.php?viewkey=ph5fcdd1ca2d34c
[PornHub] ph5fcdd1ca2d34c: Downloading pc webpage
[PornHub] ph5fcdd1ca2d34c: Downloading tv webpage
^C
ERROR: Interrupted by user

```
Looks like afterdelight has mixed up 2 logs, one with --verbose and one without it
Why I've figured it out? Guess why
There is no point in wasting time when the user is intentionally sabotaging the report. And this is not the first time @afterdelight is posting wrong logs

However I am leaving this issue open because @nicolaasjan has provided proper logs
Each playlist item redirects to a URL like https://www.modelhub.com/video/ph5fd3531b21ace whose media can at a minimum be extracted as HTML5 using the generic extractor.
(Is this issue still monitored or would it be better to start a new thread?)


The `Unable to extract encoded url` problem reappeard a few days ago. 

Tested with `stable@2023.03.04` and `nightly@2023.03.23.162840 [5cc0a8fd2]` - both not working as intended.

Here's my verbose output log:

```
[debug] Command-line config: ['-vU', 'https://www.pornhub.com/view_video.php?viewkey=ph61d5f93ba72b4']
[debug] User config "/Users/xxxxx/.config/yt-dlp/config": ['--force-ipv4', '--format', 'bestvideo[vcodec^=avc1]+bestaudio[ext=m4a]/bestvideo+bestaudio/best', '--embed-chapters', '--embed-metadata', '--embed-subs', '--parse-metadata', ]
[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.03.04 [392389b7d] (pip)
[debug] Python 3.11.2 (CPython arm64 64bit) - macOS-13.2.1-arm64-arm-64bit (OpenSSL 1.1.1t  7 Feb 2023)
[debug] exe versions: ffmpeg N-110061-gc0d9327a63 (setts), ffprobe N-110061-gc0d9327a63, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
yt-dlp is up to date (stable@2023.03.04)
[PornHub] Extracting URL: https://www.pornhub.com/view_video.php?viewkey=ph61d5f93ba72b4
[PornHub] ph61d5f93ba72b4: Downloading pc webpage
[PornHub] ph61d5f93ba72b4: Downloading tv webpage
ERROR: [PornHub] ph61d5f93ba72b4: Unable to extract encoded url; 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 "/opt/homebrew/Cellar/yt-dlp/2023.3.4/libexec/lib/python3.11/site-packages/yt_dlp/extractor/common.py", line 694, in extract
    ie_result = self._real_extract(url)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yt-dlp/2023.3.4/libexec/lib/python3.11/site-packages/yt_dlp/extractor/pornhub.py", line 403, in _real_extract
    js_vars = extract_js_vars(
              ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yt-dlp/2023.3.4/libexec/lib/python3.11/site-packages/yt_dlp/extractor/pornhub.py", line 340, in extract_js_vars
    assignments = self._search_regex(
                  ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yt-dlp/2023.3.4/libexec/lib/python3.11/site-packages/yt_dlp/extractor/common.py", line 1242, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
```
> or would it be better to start a new thread?)

No, don't open duplicates for what is clearly the same issue!
I have the same issue
> yt-dlp -U
> Available version: stable@2023.03.04, Current version: stable@2023.03.04
> yt-dlp is up to date (stable@2023.03.04)

```
yt-dlp -vU https://www.pornhub.com/view_video.php?viewkey=ph6316ae3c33fde
[debug] Command-line config: ['-vU', 'https://www.pornhub.com/view_video.php?viewkey=ph6316ae3c33fde']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (pip)
[debug] Python 3.11.1 (CPython AMD64 64bit) - Windows-10-10.0.19044-SP0 (OpenSSL 1.1.1q  5 Jul 2022)
[debug] exe versions: ffmpeg 5.1.2-full_build-www.gyan.dev (setts), ffprobe 5.1.2-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 1786 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
yt-dlp is up to date (stable@2023.03.04)
[PornHub] Extracting URL: https://www.pornhub.com/view_video.php?viewkey=ph6316ae3c33fde
[PornHub] ph6316ae3c33fde: Downloading pc webpage
[PornHub] ph6316ae3c33fde: Downloading tv webpage
ERROR: [PornHub] ph6316ae3c33fde: Unable to extract encoded url; 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\joshu\AppData\Roaming\Python\Python311\site-packages\yt_dlp\extractor\common.py", line 694, in extract
    ie_result = self._real_extract(url)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joshu\AppData\Roaming\Python\Python311\site-packages\yt_dlp\extractor\pornhub.py", line 403, in _real_extract
    js_vars = extract_js_vars(
              ^^^^^^^^^^^^^^^^
  File "C:\Users\joshu\AppData\Roaming\Python\Python311\site-packages\yt_dlp\extractor\pornhub.py", line 340, in extract_js_vars
    assignments = self._search_regex(
                  ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joshu\AppData\Roaming\Python\Python311\site-packages\yt_dlp\extractor\common.py", line 1242, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)`
```
For several days, I have the same problem using my personal connection (French IP address) while the problem disappears using a VPN with a Swiss IP address, for example. Watching the videos directly on the site works well in all cases.
Same problem here:
 /usr/local/bin/yt-dlp -vU https://www.pornhub.com/view_video.php?viewkey=6411d10dc49b4
[debug] Command-line config: ['-vU', 'https://www.pornhub.com/view_video.php?viewkey=6411d10dc49b4']
[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.03.04 [392389b7d] (zip)
[debug] Python 3.10.0 (CPython x86_64 64bit) - Linux-5.10.0-21-amd64-x86_64-with-glibc2.31 (OpenSSL 1.1.1n  15 Mar 2022, glibc 2.31)
[debug] exe versions: ffmpeg N-62475-g130d19bf20-static (setts), ffprobe N-62475-g130d19bf20-static
[debug] Optional libraries: no_Cryptodome-None, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
Current Build Hash: 91cad9f121c1f6f0a81b747415c46ecba0ff331ed38cc6433040b4ac7b6e15ca
yt-dlp is up to date (stable@2023.03.04)
[PornHub] Extracting URL: https://www.pornhub.com/view_video.php?viewkey=6411d10dc49b4
[PornHub] 6411d10dc49b4: Downloading pc webpage
[PornHub] 6411d10dc49b4: Downloading tv webpage
ERROR: [PornHub] 6411d10dc49b4: Unable to extract encoded url; 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 "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 694, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/pornhub.py", line 403, in _real_extract
    js_vars = extract_js_vars(
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/pornhub.py", line 340, in extract_js_vars
    assignments = self._search_regex(
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 1242, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)

I think I have the same issue
Cannot download anything from PH and it says "Unable to extract encoded url":
(I did update to latest version with -U; also sorry If what i post isn't what is needed/doesn't help, it just said I can report it here and I figured it has a --verbose mode so I used it)

```
yt-dlp --verbose https://www.pornhub.com/ANY VIDEO HERE                          
[debug] Command-line config: ['--verbose', 'https://www.pornhub.com/ANY VIDEO HERE']            
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8                           
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (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 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev (setts), ffprobe 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev                                                                                               
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4                                                                                                                   
[debug] Proxy map: {}                                                                                                   
[debug] Loaded 1786 extractors                                                                                          
[PornHub] Extracting URL: https://www.pornhub.com/ANY VIDEO HERE                                
[PornHub] ph5fe22d033ba82: Downloading pc webpage                                                                       
[PornHub] ph5fe22d033ba82: Downloading tv webpage                                                                       
ERROR: [PornHub] ph5fe22d033ba82: Unable to extract encoded url; 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 694, in extract                                                                 
File "yt_dlp\extractor\pornhub.py", line 403, in _real_extract                                                          
File "yt_dlp\extractor\pornhub.py", line 340, in extract_js_vars                                                        
File "yt_dlp\extractor\common.py", line 1242, in _search_regex       
```                                                                                                                                                                                     
I set up a proxy to test if this was a IP/Geo thing but it is not (tried about 10 different countries/IPs):
https://pornhub.com/view_video.php?viewkey=6411d10dc49b4 is playing in the browser for all IPs

```
/usr/local/bin/yt-dlp -vU --proxy "https://xxxx:xxxx@xxxxsuperproxy.io:22225" https://pornhub.com/view_video.php?viewkey=6411d10dc49b4
[debug] Command-line config: ['-vU', '--proxy', 'https://xxx:xxx@xxxsuperproxy.io:22225', 'https://pornhub.com/view_video.php?viewkey=6411d10dc49b4']
[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.03.04 [392389b7d] (zip)
[debug] Python 3.10.0 (CPython x86_64 64bit) - Linux-5.10.0-21-amd64-x86_64-with-glibc2.31 (OpenSSL 1.1.1n  15 Mar 2022, glibc 2.31)
[debug] exe versions: ffmpeg N-62475-g130d19bf20-static (setts), ffprobe N-62475-g130d19bf20-static
[debug] Optional libraries: no_Cryptodome-None, sqlite3-2.6.0
[debug] Proxy map: {'http': 'https://xxxx:xxxx@xxxsuperproxy.io:22225', 'https': 'https://xxx:xxx@xxxsuperproxy.io:22225'}
[debug] Loaded 1786 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
Current Build Hash: 91cad9f121c1f6f0a81b747415c46ecba0ff331ed38cc6433040b4ac7b6e15ca
yt-dlp is up to date (stable@2023.03.04)
[PornHub] Extracting URL: https://pornhub.com/view_video.php?viewkey=6411d10dc49b4
[PornHub] 6411d10dc49b4: Downloading pc webpage
ERROR: [PornHub] 6411d10dc49b4: Unable to download webpage: <urlopen error Tunnel connection failed: 403 Forbidden> (caused by URLError(OSError('Tunnel connection failed: 403 Forbidden')))
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 694, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/pornhub.py", line 279, in _real_extract
    webpage = dl_webpage('pc')
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/pornhub.py", line 275, in dl_webpage
    return self._download_webpage(
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 1097, in _download_webpage
    return self.__download_webpage(url_or_request, video_id, note, errnote, None, fatal, *args, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 1048, in download_content
    res = getattr(self, download_handle.__name__)(url_or_request, video_id, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/pornhub.py", line 37, in _download_webpage_handle
    ret = dl(*args, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/pornhub.py", line 35, in dl
    return super(PornHubBaseIE, self)._download_webpage_handle(*args, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 882, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 839, in _request_webpage
    raise ExtractorError(errmsg, cause=err)

  File "/usr/local/lib/python3.10/urllib/request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/local/lib/python3.10/http/client.py", line 1276, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1322, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1271, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1031, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.10/http/client.py", line 969, in send
    self.connect()
  File "/usr/local/lib/python3.10/http/client.py", line 1441, in connect
    super().connect()
  File "/usr/local/lib/python3.10/http/client.py", line 945, in connect
    self._tunnel()
  File "/usr/local/lib/python3.10/http/client.py", line 923, in _tunnel
    raise OSError(f"Tunnel connection failed: {code} {message.strip()}")
OSError: Tunnel connection failed: 403 Forbidden

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 821, in _request_webpage
    return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query))
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3742, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/local/lib/python3.10/urllib/request.py", line 519, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.10/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/local/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/local/bin/yt-dlp/yt_dlp/utils.py", line 1555, in https_open
    return self.do_open(
  File "/usr/local/lib/python3.10/urllib/request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error Tunnel connection failed: 403 Forbidden>
```
Per https://github.com/ytdl-org/youtube-dl/pull/31916 it looks like this could be a cookie problem

Does anyone who is affected by this issue (I'm not) want to test this patch? Feel free to PR it if it works
```diff
diff --git a/yt_dlp/extractor/pornhub.py b/yt_dlp/extractor/pornhub.py
index 5d8d7c100..904094b7e 100644
--- a/yt_dlp/extractor/pornhub.py
+++ b/yt_dlp/extractor/pornhub.py
@@ -269,6 +269,8 @@ def _real_extract(self, url):
         self._login(host)
 
         self._set_cookie(host, 'age_verified', '1')
+        self._set_cookie(host, 'accessAgeDisclaimerPH', '1')
+        self._set_cookie('thumbzilla.com', 'accessAgeDisclaimerTZ', '1')
 
         def dl_webpage(platform):
             self._set_cookie(host, 'platform', platform)
```
I just tried your patch (actually mine edited ^^) and it works from France and Poland. :) 
You may need to wait for someone to test it from others countries.
Just tested from germany and can confirm the fix works.

Resolving patch:
diff --git a/yt_dlp/extractor/pornhub.py b/yt_dlp/extractor/pornhub.py
--- a/yt_dlp/extractor/pornhub.py
+++ b/yt_dlp/extractor/pornhub.py
@@ -58,6 +58,11 @@ def dl(*args, **kwargs):
     def _real_initialize(self):
         self._logged_in = False
 
+    def _set_age_cookies(self, host):
+        self._set_cookie(host, 'age_verified', '1')
+        self._set_cookie(host, 'accessAgeDisclaimerPH', '1')
+        self._set_cookie(host, 'accessPH', '1')
+
     def _login(self, host):
         if self._logged_in:
             return
@@ -267,8 +272,7 @@ def _real_extract(self, url):
         video_id = mobj.group('id')
 
         self._login(host)
-
-        self._set_cookie(host, 'age_verified', '1')
+        self._set_age_cookies(host)
 
         def dl_webpage(platform):
             self._set_cookie(host, 'platform', platform)
@@ -569,6 +573,7 @@ def _real_extract(self, url):
         mobj = self._match_valid_url(url)
         user_id = mobj.group('id')
         videos_url = '%s/videos' % mobj.group('url')
+        self._set_age_cookies(mobj.group('host'))
         page = self._extract_page(url)
         if page:
             videos_url = update_url_query(videos_url, {'page': page})
@@ -633,6 +638,7 @@ def _real_extract(self, url):
         item_id = mobj.group('id')
 
         self._login(host)
+        self._set_age_cookies(host)
 
         return self.playlist_result(self._entries(url, host, item_id), item_id)
 
@@ -812,5 +818,6 @@ def _real_extract(self, url):
         item_id = mobj.group('id')
 
         self._login(host)
+        self._set_age_cookies(host)
 
         return self.playlist_result(self._entries(mobj.group('url'), host, item_id), item_id)


Test patch: