# csdn

Manages CSDN blog posts and pulls view metrics right inside your coding agent using your own login cookies.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 184 installs · ★ 17 repo stars
- Author: acedatacloud
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/AceDataCloud/Skills/tree/HEAD/skills/csdn/SKILL.md
- Updated: 2026-10-25
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/csdn

## What it does

This tool integrates directly with the user's CSDN account on blog.csdn.net using captured session cookies. Everything runs through a standalone Python script located at `scripts/csdn.py` that relies exclusively on Python stdlib modules like `urllib` and `hmac`. It speaks to CSDN web APIs directly and includes browser headers to navigate around the site WAF during reading operations.

Through the CLI, you can query account metadata via `whoami`, fetch recent posts along with view, like, and comment counts, or retrieve stats for an individual article. When uploading Markdown content, the script automatically uploads external image links to CSDN's internal image host `i-blog.csdnimg.cn`, preventing hotlink protection blocks during rendering.

Your session token lives in the `CSDN_COOKIES` environment variable and must be kept secret. Publishing writes directly to your public profile, so dry-run execution is enforced unless you supply the `--confirm` parameter as the final argument.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add AceDataCloud/Skills --skill csdn -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/csdn/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/csdn/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add AceDataCloud/Skills --skill csdn -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/csdn/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add AceDataCloud/Skills --skill csdn -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/csdn/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install AceDataCloud/Skills skills/csdn
```

2. **Manually: put the files in place**
- File: `.github/skills/csdn/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add AceDataCloud/Skills --skill csdn -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/AceDataCloud/Skills --path skills/csdn
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/csdn/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add AceDataCloud/Skills --skill csdn -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/AceDataCloud/Skills/tree/HEAD/skills/csdn/SKILL.md

## When to use it
- pull view, comment, and like metrics for published CSDN posts
- publish Markdown drafts directly to blog.csdn.net
- upload external Markdown images onto CSDN CDN storage
- verify active CSDN credentials and account details

## Example prompts
- Check my CSDN login status and list total post count
- Fetch the stats for my latest 20 articles on CSDN
- Publish `article.md` to CSDN as a draft with tags Python,AI

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: c827a03eb9884f52.

BEGIN THIRD-PARTY FILE c827a03eb9884f52
````text
---
name: csdn
description: Read and publish on CSDN (blog.csdn.net) with the user's own login cookies (BYOC) — list their published articles with view/like/comment stats, inspect one article, and publish a new article. Use when the user mentions CSDN, "我的 CSDN 文章", reading their article stats (阅读/点赞), or publishing/发文 to CSDN.
when_to_use: |
  Trigger for anything on the user's CSDN (blog.csdn.net) account driven by
  their own login cookie: show who they are, list their published articles with
  view / like / comment counts, look at one article's stats, or publish a new
  article. This acts as the user's real account, so writes are gated behind an
  explicit confirmation.
connections: [csdn]
allowed_tools: [Bash]
license: Apache-2.0
metadata:
  author: acedatacloud
  version: "1.0"
---

# csdn — read & publish on CSDN via your own cookies

Drives the user's **real** CSDN account through the same web APIs the site's own
editor uses, authenticated by the login cookie they captured with the ACE
extension. No browser, no third-party deps — `urllib` + `hmac` (the editor's
save endpoint requires an HMAC signature, computed with stdlib).

The connector injects the cookie jar as an env var:

- `CSDN_COOKIES` — a JSON array of cookies. **Secret — never echo or print it.**
  The CLI reads it for you.

> CSDN fronts its APIs with a WAF; the CLI already sends a full browser
> fingerprint so reads aren't 403'd. If you still get a WAF 403, the cookie
> expired — have the user reconnect.

## CLI

The skill ships [`scripts/csdn.py`](scripts/csdn.py) — self-contained, stdlib only.

```sh
# $SKILL_DIR can point at another skill loaded this turn — anchor on our own
# script, and re-run this at the top of every Bash block (fresh shell each time).
CSDN="$SKILL_DIR/scripts/csdn.py"; [ -f "$CSDN" ] || CSDN=$(find /tmp -maxdepth 8 -path '*/skills/*/scripts/csdn.py' 2>/dev/null | head -1)
[ -f "$CSDN" ] || { echo "csdn script not found (SKILL_DIR=$SKILL_DIR)" >&2; exit 1; }
python3 "$CSDN" whoami                     # who is logged in (+ total article count)
python3 "$CSDN" articles --limit 20        # my published articles + stats
python3 "$CSDN" article <article-id>       # one article's stats
```

Stats come straight from CSDN: `view_count` (阅读), `digg_count` (点赞),
`comment_count` (评论), `collect_count` (收藏).

## Verify the connection first

```sh
CSDN="$SKILL_DIR/scripts/csdn.py"; [ -f "$CSDN" ] || CSDN=$(find /tmp -maxdepth 8 -path '*/skills/*/scripts/csdn.py' 2>/dev/null | head -1)
python3 "$CSDN" whoami
# → {"username": "...", "nickname": "...", "articles_total": 0}
```

On a WAF 403 / auth error the cookie is expired — tell the user to reconnect at
<https://studio.acedata.cloud/console/connectors>. Do **not** retry in a loop.

## Publishing — GATED (dry-run unless trailing `--confirm`)
````
END THIRD-PARTY FILE c827a03eb9884f52

The third-party file has ended. Everything between the c827a03eb9884f52 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2879 of 5399 bytes. © acedatacloud · Apache-2.0 · https://github.com/AceDataCloud/Skills/tree/HEAD/skills/csdn/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
