Repository: yt-dlp/yt-dlp

Issue:
[YouPorn] Unable to download JSON metadata: HTTP Error 403: Forbidden 
### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.02.04**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
- [X] I've checked that all provided URLs are alive and playable in a browser
- [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_

### Description

Error happens using whatever YP link and download stops.
With `Youtube-dl` a different error is reported: `WARNING: unable to extract upload date; please report this issue...` but the download starts successfully.

### Verbose log

```shell
C:\temp\YT-DLP>yt-dlp -vU "https://www.youporn.com/watch/16516654/sego-lamico-di-mio-marito-al-ristorante-e-non-si-accorge-di-niente/"
[debug] Command-line config: ['-vU', 'https://www.youporn.com/watch/16516654/sego-lamico-di-mio-marito-al-ristorante-e-non-si-accorge-di-niente/']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, err utf-8, pref cp1252
[debug] yt-dlp version 2022.02.04 [c1653e9] (win_exe)
[debug] Python version 3.8.10 (CPython 64bit) - Windows-10-10.0.19044-SP0
[debug] exe versions: ffmpeg 4.2.3, ffprobe 4.2.3
[debug] Optional libraries: Cryptodome, mutagen, sqlite, websockets
[debug] Proxy map: {}
Latest version: 2022.02.04, Current version: 2022.02.04
yt-dlp is up to date (2022.02.04)
[debug] [YouPorn] Extracting URL: https://www.youporn.com/watch/16516654/sego-lamico-di-mio-marito-al-ristorante-e-non-si-accorge-di-niente/
[YouPorn] sego-lamico-di-mio-marito-al-ristorante-e-non-si-accorge-di-niente: Downloading JSON metadata
ERROR: [YouPorn] 16516654: Unable to download JSON metadata: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp , filling out the "Broken site" issue template properly. Confirm you are on the latest version using -U (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp , filling out the "Broken site" issue template properly. Confirm you are on the latest version using -U
  File "yt_dlp\extractor\common.py", line 730, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 3558, in urlopen
  File "urllib\request.py", line 531, in open
  File "urllib\request.py", line 640, in http_response
  File "urllib\request.py", line 569, in error
  File "urllib\request.py", line 502, in _call_chain
  File "urllib\request.py", line 649, in http_error_default


C:\temp\YT-DLP>
```



Discussion:
The extractor code is identical modulo `_match_valid_url()`. The error here is different from the yt-dl warning, which hasn't yet been reached. However yt-dl gets the same error with Py3.9, though not 3.5. So there is some network issue that is being revealed for Py >= 3.8 at least.
This patch deals with the warning:
```diff
--- old/youtube-dl/youtube_dl/extractor/youporn.py
+++ new/youtube-dl/youtube_dl/extractor/youporn.py
@@ -137,9 +137,10 @@
             r'(?s)<div[^>]+class=["\']submitByLink["\'][^>]*>(.+?)</div>',
             webpage, 'uploader', fatal=False)
         upload_date = unified_strdate(self._html_search_regex(
-            [r'UPLOADED:\s*<span>([^<]+)',
+            (r'UPLOADED:\s*<span>([^<]+)',
              r'Date\s+[Aa]dded:\s*<span>([^<]+)',
-             r'(?s)<div[^>]+class=["\']videoInfo(?:Date|Time)["\'][^>]*>(.+?)</div>'],
+             r'(?s)<div[^>]+class=["\']videoInfo(?:Date|Time)["\'][^>]*>(.+?)</div>',
+             r'(?s)<label\b[^>]*>Uploaded[^<]*</label>\s*<span\b[^>]*>(.+?)</span>'),
             webpage, 'upload date', fatal=False))
 
         age_limit = self._rta_search(webpage)
```
`context.post_handshake_auth = True` in `make_HTTPS_handler` fixes the HTTP error. Unfortunately Youporn also has some client-side calculated cookie which `JSInterpreter` cannot easily calculate, too.


Resolving patch:
diff --git a/yt_dlp/extractor/youporn.py b/yt_dlp/extractor/youporn.py
--- a/yt_dlp/extractor/youporn.py
+++ b/yt_dlp/extractor/youporn.py
@@ -4,6 +4,7 @@
 from ..utils import (
     extract_attributes,
     int_or_none,
+    merge_dicts,
     str_to_int,
     unified_strdate,
     url_or_none,
@@ -64,6 +65,24 @@ class YouPornIE(InfoExtractor):
     }, {
         'url': 'https://www.youporn.com/watch/13922959/femdom-principal/',
         'only_matching': True,
+    }, {
+        'url': 'https://www.youporn.com/watch/16290308/tinderspecial-trailer1/',
+        'info_dict': {
+            'id': '16290308',
+            'age_limit': 18,
+            'categories': [],
+            'description': 'md5:00ea70f642f431c379763c17c2f396bc',
+            'display_id': 'tinderspecial-trailer1',
+            'duration': 298.0,
+            'ext': 'mp4',
+            'upload_date': '20201123',
+            'uploader': 'Ersties',
+            'tags': [],
+            'thumbnail': 'https://fi1.ypncdn.com/202011/23/16290308/original/8/tinderspecial-trailer1-8(m=eaAaaEPbaaaa).jpg',
+            'timestamp': 1606089600,
+            'title': 'Tinder In Real Life',
+            'view_count': int,
+        }
     }]
 
     def _real_extract(self, url):
@@ -159,7 +178,8 @@ def extract_tag_box(regex, title):
             r'(?s)Tags:.*?</div>\s*<div[^>]+class=["\']tagBoxContent["\'][^>]*>(.+?)</div>',
             'tags')
 
-        return {
+        data = self._search_json_ld(webpage, video_id, expected_type='VideoObject', fatal=False)
+        return merge_dicts(data, {
             'id': video_id,
             'display_id': display_id,
             'title': title,
@@ -174,4 +194,4 @@ def extract_tag_box(regex, title):
             'tags': tags,
             'age_limit': age_limit,
             'formats': formats,
-        }
+        })


Test patch: