HFrost0 / bilix

⚡️Lightning-fast async download tool for bilibili and more
Apache License 2.0
1.66k stars 169 forks source link

cookies解码错误 #240

Open lampshe opened 2 weeks ago

lampshe commented 2 weeks ago

更新了chrome到130,正常输入下载指令,提示两个error RuntimeError: Failed to decrypt the cipher text with DPAPI UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 4: invalid continuation byte 万能的github大神,非常感谢你的出手帮助!! -----------------------------------------------------------全部错误信息如下 Traceback (most recent call last): File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\browser_cookie3__init.py", line 539, in _decrypt return self._decrypt_windows_chromium(value, encrypted_value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\browser_cookie3__init__.py", line 530, in _decrypt_windowschromium , data = _crypt_unprotect_data(encrypted_value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\browser_cookie3\init__.py", line 89, in _crypt_unprotect_data raise RuntimeError('Failed to decrypt the cipher text with DPAPI') RuntimeError: Failed to decrypt the cipher text with DPAPI

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\Ascend\AppData\Roaming\Python\Python311\Scripts\bilix.exe__main.py", line 7, in File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 1157, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 783, in invoke return callback(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\bilix\cli\main.py", line 373, in main executor, cor = assign(kwargs) ^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\bilix\cli\assign.py", line 143, in assign res = handle_func(method, keys, options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\bilix\cli\assign.py", line 64, in wrapped res = handle_func(cls, method, keys, options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\bilix\sites\bilibili\downloader.py", line 527, in handle d = cls(sess_data=options['cookie'], kwargs_filter(cls, options)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\bilix\sites\bilibili\downloader.py", line 54, in init super(DownloaderBilibili, self).init( File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\bilix\download\base_downloader_part.py", line 35, in init super(BaseDownloaderPart, self).init( File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\bilix\download\base_downloader.py", line 109, in init self.update_cookies_from_browser(browser) File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\bilix\download\base_downloader.py", line 209, in update_cookies_from_browser self.client.cookies.update(f(domain_name=self.cookie_domain)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\browser_cookie3__init.py", line 1160, in chrome return Chrome(cookie_file, domain_name, key_file).load() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\browser_cookie3__init__.py", line 515, in load value = self._decrypt(value, enc_value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Ascend\AppData\Roaming\Python\Python311\site-packages\browser_cookie3\init__.py", line 559, in _decrypt return data.decode() ^^^^^^^^^^^^^ UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 4: invalid continuation byte

lampshe commented 2 weeks ago

本次使用之前,使用了一次yt-dlp下载视频,不知道是不是ytdlp读取cookies时候修改了什么,(⊙﹏⊙)

HFrost0 commented 2 weeks ago

可能chrome或者browser_cookie3的版本不太匹配了,建议降低chrome的版本或者升级browser_cookie3的依赖试试

lampshe commented 2 weeks ago

可能chrome或者browser_cookie3的版本不太匹配了,建议降低chrome的版本或者升级browser_cookie3的依赖试试

多谢解答,chrome是回不去了,哭死,browser_cookie3暂时是最高版本,不过作者很久没更新了,现在只能把网页的cookie一大串填进去,才能正常使用。和我遇到一样的问题的话,这个方法可行,就是稍微麻烦点。只能等bc3后期的更新了。。。。