Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么解析cookie失败 #619

Closed
asuka1715 opened this issue Dec 10, 2024 · 5 comments
Closed

怎么解析cookie失败 #619

asuka1715 opened this issue Dec 10, 2024 · 5 comments
Labels
failed 程序运行出错

Comments

@asuka1715
Copy link

为了更好的解决问题,请认真回答下面的问题。等到问题解决,请及时关闭本issue。

  • 问:请您指明哪个版本运行出错(github版/PyPi版/全部)?

答:github

  • 问:您使用的是否是最新的程序(是/否)?

答:是

  • 问:爬取任意用户都会运行出错吗(是/否)?

答:

  • 问:若只有爬特定微博时才出错,能否提供出错微博的weibo_id或url(非必填)?

答:

  • 问:若您已提供出错微博的weibo_id或url,可忽略此内容,否则能否提供出错账号的user_id及您配置的since_date,方便我们定位出错微博(非必填)?

答:

  • 问:如果方便,请您描述出错详情,最好附上错误提示。

答:Failed to obtain weibo.cn cookie from Chrome browser: Unable to get key for cookie decryption
Check for cookie failed: Unable to get key for cookie decryption
Unable to get key for cookie decryption
Traceback (most recent call last):
File "F:\code\weiboSpider\venv\lib\site-packages\browser_cookie3_init_.py", line 562, in _decrypt
return self.decrypt_windows_chromium(value, encrypted_value)
File "F:\code\weiboSpider\venv\lib\site-packages\browser_cookie3_init
.py", line 553, in _decrypt_windows_chromium
_, data = crypt_unprotect_data(encrypted_value)
File "F:\code\weiboSpider\venv\lib\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 "F:\code\weiboSpider\venv\lib\site-packages\browser_cookie3_init_.py", line 578, in _decrypt
data = aes.decrypt_and_verify(encrypted_value[12:-16], tag)
File "F:\code\weiboSpider\venv\lib\site-packages\Cryptodome\Cipher_mode_gcm.py", line 567, in decrypt_and_verify
self.verify(received_mac_tag)
File "F:\code\weiboSpider\venv\lib\site-packages\Cryptodome\Cipher_mode_gcm.py", line 508, in verify
raise ValueError("MAC check failed")
ValueError: MAC check failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "F:\code\weiboSpider\weiboSpider\weibo_spider\spider.py", line 387, in main
config = get_config()
File "F:\code\weiboSpider\weiboSpider\weibo_spider\spider.py", line 376, in get_config
config_util.check_cookie(config_path)
File "F:\code\weiboSpider\weiboSpider\weibo_spider\config_util.py", line 209, in check_cookie
cookie = get_cookie()
File "F:\code\weiboSpider\weiboSpider\weibo_spider\config_util.py", line 181, in get_cookie
chrome_cookies = browser_cookie3.chrome(domain_name='weibo.cn')
File "F:\code\weiboSpider\venv\lib\site-packages\browser_cookie3_init
.py", line 1188, in chrome
return Chrome(cookie_file, domain_name, key_file).load()
File "F:\code\weiboSpider\venv\lib\site-packages\browser_cookie3_init
.py", line 516, in load
value = self.decrypt(value, enc_value, has_integrity_check_for_cookie_domain)
File "F:\code\weiboSpider\venv\lib\site-packages\browser_cookie3_init
.py", line 580, in _decrypt
raise BrowserCookieError(
browser_cookie3.BrowserCookieError: Unable to get key for cookie decryption

@asuka1715 asuka1715 added the failed 程序运行出错 label Dec 10, 2024
@asuka1715
Copy link
Author

@asuka1715 asuka1715 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2024
@asuka1715 asuka1715 reopened this Dec 10, 2024
@asuka1715 asuka1715 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2024
@asuka1715
Copy link
Author

好像跟google的安全策略有关,参考borisbabic/browser_cookie3#210 (comment)

@asuka1715
Copy link
Author

实测换到google旧版本就可以了

@dataabc
Copy link
Owner

dataabc commented Dec 10, 2024

感谢反馈。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
failed 程序运行出错
Projects
None yet
Development

No branches or pull requests

2 participants