We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[TVer] Some URLs are not recognized
### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.05.18** ([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

Japan

### Description

TVer Extractor may not recognize some URLs.
for ex.
https://tver.jp/episodes/epm8kjl7ze
https://tver.jp/episodes/epmf7b32xx

The URL in question can be opened in the browser without any problem, but yt-dlp will display "Not Found".
(This is at 17:00:00 on 6/8/2022)

### Verbose log

```shell
$ yt-dlp -vU https://tver.jp/episodes/epm8kjl7ze
[debug] Command-line config: ['-vU', 'https://tver.jp/episodes/epm8kjl7ze']
[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.05.18 [b14d52355]
[debug] Python version 3.8.10 (CPython 64bit) - Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
[debug] Checking exe version: ffprobe -bsfs
[debug] Checking exe version: avprobe -bsfs
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: avconv -bsfs
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2019.11.28, mutagen-1.45.1, secretstorage-2.3.1, sqlite3-2.6.0, websockets-10.3
[debug] Proxy map: {}
Latest version: 2022.05.18, Current version: 2022.05.18
yt-dlp is up to date (2022.05.18)
[TVer] Creating session
[debug] [TVer] Extracting URL: https://tver.jp/episodes/epm8kjl7ze
[TVer] epm8kjl7ze: Downloading JSON metadata
[TVer] epm8kjl7ze: Downloading JSON metadata
[debug] [brightcove:new] Extracting URL: http://players.brightcove.net/6191645753001/default_default/index.html?videoId=ref:2302810259_20220604#__youtubedl_smuggle=%7B%22geo_countries%22%3A+%5B%22JP%22%5D%7D
[debug] Using fake IP 133.19.253.45 (JP) as X-Forwarded-For
[debug] Loading brightcove.6191645753001_default from cache
[brightcove:new] ref:2302810259_20220604: Downloading JSON metadata
ERROR: [brightcove:new] Unable to download JSON metadata: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); 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 "/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 642, in extract
    ie_result = self._real_extract(url)
  File "/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/brightcove.py", line 648, in _real_extract
    json_data = self._download_json(api_url, video_id, headers=headers)
  File "/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 1030, in _download_json
    res = self._download_json_handle(
  File "/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 1009, in _download_json_handle
    res = self._download_webpage_handle(
  File "/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/adobepass.py", line 1364, in _download_webpage_handle
    return super(AdobePassIE, self)._download_webpage_handle(
  File "/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 801, 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 "/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 786, in _request_webpage
    raise ExtractorError(errmsg, cause=err)

  File "/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 768, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/home/hide/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3596, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `yt_dlp/extractor/tver.py`
Content:
```
1 from .common import InfoExtractor
2 from ..utils import (
3     ExtractorError,
4     join_nonempty,
5     smuggle_url,
6     str_or_none,
7     strip_or_none,
8     traverse_obj,
9 )
10 
11 
12 class TVerIE(InfoExtractor):
13     _VALID_URL = r'https?://(?:www\.)?tver\.jp/(?:(?P<type>lp|corner|series|episodes?|feature|tokyo2020/video)/)+(?P<id>[a-zA-Z0-9]+)'
14     _TESTS = [{
15         'skip': 'videos are only available for 7 days',
16         'url': 'https://tver.jp/episodes/ep83nf3w4p',
17         'info_dict': {
18             'title': '家事ヤロウ!!! 売り場席巻のチーズSP＆財前直見×森泉親子の脱東京暮らし密着！',
19             'description': 'md5:dc2c06b6acc23f1e7c730c513737719b',
20             'series': '家事ヤロウ!!!',
21             'episode': '売り場席巻のチーズSP＆財前直見×森泉親子の脱東京暮らし密着！',
22             'alt_title': '売り場席巻のチーズSP＆財前直見×森泉親子の脱東京暮らし密着！',
23             'channel': 'テレビ朝日',
24             'onair_label': '5月3日(火)放送分',
25             'ext_title': '家事ヤロウ!!! 売り場席巻のチーズSP＆財前直見×森泉親子の脱東京暮らし密着！ テレビ朝日 5月3日(火)放送分',
26         },
27         'add_ie': ['BrightcoveNew'],
28     }, {
29         'url': 'https://tver.jp/corner/f0103888',
30         'only_matching': True,
31     }, {
32         'url': 'https://tver.jp/lp/f0033031',
33         'only_matching': True,
34     }]
35     BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'
36     _PLATFORM_UID = None
37     _PLATFORM_TOKEN = None
38 
39     def _real_initialize(self):
40         create_response = self._download_json(
41             'https://platform-api.tver.jp/v2/api/platform_users/browser/create', None,
42             note='Creating session', data=b'device_type=pc', headers={
43                 'Origin': 'https://s.tver.jp',
44                 'Referer': 'https://s.tver.jp/',
45                 'Content-Type': 'application/x-www-form-urlencoded',
46             })
47         self._PLATFORM_UID = traverse_obj(create_response, ('result', 'platform_uid'))
48         self._PLATFORM_TOKEN = traverse_obj(create_response, ('result', 'platform_token'))
49 
50     def _real_extract(self, url):
51         video_id, video_type = self._match_valid_url(url).group('id', 'type')
52         if video_type not in {'series', 'episodes'}:
53             webpage = self._download_webpage(url, video_id, note='Resolving to new URL')
54             video_id = self._match_id(self._search_regex(
55                 (r'canonical"\s*href="(https?://tver\.jp/[^"]+)"', r'&link=(https?://tver\.jp/[^?&]+)[?&]'),
56                 webpage, 'url regex'))
57         video_info = self._download_json(
58             f'https://statics.tver.jp/content/episode/{video_id}.json', video_id,
59             query={'v': '5'}, headers={
60                 'Origin': 'https://tver.jp',
61                 'Referer': 'https://tver.jp/',
62             })
63         p_id = video_info['video']['accountID']
64         r_id = traverse_obj(video_info, ('video', ('videoRefID', 'videoID')), get_all=False)
65         if not r_id:
66             raise ExtractorError('Failed to extract reference ID for Brightcove')
67         if not r_id.isdigit():
68             r_id = f'ref:{r_id}'
69 
70         additional_info = self._download_json(
71             f'https://platform-api.tver.jp/service/api/v1/callEpisode/{video_id}?require_data=mylist,later[epefy106ur],good[epefy106ur],resume[epefy106ur]',
72             video_id, fatal=False,
73             query={
74                 'platform_uid': self._PLATFORM_UID,
75                 'platform_token': self._PLATFORM_TOKEN,
76             }, headers={
77                 'x-tver-platform-type': 'web'
78             })
79 
80         additional_content_info = traverse_obj(
81             additional_info, ('result', 'episode', 'content'), get_all=False) or {}
82         episode = strip_or_none(additional_content_info.get('title'))
83         series = str_or_none(additional_content_info.get('seriesTitle'))
84         title = (
85             join_nonempty(series, episode, delim=' ')
86             or str_or_none(video_info.get('title')))
87         provider = str_or_none(additional_content_info.get('productionProviderName'))
88         onair_label = str_or_none(additional_content_info.get('broadcastDateLabel'))
89 
90         return {
91             '_type': 'url_transparent',
92             'title': title,
93             'series': series,
94             'episode': episode,
95             # an another title which is considered "full title" for some viewers
96             'alt_title': join_nonempty(title, provider, onair_label, delim=' '),
97             'channel': provider,
98             'description': str_or_none(video_info.get('description')),
99             'url': smuggle_url(
100                 self.BRIGHTCOVE_URL_TEMPLATE % (p_id, r_id), {'geo_countries': ['JP']}),
101             'ie_key': 'BrightcoveNew',
102         }
103
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/yt_dlp/extractor/tver.py b/yt_dlp/extractor/tver.py
--- a/yt_dlp/extractor/tver.py
+++ b/yt_dlp/extractor/tver.py
@@ -54,38 +54,41 @@
             video_id = self._match_id(self._search_regex(
                 (r'canonical"\s*href="(https?://tver\.jp/[^"]+)"', r'&link=(https?://tver\.jp/[^?&]+)[?&]'),
                 webpage, 'url regex'))
