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

Code before:
    update_url_query,
)


class RadikoBaseIE(InfoExtractor):
    _GEO_BYPASS = False
    _FULL_KEY = None
    _HOSTS_FOR_TIME_FREE_FFMPEG_UNSUPPORTED = (
        'https://c-rpaa.smartstream.ne.jp',
        'https://si-c-radiko.smartstream.ne.jp',
        'https://tf-f-rpaa-radiko.smartstream.ne.jp',
        'https://tf-c-rpaa-radiko.smartstream.ne.jp',
        'https://si-f-radiko.smartstream.ne.jp',
        'https://rpaa.smartstream.ne.jp',
    )
    _HOSTS_FOR_TIME_FREE_FFMPEG_SUPPORTED = (
        'https://rd-wowza-radiko.radiko-cf.com',
        'https://radiko.jp',
        'https://f-radiko.smartstream.ne.jp',
    )
    # Following URL forcibly connects not Time Free but Live
    _HOSTS_FOR_LIVE = (
        'https://c-radiko.smartstream.ne.jp',
    )
    # performer separtor character (include Japanese charset)
    _PERFORMER_SPLIT_RE = "[/／、　,，]"

    def _negotiate_token(self):
        _, auth1_handle = self._download_webpage_handle(
            'https://radiko.jp/v2/api/auth1', None, 'Downloading authentication page',
            headers={
                'x-radiko-app': 'pc_html5',
                'x-radiko-app-version': '0.0.1',
                'x-radiko-device': 'pc',
                'x-radiko-user': 'dummy_user',
            })
        auth1_header = auth1_handle.headers

        auth_token = auth1_header['X-Radiko-AuthToken']
        kl = int(auth1_header['X-Radiko-KeyLength'])
        ko = int(auth1_header['X-Radiko-KeyOffset'])
        raw_partial_key = self._extract_full_key()[ko:ko + kl]
        partial_key = base64.b64encode(raw_partial_key).decode()

        area_id = self._download_webpage(
            'https://radiko.jp/v2/api/auth2', None, 'Authenticating',
            headers={
                'x-radiko-device': 'pc',
                'x-radiko-user': 'dummy_user',
                'x-radiko-authtoken': auth_token,
                'x-radiko-partialkey': partial_key,

Review comment (suggestion):
the separator character class is a good idea, but we can inline this in the method
```suggestion
```

Code after:
    update_url_query,
)
from ..utils.traversal import traverse_obj


class RadikoBaseIE(InfoExtractor):
    _GEO_BYPASS = False
    _FULL_KEY = None
    _HOSTS_FOR_TIME_FREE_FFMPEG_UNSUPPORTED = (
        'https://c-rpaa.smartstream.ne.jp',
        'https://si-c-radiko.smartstream.ne.jp',
        'https://tf-f-rpaa-radiko.smartstream.ne.jp',
        'https://tf-c-rpaa-radiko.smartstream.ne.jp',
        'https://si-f-radiko.smartstream.ne.jp',
        'https://rpaa.smartstream.ne.jp',
    )
    _HOSTS_FOR_TIME_FREE_FFMPEG_SUPPORTED = (
        'https://rd-wowza-radiko.radiko-cf.com',
        'https://radiko.jp',
        'https://f-radiko.smartstream.ne.jp',
    )
    # Following URL forcibly connects not Time Free but Live
    _HOSTS_FOR_LIVE = (
        'https://c-radiko.smartstream.ne.jp',
    )

    def _negotiate_token(self):
        _, auth1_handle = self._download_webpage_handle(
            'https://radiko.jp/v2/api/auth1', None, 'Downloading authentication page',
            headers={
                'x-radiko-app': 'pc_html5',
                'x-radiko-app-version': '0.0.1',
                'x-radiko-device': 'pc',
                'x-radiko-user': 'dummy_user',
            })
        auth1_header = auth1_handle.headers

        auth_token = auth1_header['X-Radiko-AuthToken']
        kl = int(auth1_header['X-Radiko-KeyLength'])
        ko = int(auth1_header['X-Radiko-KeyOffset'])
        raw_partial_key = self._extract_full_key()[ko:ko + kl]
        partial_key = base64.b64encode(raw_partial_key).decode()

        area_id = self._download_webpage(
            'https://radiko.jp/v2/api/auth2', None, 'Authenticating',
            headers={
                'x-radiko-device': 'pc',
                'x-radiko-user': 'dummy_user',
                'x-radiko-authtoken': auth_token,
                'x-radiko-partialkey': partial_key,
            }).split(',')[0]