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

Code before:
                        'width': 180,
                        'height': 180,
                    },
                ],
                'categories': ['人文'],
                'duration': 93,
                'view_count': int,
                'like_count': int,
            },
        },
        {
            # VIP-restricted audio
            'url': 'https://www.ximalaya.com/sound/562111701',
            'only_matching': True,
        },
    ]

    @staticmethod
    def _decrypt_filename(audio_info):
        seed = float_or_none(audio_info['seed'])
        file_id = audio_info['fileId']
        cgstr = ''
        key = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890'
        for _ in range(len(key)):
            j = 211 * seed + 30031
            seed = float_or_none(int_or_none(j) % 65536)
            ran = seed / float_or_none(65536)
            r = int_or_none(ran * float_or_none(len(key)))
            cgstr += key[r]
            key = key.replace(key[r], '')
        strs = file_id.split('*')
        filename = ''
        for n in range(len(strs) - 1):
            if strs[n] != '':
                index = int_or_none(strs[n])
                filename += cgstr[index]
        if filename[0] != '/':
            filename = '/' + filename
        return filename

    @staticmethod
    def _decrypt_url_params(audio_info):
        def char_code_at(s: str, n: int) -> int:
            return ord(s[n]) if n < len(s) else 0

        def decrypt(e: str, t: list) -> str:
            r = list(range(256))
            a = 0
            s = ''

            for o in range(256):

Review comment (suggestion):
```suggestion
            seed = float(int(211 * seed + 30031) % 65536)
```

Code after:
                'thumbnail': r're:^https?://.*\.jpg',
                'thumbnails': [
                    {
                        'name': 'cover_url',
                        'url': r're:^https?://.*\.jpg',
                    },
                    {
                        'name': 'cover_url_142',
                        'url': r're:^https?://.*\.jpg',
                        'width': 180,
                        'height': 180,
                    },
                ],
                'categories': ['人文'],
                'duration': 93,
                'view_count': int,
                'like_count': int,
            },
        },
        {
            # VIP-restricted audio
            'url': 'https://www.ximalaya.com/sound/562111701',
            'only_matching': True,
        },
    ]

    @staticmethod
    def _decrypt_filename(file_id, seed):
        cgstr = ''
        key = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890'
        for _ in key:
            seed = float(int(211 * seed + 30031) % 65536)
            r = int(seed / 65536 * len(key))
            cgstr += key[r]
            key = key.replace(key[r], '')
        parts = file_id.split('*')
        filename = ''.join(cgstr[int(part)] for part in parts if part.isdecimal())
        if not filename.startswith('/'):
            filename = '/' + filename
        return filename

    @staticmethod
    def _decrypt_url_params(encrypted_params):
        params = VideaIE.rc4(
            base64.b64decode(encrypted_params), 'xkt3a41psizxrh9l').split('-')
        # sign, token, timestamp
        return params[1], params[2], params[3]

    def _real_extract(self, url):
        scheme = 'https' if url.startswith('https') else 'http'