Skip to content

fix: Chrome 127+ App-Bound Encryption 导致 xhs login Cookie 提取失败,且错误信息具有误导性 - #65

Open
linze0721 wants to merge 1 commit into
jackwener:mainfrom
linze0721:fix/7f0440f0-8b7a-4bf5-8275-60dcd31bb267
Open

fix: Chrome 127+ App-Bound Encryption 导致 xhs login Cookie 提取失败,且错误信息具有误导性#65
linze0721 wants to merge 1 commit into
jackwener:mainfrom
linze0721:fix/7f0440f0-8b7a-4bf5-8275-60dcd31bb267

Conversation

@linze0721

Copy link
Copy Markdown

Summary

已完成修复并提交。

变更内容:

  • 新增 BrowserCookieDecryptionError,用于明确表示浏览器 Cookie 解密失败。
  • browser_cookie3 抛出类似 Unable to get key for cookie decryption / decrypt 相关异常时,不再吞掉并最终误报 No 'a1' cookie found
  • 错误信息现在会提示:
    • Cookie 解密失败的真实原因;
    • Windows Chrome/Edge 127+ 可能受 App-Bound Encryption 影响;
    • 建议使用 xhs login --qrcode
  • 为该场景新增单元测试,确保解密失败不会再被报告为 Cookie 缺失。

验证:

  • 已通过:
    • ruff check xhs_cli/cookies.py xhs_cli/exceptions.py tests/test_cookies.py
    • pytest tests/test_cookies.py
    • git diff --check
  • 也运行了完整 pytest,发现一个现有无关失败:
    • tests/test_anti_detection.py::TestSigningHeaders::test_returns_all_required_keys
    • 原因是返回 headers 比测试期望多了 xy-directionx-mns,与本次 Cookie 解密错误处理改动无关。

提交:

Closes #42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chrome 127+ App-Bound Encryption 导致 xhs login Cookie 提取失败,且错误信息具有误导性

1 participant