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

Code before:
        if result != 1:
            error = _ERRORS.get(result, 'You have failed to log in.')
            raise ExtractorError(
                f'Unable to login: {self.IE_NAME} said: {error}',
                expected=True)

    def _call_api(self, endpoint, display_id, data=None, headers=None, query=None):
        return self._download_json(Request(
            f'https://api.m.sooplive.co.kr/{endpoint}',
            data=data, headers=headers, query=query,
            extensions={'legacy_ssl': True}), display_id,
            'Downloading API JSON', 'Unable to download API JSON')


class AfreecaTVIE(AfreecaTVBaseIE):
    IE_NAME = 'soop'
    IE_DESC = 'sooplive.co.kr'
    _VALID_URL = r'''(?x)
                    https?://
                        (?:
                            (?:(?:live|afbbs|www)\.)?sooplive\.co\.kr(?::\d+)?
                            (?:
                                /app/(?:index|read_ucc_bbs)\.cgi|
                                /player/[Pp]layer\.(?:swf|html)
                            )\?.*?\bnTitleNo=|
                            vod\.sooplive\.co\.kr/(PLAYER/STATION|player)/
                        )
                        (?P<id>\d+)/?(?:$|[?#&])
                    '''
    _TESTS = [{
        'url': 'http://live.sooplive.co.kr:8079/app/index.cgi?szType=read_ucc_bbs&szBjId=dailyapril&nStationNo=16711924&nBbsNo=18605867&nTitleNo=36164052&szSkin=',
        'md5': 'f72c89fe7ecc14c1b5ce506c4996046e',
        'info_dict': {
            'id': '36164052',
            'ext': 'mp4',
            'title': '데일리 에이프릴 요정들의 시상식!',
            'thumbnail': 're:^https?://(?:video|st)img.sooplive.co.kr/.*$',
            'uploader': 'dailyapril',
            'uploader_id': 'dailyapril',
            'upload_date': '20160503',
        },
        'skip': 'Video is gone',
    }, {
        'url': 'http://afbbs.sooplive.co.kr:8080/app/read_ucc_bbs.cgi?nStationNo=16711924&nTitleNo=36153164&szBjId=dailyapril&nBbsNo=18605867',
        'info_dict': {
            'id': '36153164',
            'title': "BJ유트루와 함께하는 '팅커벨 메이크업!'",
            'thumbnail': 're:^https?://(?:video|st)img.sooplive.co.kr/.*$',
            'uploader': 'dailyapril',
            'uploader_id': 'dailyapril',
        },

Review comment (suggestion):
support both domains here
```suggestion
                            vod\.(?:sooplive\.co\.kr|afreecatv\.com)/(?:PLAYER/STATION|player)/
```

Code after:
        if result != 1:
            error = _ERRORS.get(result, 'You have failed to log in.')
            raise ExtractorError(
                f'Unable to login: {self.IE_NAME} said: {error}',
                expected=True)

    def _call_api(self, endpoint, display_id, data=None, headers=None, query=None):
        return self._download_json(Request(
            f'https://api.m.sooplive.co.kr/{endpoint}',
            data=data, headers=headers, query=query,
            extensions={'legacy_ssl': True}), display_id,
            'Downloading API JSON', 'Unable to download API JSON')


class AfreecaTVIE(AfreecaTVBaseIE):
    IE_NAME = 'soop'
    IE_DESC = 'sooplive.co.kr'
    _VALID_URL = r'https?://vod\.(?:sooplive\.co\.kr|afreecatv\.com)/(?:PLAYER/STATION|player)/(?P<id>\d+)/?(?:$|[?#&])'
    _TESTS = [{
        'url': 'https://vod.sooplive.co.kr/player/96753363',
        'info_dict': {
            'id': '20230108_9FF5BEE1_244432674_1',
            'ext': 'mp4',
            'uploader_id': 'rlantnghks',
            'uploader': '페이즈으',
            'duration': 10840,
            'thumbnail': r're:https?://videoimg\.sooplive\.co/.kr/.+',
            'upload_date': '20230108',
            'timestamp': 1673218805,
            'title': '젠지 페이즈',
        },
        'params': {
            'skip_download': True,
        },
    }, {
        # non standard key
        'url': 'http://vod.sooplive.co.kr/PLAYER/STATION/20515605',
        'info_dict': {
            'id': '20170411_BE689A0E_190960999_1_2_h',
            'ext': 'mp4',
            'title': '혼자사는여자집',
            'thumbnail': r're:https?://(?:video|st)img\.sooplive\.co\.kr/.+',
            'uploader': '♥이슬이',
            'uploader_id': 'dasl8121',
            'upload_date': '20170411',
            'timestamp': 1491929865,
            'duration': 213,
        },
        'params': {
            'skip_download': True,
        },