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

Code before:
        'url': 'https://wasd.tv/24_7',
        'info_dict': {
            'id': '559738',
            'ext': 'mp4',
            'title': 'Live 24/7 Music',
            'description': '24&#x2F;7 Music',
            'timestamp': int,
            'upload_date': r're:^\d{8}$',
            'is_live': True,
            'view_count': int,
        },
    }]

    def _get_container(self, url):
        nickname = self._match_id(url)
        channel = self._fetch(f'channels/nicknames/{nickname}', video_id=nickname, description='channel')
        channel_id = channel.get('channel_id')
        containers = self._fetch(
            'v2/media-containers',
            query={
                'channel_id': channel_id,
                'media_container_type': 'SINGLE',
                'media_container_status': 'RUNNING',
            },
            video_id=channel_id,
            description='running media containers')
        if not containers:
            raise ExtractorError(f'{nickname} is offline', expected=True)
        return containers[0]

    def _get_media_url(self, media_meta):
        return media_meta.get('media_url'), True


class WASDTVRecordIE(WASDTVBaseIE):
    IE_NAME = 'wasdtv:record'
    _VALID_URL = r'https?://wasd\.tv/[^/#?]+/videos\?record=(?P<id>\d+)$'
    _TESTS = [{
        'url': 'https://wasd.tv/spacemita/videos?record=907755',
        'md5': 'c9899dd85be4cc997816ff9f9ca516ce',
        'info_dict': {
            'id': '906825',
            'ext': 'mp4',
            'title': 'Музыкальный',
            'description': 'md5:f510388d929ff60ae61d4c3cab3137cc',
            'timestamp': 1645812079,
            'upload_date': '20220225',
            'thumbnail': r're:^https?://.+\.jpg',
            'is_live': False,
            'view_count': int,
        },

Review comment (suggestion):
```suggestion
        containers = self._fetch(
            'v2/media-containers', channel_id, 'running media containers',
            query={
                'channel_id': channel_id,
                'media_container_type': 'SINGLE',
                'media_container_status': 'RUNNING',
            })
```

Code after:
        'url': 'https://wasd.tv/24_7',
        'info_dict': {
            'id': '559738',
            'ext': 'mp4',
            'title': 'Live 24/7 Music',
            'description': '24&#x2F;7 Music',
            'timestamp': int,
            'upload_date': r're:^\d{8}$',
            'is_live': True,
            'view_count': int,
        },
    }]

    def _get_container(self, url):
        nickname = self._match_id(url)
        channel = self._fetch(f'channels/nicknames/{nickname}', video_id=nickname, description='channel')
        channel_id = channel.get('channel_id')
        containers = self._fetch(
            'v2/media-containers', channel_id, 'running media containers',
            query={
                'channel_id': channel_id,
                'media_container_type': 'SINGLE',
                'media_container_status': 'RUNNING',
            })
        if not containers:
            raise ExtractorError(f'{nickname} is offline', expected=True)
        return containers[0]

    def _get_media_url(self, media_meta):
        return media_meta['media_url'], True


class WASDTVRecordIE(WASDTVBaseIE):
    IE_NAME = 'wasdtv:record'
    _VALID_URL = r'https?://wasd\.tv/[^/#?]+/videos\?record=(?P<id>\d+)$'
    _TESTS = [{
        'url': 'https://wasd.tv/spacemita/videos?record=907755',
        'md5': 'c9899dd85be4cc997816ff9f9ca516ce',
        'info_dict': {
            'id': '906825',
            'ext': 'mp4',
            'title': 'Музыкальный',
            'description': 'md5:f510388d929ff60ae61d4c3cab3137cc',
            'timestamp': 1645812079,
            'upload_date': '20220225',
            'thumbnail': r're:^https?://.+\.jpg',
            'is_live': False,
            'view_count': int,
        },
    }]