+
+        episode_info = self._download_json(
+            f'https://platform-api.tver.jp/service/api/v1/callEpisode/{video_id}?require_data=mylist,later[epefy106ur],good[epefy106ur],resume[epefy106ur]',
+            video_id, fatal=False,
+            query={
+                'platform_uid': self._PLATFORM_UID,
+                'platform_token': self._PLATFORM_TOKEN,
+            }, headers={
+                'x-tver-platform-type': 'web'
+            })
+        episode_content = traverse_obj(
+            episode_info, ('result', 'episode', 'content')) or {}
+
         video_info = self._download_json(
             f'https://statics.tver.jp/content/episode/{video_id}.json', video_id,
-            query={'v': '5'}, headers={
+            query={
+                'v': str_or_none(episode_content.get('version')) or '5',
+            }, headers={
                 'Origin': 'https://tver.jp',
                 'Referer': 'https://tver.jp/',
             })
         p_id = video_info['video']['accountID']
-        r_id = traverse_obj(video_info, ('video', ('videoRefID', 'videoID')), get_all=False)
+        r_id = traverse_obj(video_info, ('video', ('videoRefID', 'videoID')))
         if not r_id:
             raise ExtractorError('Failed to extract reference ID for Brightcove')
         if not r_id.isdigit():
             r_id = f'ref:{r_id}'
 
-        additional_info = self._download_json(
-            f'https://platform-api.tver.jp/service/api/v1/callEpisode/{video_id}?require_data=mylist,later[epefy106ur],good[epefy106ur],resume[epefy106ur]',
-            video_id, fatal=False,
-            query={
-                'platform_uid': self._PLATFORM_UID,
-                'platform_token': self._PLATFORM_TOKEN,
-            }, headers={
-                'x-tver-platform-type': 'web'
-            })
-
-        additional_content_info = traverse_obj(
-            additional_info, ('result', 'episode', 'content'), get_all=False) or {}
-        episode = strip_or_none(additional_content_info.get('title'))
-        series = str_or_none(additional_content_info.get('seriesTitle'))
+        episode = strip_or_none(episode_content.get('title'))
+        series = str_or_none(episode_content.get('seriesTitle'))
         title = (
             join_nonempty(series, episode, delim=' ')
             or str_or_none(video_info.get('title')))
-        provider = str_or_none(additional_content_info.get('productionProviderName'))
-        onair_label = str_or_none(additional_content_info.get('broadcastDateLabel'))
+        provider = str_or_none(episode_content.get('productionProviderName'))
+        onair_label = str_or_none(episode_content.get('broadcastDateLabel'))
 
         return {
             '_type': 'url_transparent',

{"golden_diff": "diff --git a/yt_dlp/extractor/tver.py b/yt_dlp/extractor/tver.py\n--- a/yt_dlp/extractor/tver.py\n+++ b/yt_dlp/extractor/tver.py\n@@ -54,38 +54,41 @@\n             video_id = self._match_id(self._search_regex(\n                 (r'canonical\"\\s*href=\"(https?://tver\\.jp/[^\"]+)\"', r'&link=(https?://tver\\.jp/[^?&]+)[?&]'),\n                 webpage, 'url regex'))\n+\n+        episode_info = self._download_json(\n+            f'https://platform-api.tver.jp/service/api/v1/callEpisode/{video_id}?require_data=mylist,later[epefy106ur],good[epefy106ur],resume[epefy106ur]',\n+            video_id, fatal=False,\n+            query={\n+                'platform_uid': self._PLATFORM_UID,\n+                'platform_token': self._PLATFORM_TOKEN,\n+            }, headers={\n+                'x-tver-platform-type': 'web'\n+            })\n+        episode_content = traverse_obj(\n+            episode_info, ('result', 'episode', 'content')) or {}\n+\n         video_info = self._download_json(\n             f'https://statics.tver.jp/content/episode/{video_id}.json', video_id,\n-            query={'v': '5'}, headers={\n+            query={\n+                'v': str_or_none(episode_content.get('version')) or '5',\n+            }, headers={\n                 'Origin': 'https://tver.jp',\n                 'Referer': 'https://tver.jp/',\n             })\n         p_id = video_info['video']['accountID']\n-        r_id = traverse_obj(video_info, ('video', ('videoRefID', 'videoID')), get_all=False)\n+        r_id = traverse_obj(video_info, ('video', ('videoRefID', 'videoID')))\n         if not r_id:\n             raise ExtractorError('Failed to extract reference ID for Brightcove')\n         if not r_id.isdigit():\n             r_id = f'ref:{r_id}'\n \n-        additional_info = self._download_json(\n-            f'https://platform-api.tver.jp/service/api/v1/callEpisode/{video_id}?require_data=mylist,later[epefy106ur],good[epefy106ur],resume[epefy106ur]',\n-            video_id, fatal=False,\n-            query={\n-                'platform_uid': self._PLATFORM_UID,\n-                'platform_token': self._PLATFORM_TOKEN,\n-            }, headers={\n-                'x-tver-platform-type': 'web'\n-            })\n-\n-        additional_content_info = traverse_obj(\n-            additional_info, ('result', 'episode', 'content'), get_all=False) or {}\n-        episode = strip_or_none(additional_content_info.get('title'))\n-        series = str_or_none(additional_content_info.get('seriesTitle'))\n+        episode = strip_or_none(episode_content.get('title'))\n+        series = str_or_none(episode_content.get('seriesTitle'))\n         title = (\n             join_nonempty(series, episode, delim=' ')\n             or str_or_none(video_info.get('title')))\n-        provider = str_or_none(additional_content_info.get('productionProviderName'))\n-        onair_label = str_or_none(additional_content_info.get('broadcastDateLabel'))\n+        provider = str_or_none(episode_content.get('productionProviderName'))\n+        onair_label = str_or_none(episode_content.get('broadcastDateLabel'))\n \n         return {\n             '_type': 'url_transparent',\n", "issue": "[TVer] Some URLs are not recognized\n### Checklist\n\n- [X] I'm reporting a broken site\n- [X] I've verified that I'm running yt-dlp version **2022.05.18** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)\n- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details\n- [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)\n- [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\n- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)\n- [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\n\n### Region\n\nJapan\n\n### Description\n\nTVer Extractor may not recognize some URLs.\r\nfor ex.\r\nhttps://tver.jp/episodes/epm8kjl7ze\r\nhttps://tver.jp/episodes/epmf7b32xx\r\n\r\nThe URL in question can be opened in the browser without any problem, but yt-dlp will display \"Not Found\".\r\n(This is at 17:00:00 on 6/8/2022)\n\n### Verbose log\n\n```shell\n$ yt-dlp -vU https://tver.jp/episodes/epm8kjl7ze\r\n[debug] Command-line config: ['-vU', 'https://tver.jp/episodes/epm8kjl7ze']\r\n[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8\r\n[debug] yt-dlp version 2022.05.18 [b14d52355]\r\n[debug] Python version 3.8.10 (CPython 64bit) - Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29\r\n[debug] Checking exe version: ffprobe -bsfs\r\n[debug] Checking exe version: avprobe -bsfs\r\n[debug] Checking exe version: ffmpeg -bsfs\r\n[debug] Checking exe version: avconv -bsfs\r\n[debug] exe versions: none\r\n[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2019.11.28, mutagen-1.45.1, secretstorage-2.3.1, sqlite3-2.6.0, websockets-10.3\r\n[debug] Proxy map: {}\r\nLatest version: 2022.05.18, Current version: 2022.05.18\r\nyt-dlp is up to date (2022.05.18)\r\n[TVer] Creating session\r\n[debug] [TVer] Extracting URL: https://tver.jp/episodes/epm8kjl7ze\r\n[TVer] epm8kjl7ze: Downloading JSON metadata\r\n[TVer] epm8kjl7ze: Downloading JSON metadata\r\n[debug] [brightcove:new] Extracting URL: http://players.brightcove.net/6191645753001/default_default/index.html?videoId=ref:2302810259_20220604#__youtubedl_smuggle=%7B%22geo_countries%22%3A+%5B%22JP%22%5D%7D\r\n[debug] Using fake IP 133.19.253.45 (JP) as X-Forwarded-For\r\n[debug] Loading brightcove.6191645753001_default from cache\r\n[brightcove:new] ref:2302810259_20220604: Downloading JSON metadata\r\nERROR: [brightcove:new] Unable to download JSON metadata: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); 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\r\n  File \"/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py\", line 642, in extract\r\n    ie_result = self._real_extract(url)\r\n  File \"/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/brightcove.py\", line 648, in _real_extract\r\n    json_data = self._download_json(api_url, video_id, headers=headers)\r\n  File \"/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py\", line 1030, in _download_json\r\n    res = self._download_json_handle(\r\n  File \"/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py\", line 1009, in _download_json_handle\r\n    res = self._download_webpage_handle(\r\n  File \"/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/adobepass.py\", line 1364, in _download_webpage_handle\r\n    return super(AdobePassIE, self)._download_webpage_handle(\r\n  File \"/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py\", line 801, in _download_webpage_handle\r\n    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)\r\n  File \"/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py\", line 786, in _request_webpage\r\n    raise ExtractorError(errmsg, cause=err)\r\n\r\n  File \"/home/hide/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py\", line 768, in _request_webpage\r\n    return self._downloader.urlopen(url_or_request)\r\n  File \"/home/hide/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py\", line 3596, in urlopen\r\n    return self._opener.open(req, timeout=self._socket_timeout)\r\n  File \"/usr/lib/python3.8/urllib/request.py\", line 531, in open\r\n    response = meth(req, response)\r\n  File \"/usr/lib/python3.8/urllib/request.py\", line 640, in http_response\r\n    response = self.parent.error(\r\n  File \"/usr/lib/python3.8/urllib/request.py\", line 569, in error\r\n    return self._call_chain(*args)\r\n  File \"/usr/lib/python3.8/urllib/request.py\", line 502, in _call_chain\r\n    result = func(*args)\r\n  File \"/usr/lib/python3.8/urllib/request.py\", line 649, in http_error_default\r\n    raise HTTPError(req.full_url, code, msg, hdrs, fp)\r\nurllib.error.HTTPError: HTTP Error 404: Not Found\n```\n\n", "before_files": [{"content": "from .common import InfoExtractor\nfrom ..utils import (\n    ExtractorError,\n    join_nonempty,\n    smuggle_url,\n    str_or_none,\n    strip_or_none,\n    traverse_obj,\n)\n\n\nclass TVerIE(InfoExtractor):\n    _VALID_URL = r'https?://(?:www\\.)?tver\\.jp/(?:(?P<type>lp|corner|series|episodes?|feature|tokyo2020/video)/)+(?P<id>[a-zA-Z0-9]+)'\n    _TESTS = [{\n        'skip': 'videos are only available for 7 days',\n        'url': 'https://tver.jp/episodes/ep83nf3w4p',\n        'info_dict': {\n            'title': '\u5bb6\u4e8b\u30e4\u30ed\u30a6!!! \u58f2\u308a\u5834\u5e2d\u5dfb\u306e\u30c1\u30fc\u30baSP\uff06\u8ca1\u524d\u76f4\u898b\u00d7\u68ee\u6cc9\u89aa\u5b50\u306e\u8131\u6771\u4eac\u66ae\u3089\u3057\u5bc6\u7740\uff01',\n            'description': 'md5:dc2c06b6acc23f1e7c730c513737719b',\n            'series': '\u5bb6\u4e8b\u30e4\u30ed\u30a6!!!',\n            'episode': '\u58f2\u308a\u5834\u5e2d\u5dfb\u306e\u30c1\u30fc\u30baSP\uff06\u8ca1\u524d\u76f4\u898b\u00d7\u68ee\u6cc9\u89aa\u5b50\u306e\u8131\u6771\u4eac\u66ae\u3089\u3057\u5bc6\u7740\uff01',\n            'alt_title': '\u58f2\u308a\u5834\u5e2d\u5dfb\u306e\u30c1\u30fc\u30baSP\uff06\u8ca1\u524d\u76f4\u898b\u00d7\u68ee\u6cc9\u89aa\u5b50\u306e\u8131\u6771\u4eac\u66ae\u3089\u3057\u5bc6\u7740\uff01',\n            'channel': '\u30c6\u30ec\u30d3\u671d\u65e5',\n            'onair_label': '5\u67083\u65e5(\u706b)\u653e\u9001\u5206',\n            'ext_title': '\u5bb6\u4e8b\u30e4\u30ed\u30a6!!! \u58f2\u308a\u5834\u5e2d\u5dfb\u306e\u30c1\u30fc\u30baSP\uff06\u8ca1\u524d\u76f4\u898b\u00d7\u68ee\u6cc9\u89aa\u5b50\u306e\u8131\u6771\u4eac\u66ae\u3089\u3057\u5bc6\u7740\uff01 \u30c6\u30ec\u30d3\u671d\u65e5 5\u67083\u65e5(\u706b)\u653e\u9001\u5206',\n        },\n        'add_ie': ['BrightcoveNew'],\n    }, {\n        'url': 'https://tver.jp/corner/f0103888',\n        'only_matching': True,\n    }, {\n        'url': 'https://tver.jp/lp/f0033031',\n        'only_matching': True,\n    }]\n    BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'\n    _PLATFORM_UID = None\n    _PLATFORM_TOKEN = None\n\n    def _real_initialize(self):\n        create_response = self._download_json(\n            'https://platform-api.tver.jp/v2/api/platform_users/browser/create', None,\n            note='Creating session', data=b'device_type=pc', headers={\n                'Origin': 'https://s.tver.jp',\n                'Referer': 'https://s.tver.jp/',\n                'Content-Type': 'application/x-www-form-urlencoded',\n            })\n        self._PLATFORM_UID = traverse_obj(create_response, ('result', 'platform_uid'))\n        self._PLATFORM_TOKEN = traverse_obj(create_response, ('result', 'platform_token'))\n\n    def _real_extract(self, url):\n        video_id, video_type = self._match_valid_url(url).group('id', 'type')\n        if video_type not in {'series', 'episodes'}:\n            webpage = self._download_webpage(url, video_id, note='Resolving to new URL')\n            video_id = self._match_id(self._search_regex(\n                (r'canonical\"\\s*href=\"(https?://tver\\.jp/[^\"]+)\"', r'&link=(https?://tver\\.jp/[^?&]+)[?&]'),\n                webpage, 'url regex'))\n        video_info = self._download_json(\n            f'https://statics.tver.jp/content/episode/{video_id}.json', video_id,\n            query={'v': '5'}, headers={\n                'Origin': 'https://tver.jp',\n                'Referer': 'https://tver.jp/',\n            })\n        p_id = video_info['video']['accountID']\n        r_id = traverse_obj(video_info, ('video', ('videoRefID', 'videoID')), get_all=False)\n        if not r_id:\n            raise ExtractorError('Failed to extract reference ID for Brightcove')\n        if not r_id.isdigit():\n            r_id = f'ref:{r_id}'\n\n        additional_info = self._download_json(\n            f'https://platform-api.tver.jp/service/api/v1/callEpisode/{video_id}?require_data=mylist,later[epefy106ur],good[epefy106ur],resume[epefy106ur]',\n            video_id, fatal=False,\n            query={\n                'platform_uid': self._PLATFORM_UID,\n                'platform_token': self._PLATFORM_TOKEN,\n            }, headers={\n                'x-tver-platform-type': 'web'\n            })\n\n        additional_content_info = traverse_obj(\n            additional_info, ('result', 'episode', 'content'), get_all=False) or {}\n        episode = strip_or_none(additional_content_info.get('title'))\n        series = str_or_none(additional_content_info.get('seriesTitle'))\n        title = (\n            join_nonempty(series, episode, delim=' ')\n            or str_or_none(video_info.get('title')))\n        provider = str_or_none(additional_content_info.get('productionProviderName'))\n        onair_label = str_or_none(additional_content_info.get('broadcastDateLabel'))\n\n        return {\n            '_type': 'url_transparent',\n            'title': title,\n            'series': series,\n            'episode': episode,\n            # an another title which is considered \"full title\" for some viewers\n            'alt_title': join_nonempty(title, provider, onair_label, delim=' '),\n            'channel': provider,\n            'description': str_or_none(video_info.get('description')),\n            'url': smuggle_url(\n                self.BRIGHTCOVE_URL_TEMPLATE % (p_id, r_id), {'geo_countries': ['JP']}),\n            'ie_key': 'BrightcoveNew',\n        }\n", "path": "yt_dlp/extractor/tver.py"}], "after_files": [{"content": "from .common import InfoExtractor\nfrom ..utils import (\n    ExtractorError,\n    join_nonempty,\n    smuggle_url,\n    str_or_none,\n    strip_or_none,\n    traverse_obj,\n)\n\n\nclass TVerIE(InfoExtractor):\n    _VALID_URL = r'https?://(?:www\\.)?tver\\.jp/(?:(?P<type>lp|corner|series|episodes?|feature|tokyo2020/video)/)+(?P<id>[a-zA-Z0-9]+)'\n    _TESTS = [{\n        'skip': 'videos are only available for 7 days',\n        'url': 'https://tver.jp/episodes/ep83nf3w4p',\n        'info_dict': {\n            'title': '\u5bb6\u4e8b\u30e4\u30ed\u30a6!!! \u58f2\u308a\u5834\u5e2d\u5dfb\u306e\u30c1\u30fc\u30baSP\uff06\u8ca1\u524d\u76f4\u898b\u00d7\u68ee\u6cc9\u89aa\u5b50\u306e\u8131\u6771\u4eac\u66ae\u3089\u3057\u5bc6\u7740\uff01',\n            'description': 'md5:dc2c06b6acc23f1e7c730c513737719b',\n            'series': '\u5bb6\u4e8b\u30e4\u30ed\u30a6!!!',\n            'episode': '\u58f2\u308a\u5834\u5e2d\u5dfb\u306e\u30c1\u30fc\u30baSP\uff06\u8ca1\u524d\u76f4\u898b\u00d7\u68ee\u6cc9\u89aa\u5b50\u306e\u8131\u6771\u4eac\u66ae\u3089\u3057\u5bc6\u7740\uff01',\n            'alt_title': '\u58f2\u308a\u5834\u5e2d\u5dfb\u306e\u30c1\u30fc\u30baSP\uff06\u8ca1\u524d\u76f4\u898b\u00d7\u68ee\u6cc9\u89aa\u5b50\u306e\u8131\u6771\u4eac\u66ae\u3089\u3057\u5bc6\u7740\uff01',\n            'channel': '\u30c6\u30ec\u30d3\u671d\u65e5',\n            'onair_label': '5\u67083\u65e5(\u706b)\u653e\u9001\u5206',\n            'ext_title': '\u5bb6\u4e8b\u30e4\u30ed\u30a6!!! \u58f2\u308a\u5834\u5e2d\u5dfb\u306e\u30c1\u30fc\u30baSP\uff06\u8ca1\u524d\u76f4\u898b\u00d7\u68ee\u6cc9\u89aa\u5b50\u306e\u8131\u6771\u4eac\u66ae\u3089\u3057\u5bc6\u7740\uff01 \u30c6\u30ec\u30d3\u671d\u65e5 5\u67083\u65e5(\u706b)\u653e\u9001\u5206',\n        },\n        'add_ie': ['BrightcoveNew'],\n    }, {\n        'url': 'https://tver.jp/corner/f0103888',\n        'only_matching': True,\n    }, {\n        'url': 'https://tver.jp/lp/f0033031',\n        'only_matching': True,\n    }]\n    BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'\n    _PLATFORM_UID = None\n    _PLATFORM_TOKEN = None\n\n    def _real_initialize(self):\n        create_response = self._download_json(\n            'https://platform-api.tver.jp/v2/api/platform_users/browser/create', None,\n            note='Creating session', data=b'device_type=pc', headers={\n                'Origin': 'https://s.tver.jp',\n                'Referer': 'https://s.tver.jp/',\n                'Content-Type': 'application/x-www-form-urlencoded',\n            })\n        self._PLATFORM_UID = traverse_obj(create_response, ('result', 'platform_uid'))\n        self._PLATFORM_TOKEN = traverse_obj(create_response, ('result', 'platform_token'))\n\n    def _real_extract(self, url):\n        video_id, video_type = self._match_valid_url(url).group('id', 'type')\n        if video_type not in {'series', 'episodes'}:\n            webpage = self._download_webpage(url, video_id, note='Resolving to new URL')\n            video_id = self._match_id(self._search_regex(\n                (r'canonical\"\\s*href=\"(https?://tver\\.jp/[^\"]+)\"', r'&link=(https?://tver\\.jp/[^?&]+)[?&]'),\n                webpage, 'url regex'))\n\n        episode_info = self._download_json(\n            f'https://platform-api.tver.jp/service/api/v1/callEpisode/{video_id}?require_data=mylist,later[epefy106ur],good[epefy106ur],resume[epefy106ur]',\n            video_id, fatal=False,\n            query={\n                'platform_uid': self._PLATFORM_UID,\n                'platform_token': self._PLATFORM_TOKEN,\n            }, headers={\n                'x-tver-platform-type': 'web'\n            })\n        episode_content = traverse_obj(\n            episode_info, ('result', 'episode', 'content')) or {}\n\n        video_info = self._download_json(\n            f'https://statics.tver.jp/content/episode/{video_id}.json', video_id,\n            query={\n                'v': str_or_none(episode_content.get('version')) or '5',\n            }, headers={\n                'Origin': 'https://tver.jp',\n                'Referer': 'https://tver.jp/',\n            })\n        p_id = video_info['video']['accountID']\n        r_id = traverse_obj(video_info, ('video', ('videoRefID', 'videoID')))\n        if not r_id:\n            raise ExtractorError('Failed to extract reference ID for Brightcove')\n        if not r_id.isdigit():\n            r_id = f'ref:{r_id}'\n\n        episode = strip_or_none(episode_content.get('title'))\n        series = str_or_none(episode_content.get('seriesTitle'))\n        title = (\n            join_nonempty(series, episode, delim=' ')\n            or str_or_none(video_info.get('title')))\n        provider = str_or_none(episode_content.get('productionProviderName'))\n        onair_label = str_or_none(episode_content.get('broadcastDateLabel'))\n\n        return {\n            '_type': 'url_transparent',\n            'title': title,\n            'series': series,\n            'episode': episode,\n            # an another title which is considered \"full title\" for some viewers\n            'alt_title': join_nonempty(title, provider, onair_label, delim=' '),\n            'channel': provider,\n            'description': str_or_none(video_info.get('description')),\n            'url': smuggle_url(\n                self.BRIGHTCOVE_URL_TEMPLATE % (p_id, r_id), {'geo_countries': ['JP']}),\n            'ie_key': 'BrightcoveNew',\n        }\n", "path": "yt_dlp/extractor/tver.py"}]}