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

Code before:
                s += chr(t[u] ^ r[(r[o] + r[a]) % 256])

            return s

        def decrypt2(key: str, key2: list) -> str:
            n = []
            for r in range(len(key)):
                a = ord('a')
                if ord('a') <= ord(key[r]) <= ord('z'):
                    a = ord(key[r]) - 97
                else:
                    a = ord(key[r]) - 48 + 26

                for i in range(36):
                    if key2[i] == a:
                        a = i
                        break

                if a > 25:
                    n.append(chr(a - 26 + 48))
                else:
                    n.append(chr(a + 97))

            return ''.join(n)

        def decrypt3(s: str) -> list:
            t = 0
            n = 0
            r = 0
            s_len = len(s)
            i = []
            o = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
                 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
                 -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1,
                 -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
                 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30,
                 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
                 51, -1, -1, -1, -1, -1]

            while r < s_len:
                t = o[char_code_at(s, r) & 255]
                r += 1
                while r < s_len and t == -1:
                    t = o[char_code_at(s, r) & 255]
                    r += 1
                if t == -1:
                    break

                n = o[char_code_at(s, r) & 255]
                r += 1
                while r < s_len and n == -1:

Review comment (suggestion):
Maybe I am missing something, but isn't this just base64?
```python
return list(base64.b64decode(s))
```

Code after:
            ts = int(time.time())
            vip_info = self._download_json(
                f'{scheme}://mpay.ximalaya.com/mobile/track/pay/{audio_id}/{ts}',
                audio_id, 'Downloading VIP info json', 'Unable to download VIP info file',
                query={'device': 'pc', 'isBackend': 'true', '_': ts})
            filename = self._decrypt_filename(vip_info['fileId'], vip_info['seed'])
            sign, token, timestamp = self._decrypt_url_params(vip_info['ep'])
            vip_url = update_url_query(
                f'{vip_info["domain"]}/download/{vip_info["apiVersion"]}{filename}', {
                    'sign': sign,
                    'token': token,
                    'timestamp': timestamp,
                    'buy_key': vip_info['buyKey'],
                    'duration': vip_info['duration'],
                })
            fmt = {
                'format_id': 'vip',
                'url': vip_url,
                'vcodec': 'none',
            }
            if '_preview_' in vip_url:
                self.report_warning(
                    f'This tracks requires a VIP account. Using a sample instead. {self._login_hint()}')
                fmt.update({
                    'format_note': 'Sample',
                    'preference': -10,
                    **traverse_obj(vip_info, {
                        'filesize': ('sampleLength', {int_or_none}),
                        'duration': ('sampleDuration', {int_or_none}),
                    }),
                })
            else:
                fmt.update(traverse_obj(vip_info, {
                    'filesize': ('totalLength', {int_or_none}),
                    'duration': ('duration', {int_or_none}),
                }))

            fmt['abr'] = try_call(lambda: fmt['filesize'] * 8 / fmt['duration'] / 1024)
            formats.append(fmt)

        formats.extend([{
            'format_id': f'{bps}k',
            'url': audio_info[k],
            'abr': bps,
            'vcodec': 'none',
        } for bps, k in ((24, 'play_path_32'), (64, 'play_path_64')) if audio_info.get(k)])

        thumbnails = []
        for k in audio_info:
            # cover pics kyes like: cover_url', 'cover_url_142'
            if k.startswith('cover_url'):