Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/tver.py (Python)

Code before:
    # videos are only available for 7 days
    _TESTS = [{
        'url': 'https://tver.jp/corner/f0062178',
        'only_matching': True,
    }, {
        'url': 'https://tver.jp/feature/f0062413',
        'only_matching': True,
    }, {
        'url': 'https://tver.jp/episode/79622438',
        'only_matching': True,
    }, {
        # subtitle = ' '
        'url': 'https://tver.jp/corner/f0068870',
        'only_matching': True,
    }, {
        # landing page 'f'
        'url': 'https://tver.jp/lp/f0009694',
        'only_matching': True,
    }, {
        # landing page 'c'
        'url': 'https://tver.jp/lp/c0000239',
        'only_matching': True,
    }, {
        # TOKYO2020
        'url': 'https://tver.jp/tokyo2020/video/6264525510001',
        'only_matching': True,
    }]
    _TOKEN = None
    BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'

    def _real_initialize(self):
        self._TOKEN = self._download_json(
            'https://tver.jp/api/access_token.php', None)['token']

    def _real_extract(self, url):
        path, video_id = self._match_valid_url(url).groups()
        if path == "lp":
            webpage = self._download_webpage(url, video_id)
            redirect_path = self._search_regex(r'to_href="([^"]+?)"', webpage, 'redirect path')
            path, video_id = self._match_valid_url(f'https://tver.jp{redirect_path}').groups()
        api_response = self._download_json(f'https://api.tver.jp/v4/{path}/{video_id}', video_id, query={'token': self._TOKEN})
        p_id = traverse_obj(api_response, ('main', 'publisher_id'))
        if not p_id:
            error_msg, expected = traverse_obj(api_response, ('episode', 0, 'textbar', 0, ('text', 'longer')), get_all=False), True
            if not error_msg:
                error_msg, expected = 'Failed to extract publisher ID', False
            raise ExtractorError(error_msg, expected=expected)
        service = remove_start(traverse_obj(api_response, ('main', 'service')), 'ts_')

        r_id = traverse_obj(api_response, ('main', 'reference_id'))
        if service not in ('tx', 'russia2018', 'sebare2018live', 'gorin'):

Review comment (suggestion):
```suggestion
    }, {
        'url': 'https://tver.jp/lp/f0009694',
        'only_matching': True,
    }, {
        'url': 'https://tver.jp/lp/c0000239',
        'only_matching': True,
    }, {
        'url': 'https://tver.jp/tokyo2020/video/6264525510001',
        'only_matching': True,
```
The comments say the same thing as the URLs

Code after:
    # videos are only available for 7 days
    _TESTS = [{
        'url': 'https://tver.jp/corner/f0062178',
        'only_matching': True,
    }, {
        'url': 'https://tver.jp/feature/f0062413',
        'only_matching': True,
    }, {
        'url': 'https://tver.jp/episode/79622438',
        'only_matching': True,
    }, {
        # subtitle = ' '
        'url': 'https://tver.jp/corner/f0068870',
        'only_matching': True,
    }, {
        'url': 'https://tver.jp/lp/f0009694',
        'only_matching': True,
    }, {
        'url': 'https://tver.jp/lp/c0000239',
        'only_matching': True,
    }, {
        'url': 'https://tver.jp/tokyo2020/video/6264525510001',
        'only_matching': True,
    }]
    _TOKEN = None
    BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'

    def _real_initialize(self):
        self._TOKEN = self._download_json(
            'https://tver.jp/api/access_token.php', None)['token']

    def _real_extract(self, url):
        path, video_id = self._match_valid_url(url).groups()
        if path == 'lp':
            webpage = self._download_webpage(url, video_id)
            redirect_path = self._search_regex(r'to_href="([^"]+)', webpage, 'redirect path')
            path, video_id = self._match_valid_url(f'https://tver.jp{redirect_path}').groups()
        api_response = self._download_json(f'https://api.tver.jp/v4/{path}/{video_id}', video_id, query={'token': self._TOKEN})
        p_id = traverse_obj(api_response, ('main', 'publisher_id'))
        if not p_id:
            error_msg, expected = traverse_obj(api_response, ('episode', 0, 'textbar', 0, ('text', 'longer')), get_all=False), True
            if not error_msg:
                error_msg, expected = 'Failed to extract publisher ID', False
            raise ExtractorError(error_msg, expected=expected)
        service = remove_start(traverse_obj(api_response, ('main', 'service')), 'ts_')

        r_id = traverse_obj(api_response, ('main', 'reference_id'))
        if service not in ('tx', 'russia2018', 'sebare2018live', 'gorin'):
            r_id = 'ref:' + r_id
        bc_url = smuggle_url(
            self.BRIGHTCOVE_URL_TEMPLATE % (p_id, r_id),