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

新版本google 浏览器,cookie获取出现错误 #632

Open
WANGYE-2012 opened this issue Jan 13, 2025 · 2 comments
Open

新版本google 浏览器,cookie获取出现错误 #632

WANGYE-2012 opened this issue Jan 13, 2025 · 2 comments
Labels
feature 新需求

Comments

@WANGYE-2012
Copy link

PS D:\weiboSpider> python -m weibo_spider
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 "D:\miniconda\lib\site-packages\browser_cookie3_init_.py", line 596, in _decrypt
return self.decrypt_windows_chromium(value, encrypted_value)
File "D:\miniconda\lib\site-packages\browser_cookie3_init
.py", line 587, in _decrypt_windows_chromium
_, data = crypt_unprotect_data(encrypted_value)
File "D:\miniconda\lib\site-packages\browser_cookie3_init
.py", line 99, 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 "D:\miniconda\lib\site-packages\browser_cookie3_init_.py", line 612, in _decrypt
data = aes.decrypt_and_verify(encrypted_value[12:-16], tag)
File "D:\miniconda\lib\site-packages\Cryptodome\Cipher_mode_gcm.py", line 567, in decrypt_and_verify
self.verify(received_mac_tag)
File "D:\miniconda\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 "D:\weiboSpider\weibo_spider\spider.py", line 387, in main
config = get_config()
File "D:\weiboSpider\weibo_spider\spider.py", line 376, in get_config
config_util.check_cookie(config_path)
File "D:\weiboSpider\weibo_spider\config_util.py", line 209, in check_cookie
cookie = get_cookie()
File "D:\weiboSpider\weibo_spider\config_util.py", line 181, in get_cookie
chrome_cookies = browser_cookie3.chrome(domain_name='weibo.cn')
File "D:\miniconda\lib\site-packages\browser_cookie3_init
.py", line 1320, in chrome
return Chrome(cookie_file, domain_name, key_file).load()
File "D:\miniconda\lib\site-packages\browser_cookie3_init
.py", line 550, in load
value = self.decrypt(value, enc_value, has_integrity_check_for_cookie_domain)
File "D:\miniconda\lib\site-packages\browser_cookie3_init
.py", line 614, in _decrypt
raise BrowserCookieError(
browser_cookie3.BrowserCookieError: Unable to get key for cookie decryption

@WANGYE-2012 WANGYE-2012 added the feature 新需求 label Jan 13, 2025
@dataabc
Copy link
Owner

dataabc commented Jan 13, 2025

感谢反馈。这个chrome新版本确实会出错,旧版本没问题,目前没有特别好的办法。

@songzy12
Copy link
Collaborator

为了避免误解补充一下:

在不能自动获取cookie的情况时,依然可以参考下面的文档手动获取cookie后运行:
https://github.com/dataabc/weiboSpider/blob/master/docs/cookie.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 新需求
Projects
None yet
Development

No branches or pull requests

3 participants