Skip to content
Agentmart
Submit a tool

csdn-upload

通过 Playwright + 直连 API(X-Ca HMAC-SHA256 签名)将本地博文批量上传到 CSDN 草稿箱。三态管理:未上传 → 草稿箱 → 已发布。

Skill by ricky-theseus

IndexedGPL-3.0★ 76
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/ricky-theseus-csdn-upload

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

通过 Playwright + 直连 API(X-Ca HMAC-SHA256 签名)将本地博文批量上传到 CSDN 草稿箱。三态管理:未上传 → 草稿箱 → 已发布。

Use cases: backend, testing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/csdn-upload

Tools it pre-approves 5

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Read
  • Write
  • Grep
  • Bash
  • Agent

What's inside

Skill name
csdn-upload
Description
通过 Playwright + 直连 API(X-Ca HMAC-SHA256 签名)将本地博文批量上传到 CSDN 草稿箱。三态管理:未上传 → 草稿箱 → 已发布。
License
GPL-3.0
Allowed tools
Read, Write, Grep, Bash, Agent
Instructions
217 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts
  • Pre-approves any shell command
  • Instructions call the network

Files (2)

  • SKILL.md
  • playwright_uploader.py · scripts/

SKILL.md (first lines)

# CSDN 草稿批量上传

## 三态管理

| 状态 | 含义 | 判定依据 |
|------|------|----------|
| **未上传** | 本地有草稿,未上传到 CSDN | 不在 `csdn_article_map.json`,不在已发表集合 |
| **草稿箱** | 已上传到 CSDN 但未发布 | `csdn_article_map.json` 中 `status: "draft"` |
| **已发布** | 已在 CSDN 公开发布 | `published.json` 中有记录,或在 `已发表/` 目录 |

数据流向:

```
未上传 ──upload──→ 草稿箱 ──manual publish──→ 已发布
                       │
                       └──sync──→ csdn_article_map.json (status→published)
```

## 使用

### 首次登录

```bash
python scripts/playwright_uploader.py --login
```

弹出浏览器 → 手动登录 CSDN → 在编辑器页面出现后关闭浏览器 → 登录态保存到 `chrome_profile/`。

### 查看状态

```bash
python scripts/playwright_uploader.py --dry-run
```

列出所有草稿的三态分布,不下发任何请求。

### 上传到草稿箱

```bash
python scripts/playwright_uploader.py
python scripts/playwright_uploader.py --no-confirm   # 跳过确认
python scripts/playwright_uploader.py --retry-failed  # 只重试上次失败的
```

使用直连 API(非 UI 操作),自动重试频率限制。

### 同步已发布状态

```bash
python scripts/playwright_uploader.py --sync
```

对比 `published.json` / `已发表/` 目录,将 `csdn_article_map.json` 中对应文章从 `draft` 标记为 `published`。

## 命令参考

| 命令 | 作用 |
|------|------|
| `--login` | 首次登录,保存浏览器状态 |
| `--dry-run` | 预览三态分布,不操作 |
| `--sync` | 同步已发表状态到映射文件 |
| `--retry-failed` | 只重试上次失败的未上传文章 |
| `--no-confirm` | 跳过确认提示直接上传 |

## 工作原理

### 架构

```
Python 脚本 ──Playwright──→ 浏览器(提供 Cookie 环境)
                │
                ├── page.evaluate(JS) 注入 HMAC 签名计算
                └── fetch() → POST bizapi.csdn.net/saveArticle
```

不使用 UI 操作(CSDN 的 Vue 3 contenteditable 编辑器不稳定且不触发 saveArticle API)。

### X-Ca 签名算法

CSDN 的 bizapi 使用阿里云 API 网关风格的四层签名:

| 参数 | 值 |
|------|-----|
| `X-Ca-Key` | `203803574` |
| `X-Ca-Secret` | `9znpamsyl2c7cdrr9sas0le9vbc3r6ba` |
| `X-Ca-Nonce` | 每次请求新生成的 UUID v4 |
| `X-Ca-Signature-Headers` | `x-ca-key,x-ca-nonce` |

签名字符串格式(HMAC-SHA256 → Base64):

```
POST\n
*/*\n
\n
application/json\n
\n
x-ca-key:{key}\n
x-ca-nonce:{nonce}\n
/path
```

签名在浏览器内用 `crypto.subtle.sign('HMAC', ...)` 计算,避免 Python 端逆向兼容问题。

### 频率限制

- 每次 POST 后至少等待 **10 秒**
- 触发频率限制后重试,退避策略:10s → 20s → 失败(最多 3 次)
- 连续多发容易触发 CSDN 的"请求太过频繁"防护

## 输入源

- 递归搜索 `博文/**/草稿/*.md`
- 每篇博文要求(技术博文规范):
  - 最低 800 中文字符(不含代码块/Mermaid)
  - 含 Mermaid 图
  - 标题、分类、标签等元信息上传时由脚本构造

## 状态存储

From ricky-theseus/DaisyWriter, GPL-3.0.

More from ricky-theseus/DaisyWriter

Signals

Stars
76
Forks
5
Open issues
0
Last commit (this folder)
Jun 28, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
GPL-3.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ricky-theseus

Cite this page

csdn-upload skill. Agent Mart. https://agentmart.dev/skills/ricky-theseus-csdn-upload (last updated 2026-10-24)