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

Code before:
            'title': 'Home Warranties Workgroup',
            'thumbnail': r're:^https?://.*\.jpg$',
            'description': 'md5:861396cc523c9641d0dce690bc5c35f3',
            'timestamp': 946389600,
            'upload_date': '19991228',
        }}]

    def _extract_formats(self, response, video_id):
        extract_formats = lambda url, video_id: self._extract_m3u8_formats_and_subtitles(url, video_id, 'mp4')
        stream_urls = traverse_obj(response, 'streamingURIs', {
            'main': ('main', {url_or_none}),
            'backup': ('backup', {url_or_none}),
        })

        try:
            return extract_formats(stream_urls.get('main'), video_id)
        except ExtractorError:
            self.report_warning('Failed to parse the m3u8 stream. Falling back to the backup stream if it exists.')
            try:
                return extract_formats(stream_urls.get('backup'), video_id)
            except ExtractorError:
                raise

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)

        client_id = self._html_search_meta('clientID', webpage, fatal=True)
        video_id = self._html_search_meta('eventID', webpage, fatal=True)

        video_data = self._download_json('https://api.v3.invintus.com/v2/Event/getDetailed', video_id,
                                         headers={
                                             'authorization': 'embedder',
                                             'wsc-api-key': '7WhiEBzijpritypp8bqcU7pfU9uicDR',
                                         },
                                         data=json.dumps({
                                             'clientID': client_id,
                                             'eventID': video_id,
                                             'showStreams': True,
                                         }).encode()).get('data')

        formats, subtitles = self._extract_formats(video_data, video_id)

        return {
            'id': video_id,
            'formats': formats,
            **traverse_obj(video_data, {
                'title': ('title', {lambda x: x or self._og_search_title(webpage)}),
                'description': ('description', {lambda x: clean_html(x) or self._og_search_description(webpage)}),
                'subtitles': ('captionPath', {
                    lambda x: self._merge_subtitles({'en': [{'ext': 'vtt', 'url': x}]}, target=subtitles),

Review comment (suggestion):
Lets keep this as the display_id instead of overwriting the variable.
```suggestion
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)
```

Code after:
            'categories': ['Washington State Parks'],
        },
    }, {
        'url': 'https://tvw.org/video/home-warranties-workgroup-2',
        'md5': 'f678789bf94d07da89809f213cf37150',
        'info_dict': {
            'id': '1999121000',
            'ext': 'mp4',
            'title': 'Home Warranties Workgroup',
            'thumbnail': r're:^https?://.*\.(?:jpe?g|png)$',
            'description': 'md5:861396cc523c9641d0dce690bc5c35f3',
            'timestamp': 946389600,
            'upload_date': '19991228',
            'display_id': 'home-warranties-workgroup-2',
            'categories': ['Legislative'],
        },
    }, {
        'url': 'https://tvw.org/video/washington-to-washington-a-new-space-race-2022041111/?eventID=2022041111',
        'md5': '6f5551090b351aba10c0d08a881b4f30',
        'info_dict': {
            'id': '2022041111',
            'ext': 'mp4',
            'title': 'Washington to Washington - A New Space Race',
            'thumbnail': r're:^https?://.*\.(?:jpe?g|png)$',
            'description': 'md5:f65a24eec56107afbcebb3aa5cd26341',
            'timestamp': 1650394800,
            'upload_date': '20220419',
            'location': 'Hayner Media Center',
            'display_id': 'washington-to-washington-a-new-space-race-2022041111',
            'categories': ['Washington to Washington', 'General Interest'],
        },
    }]

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)

        client_id = self._html_search_meta('clientID', webpage, fatal=True)
        video_id = self._html_search_meta('eventID', webpage, fatal=True)

        video_data = self._download_json(
            'https://api.v3.invintus.com/v2/Event/getDetailed', video_id,
            headers={
                'authorization': 'embedder',
                'wsc-api-key': '7WhiEBzijpritypp8bqcU7pfU9uicDR',
            },
            data=json.dumps({
                'clientID': client_id,
                'eventID': video_id,
                'showStreams': True,
            }).encode())['data']