Files
2026-06-15 10:06:03 +08:00

62 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# xueqiu_sync — 雪球 Cookie 复制 Chrome 扩展
把本地 Chrome 里 xueqiu.com 的 HttpOnly Cookie 读出来,一键复制成你需要的格式。
**不依赖任何后端 / 数据库 / Python**
## 为什么不做成自动化
浏览器扩展**不能**直接连 PostgreSQL / MySQL(沙箱限制:无 DB 驱动、禁裸 TCP、暴露凭据)。
所以这版只做"读 cookie + 复制到剪贴板",你粘到哪里由你决定。
## 准备
- Chrome / Edge / 其他 Chromium 内核浏览器
- 一次:在浏览器里登录过 [xueqiu.com](https://xueqiu.com/)(让 cookie 落到本地)
## 安装(开发模式,30 秒)
1. 打开 `chrome://extensions/`
2. 右上角打开「**开发者模式**」
3. 点「**加载已解压的扩展程序**」
4. 选这个目录的 `chrome-extension/` 子目录:
```
/home/gao/Development/quant_home/xueqiu_sync/chrome-extension/
```
5. 工具栏会出现一个 ❄ 雪花图标
## 使用
1. 浏览器登录过 xueqiu.com 后,点工具栏的 ❄ 图标
2. 弹窗会**自动**读出 `xq_a_token` 和 `u`(含 HttpOnly
3. 选一个复制按钮:
| 按钮 | 复制内容 | 用在 |
|---|---|---|
| **复制组合字符串** | `xq_a_token=xxx;u=yyy` | dashboard 的 `POST /api/data/datasource/xueqiu-cookie`、`market_sync` 的 `XUEQIU_TOKEN` 字段值 |
| **复制 .env 行** | `XUEQIU_TOKEN=xq_a_token=xxx;u=yyy` | 直接粘到 `market_sync/.env` |
| **仅 xq_a_token** | `xxx` | 单独使用场景 |
## 改代码
`chrome://extensions/` → 找到本扩展 → 点 ↻ 重新加载。
## 目录结构
```
xueqiu_sync/
├── README.md
├── .gitignore
└── chrome-extension/
├── manifest.json
├── popup.html
├── popup.js
└── icons/
├── icon16.png
├── icon48.png
└── icon128.png
```
## License
私有