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

Code before:
        },
        'playlist_count': 1,
    }, {
        'url': 'https://tvw.org/2023/09/5th-annual-tvw-open-thank-you/',
        'info_dict': {
            'id': '5th-annual-tvw-open-thank-you',
            'title': '5th Annual TVW Open THANK YOU!',
            'description': 'md5:5306eef5b03c87108797cb6261c5f16c',
        },
        'playlist_count': 0,
    }]

    def _real_extract(self, url):
        playlist_id = self._match_id(url)
        # Use a newer user agent as the default yt-dlp one triggers the Cloudflare anti-bot challenge
        webpage = self._download_webpage(url, playlist_id, headers={
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0',
        })

        video_ids = traverse_obj(webpage, (
            {find_elements(cls='invintus-player', html=True)}, ..., {extract_attributes}, 'data-eventid'))

        return self.playlist_from_matches(
            (f'https://tvw.org/watch?eventID={video_id}' for video_id in video_ids), playlist_id,
            playlist_title=remove_end(self._og_search_title(webpage, default=None), ' - TVW'),
            playlist_description=self._og_search_description(webpage, default=None), ie=TvwIE)


class TvwTvChannelsIE(InfoExtractor):
    IE_NAME = 'tvw:tvchannels'
    _VALID_URL = r'https?://(?:www\.)?tvw\.org/tvchannels/(?P<id>[^/?#]+)'
    _TESTS = [{
        'url': 'https://tvw.org/tvchannels/air/',
        'info_dict': {
            'id': 'air',
            'ext': 'mp4',
            'title': r're:TVW Cable Channel Live Stream',
            'thumbnail': r're:https?://.+/.+\.(?:jpe?g|png)$',
            'live_status': 'is_live',
        },
    }, {
        'url': 'https://tvw.org/tvchannels/tvw2/',
        'info_dict': {
            'id': 'tvw2',
            'ext': 'mp4',
            'title': r're:TVW-2 Broadcast Channel',
            'thumbnail': r're:https?://.+/.+\.(?:jpe?g|png)$',
            'live_status': 'is_live',
        },
    }]


Review comment (suggestion):
```suggestion
            video_ids, playlist_id,
            playlist_title=remove_end(self._og_search_title(webpage, default=None), ' - TVW'),
            playlist_description=self._og_search_description(webpage, default=None),
            getter=lambda x: f'https://tvw.org/watch?eventID={x}', ie=TvwIE)
```

Code after:
        },
        'playlist_count': 1,
    }]

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

        video_ids = traverse_obj(webpage, (
            {find_elements(cls='invintus-player', html=True)}, ..., {extract_attributes}, 'data-eventid'))

        return self.playlist_from_matches(
            video_ids, playlist_id,
            playlist_title=remove_end(self._og_search_title(webpage, default=None), ' - TVW'),
            playlist_description=self._og_search_description(webpage, default=None),
            getter=lambda x: f'https://tvw.org/watch?eventID={x}', ie=TvwIE)


class TvwTvChannelsIE(InfoExtractor):
    IE_NAME = 'tvw:tvchannels'
    _VALID_URL = r'https?://(?:www\.)?tvw\.org/tvchannels/(?P<id>[^/?#]+)'
    _TESTS = [{
        'url': 'https://tvw.org/tvchannels/air/',
        'info_dict': {
            'id': 'air',
            'ext': 'mp4',
            'title': r're:TVW Cable Channel Live Stream',
            'thumbnail': r're:https?://.+/.+\.(?:jpe?g|png)$',
            'live_status': 'is_live',
        },
    }, {
        'url': 'https://tvw.org/tvchannels/tvw2/',
        'info_dict': {
            'id': 'tvw2',
            'ext': 'mp4',
            'title': r're:TVW-2 Broadcast Channel',
            'thumbnail': r're:https?://.+/.+\.(?:jpe?g|png)$',
            'live_status': 'is_live',
        },
    }]

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

        m3u8_url = traverse_obj(webpage, (
            {find_element(id='invintus-persistent-stream-frame', html=True)}, {extract_attributes},
            'src', {parse_qs}, 'encoder', 0, {json.loads}, 'live247URI', {url_or_none}, {require('stream url')}))

        return {
            'id': video_id,