jackwener / jackwener/xiaohongshu-cli
建议:支持 --user-data-dir 参数指定 Chrome Profile 路径
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 272
- PR merge metrics
- No merged PRs in 30d
Description
## 背景
通过浏览器 Cookies 实现登录是最便捷的方式,但目前 `xiaohongshu-cli` 仅支持从系统默认路径读取 Chrome cookies。
## 需求
实际使用中,用户可能需要从不同的 Chrome Profile 目录提取 Cookies,例如:
- 某些系统上 Chrome 无法直接读取(如容器化环境)
- 用户有多个 Chrome Profile,希望指定其中一个
- 从第三方 Chrome 封装(如 iChrome、Chrome DevTools 等)提取 cookies
## 现有方案
`browser-cookie3` 库虽然支持指定 `cookie_file` 参数,但需要手动处理各平台加密问题(macOS Keychain、Windows DPAPI、Linux SecretService),使用门槛较高。
我已提交了一个 [PR](https://github.com/borisbabic/browser_cookie3/pull/235),为 `browser-cookie3` 添加 `user_data_dir` 参数支持,但上游似乎维护不活跃,短期内不太可能合并。
## 建议
**方案:由 xhs 作者维护一个 browser-cookie3 的 fork**
考虑到 browser-cookie3 上游维护不活跃,建议 xhs 作者维护一个自己的 fork,添加 `user_data_dir` 参数支持。这样:
1. 可以确保依赖稳定,及时修复问题
2. 方便集成到 xhs-cli 的 CI/CD 中
3. 避免用户需要手动处理依赖问题
我的实现可参考:[https://github.com/weaming/browser_cookie3](https://github.com/weaming/browser_cookie3)
## 相关链接
- [browser-cookie3 PR #235](https://github.com/borisbabic/browser_cookie3/pull/235)
- [我的 browser-cookie3 fork(实现参考)](https://github.com/weaming/browser_cookie3)
---
环境变量 `XHS_USER_DATA_DIR` 或 CLI 参数 `--user-data-dir` 的实现可参考我的 xhs-cli 的 [commit history](https://github.com/weaming/xiaohongshu-cli/commits/main)。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the xhs-cli commit history linked in the issue and compare its proposed XHS_USER_DATA_DIR environment variable and --user-data-dir option. Read the referenced browser-cookie3 fork and upstream PR #235 to understand the dependency change. Done means users can select a Chrome Profile path without manually handling platform-specific cookie decryption.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100