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

Code before:
    int_or_none,
    orderedSet,
    parse_iso8601,
    url_or_none,
    urlencode_postdata,
    urljoin,
)
from ..utils.traversal import traverse_obj


def _cloudfront_auth_request(m3u8_url, strm_id, video_id, url):
    post_data = {
        'type': 'vod',
        'strm_id': strm_id,
        'title_no': video_id,
        'url': m3u8_url,
    }
    return Request(
        'https://live.sooplive.co.kr/api/private_auth.php',
        method='POST',
        headers={
            'Content-Type': 'application/x-www-form-urlencoded',
            'Referer': url,
            'Origin': 'https://vod.sooplive.co.kr',
        },
        data=urlencode_postdata(post_data))


class AfreecaTVBaseIE(InfoExtractor):
    _NETRC_MACHINE = 'afreecatv'

    def _perform_login(self, username, password):
        login_form = {
            'szWork': 'login',
            'szType': 'json',
            'szUid': username,
            'szPassword': password,
            'isSaveId': 'false',
            'szScriptVar': 'oLoginRet',
            'szAction': '',
        }

        response = self._download_json(
            'https://login.sooplive.co.kr/app/LoginAction.php', None,
            'Logging in', data=urlencode_postdata(login_form))

        _ERRORS = {
            -4: 'Your account has been suspended due to a violation of our terms and policies.',
            -5: 'https://member.sooplive.co.kr/app/user_delete_progress.php',
            -6: 'https://login.sooplive.co.kr/membership/changeMember.php',
            -8: "Hello! Soop here.\nThe username you have entered belongs to \n an account that requires a legal guardian's consent. \nIf you wish to use our services without restriction, \nplease make sure to go through the necessary verification process.",

Review comment (suggestion):
```suggestion
        data=urlencode_postdata({
            'type': 'vod',
            'strm_id': strm_id,
            'title_no': video_id,
            'url': m3u8_url,
        }))
```

Code after:
    filter_dict,
    int_or_none,
    orderedSet,
    parse_iso8601,
    url_or_none,
    urlencode_postdata,
    urljoin,
)
from ..utils.traversal import require, traverse_obj


def _cloudfront_auth_request(m3u8_url, strm_id, video_id, referer_url):
    return Request(
        'https://live.sooplive.co.kr/api/private_auth.php',
        method='POST',
        headers={
            'Referer': referer_url,
            'Origin': 'https://vod.sooplive.co.kr',
        },
        data=urlencode_postdata({
            'type': 'vod',
            'strm_id': strm_id,
            'title_no': video_id,
            'url': m3u8_url,
        }))


class AfreecaTVBaseIE(InfoExtractor):
    _NETRC_MACHINE = 'afreecatv'

    def _perform_login(self, username, password):
        login_form = {
            'szWork': 'login',
            'szType': 'json',
            'szUid': username,
            'szPassword': password,
            'isSaveId': 'false',
            'szScriptVar': 'oLoginRet',
            'szAction': '',
        }

        response = self._download_json(
            'https://login.sooplive.co.kr/app/LoginAction.php', None,
            'Logging in', data=urlencode_postdata(login_form))

        _ERRORS = {
            -4: 'Your account has been suspended due to a violation of our terms and policies.',
            -5: 'https://member.sooplive.co.kr/app/user_delete_progress.php',
            -6: 'https://login.sooplive.co.kr/membership/changeMember.php',
            -8: "Hello! Soop here.\nThe username you have entered belongs to \n an account that requires a legal guardian's consent. \nIf you wish to use our services without restriction, \nplease make sure to go through the necessary verification process.",
            -9: 'https://member.sooplive.co.kr/app/pop_login_block.php',