← Back to Skills Marketplace
liuboacean

知乎自动化 Skill

by liuboacean · GitHub ↗ · v2.0.2 · MIT-0
cross-platform ⚠ suspicious
34
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install zhihu-automation
Description
知乎自动化 Skill(双通道)。发布文章(专栏)、发布想法、回答问题、提问、 互动(点赞/评论/关注)、数据提取(热榜/搜索/用户/问题)。使用 Playwright 浏览器自动化 + HTTP API 双通道,Cookie 持久化登录。 Trigger phrases: - "帮我发一篇知乎文章" / "写知...
README (SKILL.md)

知乎自动化 Skill (Zhihu Automation v2.0)

双通道架构:HTTP 读(热榜/搜索/用户/问题)+ 浏览器写(发布/互动)。


快速开始

1. 安装依赖

# 依赖已安装,如首次使用:
cd zhihu-skill
npm install
npx playwright install chromium

2. 配置 Cookie 加密密钥

export ZHIHU_COOKIE_KEY="$(openssl rand -hex 32)"

3. 导出知乎 Cookie

# 会自动打开浏览器,手动登录后 Cookie 自动加密保存
node scripts/zhihu-export-cookie.js

4. 验证

# 检查 Cookie 是否有效
node tests/cookie-check.js

功能模块

1️⃣ 发布文章

在知乎专栏发布 Markdown 文章。

你: 帮我发一篇知乎文章,标题是"xxx",内容是...
AI: 正在生成内容 → 打开编辑器 → 发布 → 返回链接

CLI:

# 直接指定内容
node scripts/zhihu-publish.js article --title "标题" --content "正文"

# 从文件读取内容
node scripts/zhihu-publish.js article --title "标题" --content-file "文章.md"

# 保存为草稿(不发布)
node scripts/zhihu-publish.js article --title "标题" --content "正文" --draft

2️⃣ 发布想法

类似 Twitter 的短内容发布。

你: 发一条知乎想法,内容是xxx

CLI:

node scripts/zhihu-publish.js thought --content "想法内容"

# 带图片
node scripts/zhihu-publish.js thought --content "想法内容" --image "图片路径"

3️⃣ 回答问题

搜索问题并撰写回答。

你: 帮我在知乎搜索关于xxx的问题并回答
AI: 搜索问题 → 列出选项 → 用户选择 → 撰写 → 提交

CLI:

node scripts/zhihu-answer.js --question-id 123456789 --content "回答内容"

4️⃣ 提问

在知乎上提出新问题。

你: 帮我在知乎提问:xxx
AI: 打开提问页 → 填写标题 → 补充详情 → 提交

CLI:

node scripts/zhihu-ask.js --title "问题标题" --detail "补充说明"

5️⃣ 互动

点赞、评论、关注。

你: 给这篇知乎文章点赞 / 评论 / 关注这个用户

CLI:

# 点赞
node scripts/zhihu-interact.js like --url "https://www.zhihu.com/question/xxx/answer/xxx"

# 取消点赞
node scripts/zhihu-interact.js unlike --url "..."

# 评论
node scripts/zhihu-interact.js comment --url "..." --content "评论内容"

# 关注用户
node scripts/zhihu-interact.js follow --user "用户ID"

6️⃣ 数据提取

从知乎提取结构化数据。

你: 今天知乎热榜是什么?
AI: 返回热榜 Top 20

CLI:

# 热榜
node scripts/zhihu-extract.js --type hot-list [--limit 20]

# 搜索
node scripts/zhihu-extract.js --type search --query "关键词" [--limit 10]

# 文章详情
node scripts/zhihu-extract.js --type article --id "文章ID"

# 用户信息
node scripts/zhihu-extract.js --type user --id "用户ID"

# 问题详情
node scripts/zhihu-extract.js --type question --id "问题ID"

# 回答列表
node scripts/zhihu-extract.js --type answers --id "问题ID" [--limit 10]

架构

                   AI Agent(用户自然语言触发)
                           │
                  ┌────────▼────────┐
                  │  Skill 调度层    │
                  │  SKILL.md → 路由  │
                  └────────┬────────┘
                           │
                  ┌────────▼────────┐
                  │  双通道决策      │
                  │  读操作→HTTP    │
                  │  写操作→浏览器  │
                  └────────┬────────┘
                           │
              ┌────────────┼────────────┐
              │            │            │
    ┌─────────▼─────┐ ┌───▼────┐ ┌─────▼─────────┐
    │ HTTP 通道     │ │ 浏览器  │ │ Python        │
    │ zhihu-http.js │ │ 通道   │ │ OpenAPI       │
    │ zhihu-extract │ │ 自动化  │ │ zhihu_bot.py  │
    │ zhihu-signature│ │ publish│ │ zhihu-bridge  │
    └───────────────┘ │ interact│ └───────────────┘
                      │ answer  │
                      │ ask     │
                      └─────────┘

安全

  • Cookie 使用 AES-256-GCM 加密存储(权限 0600)
  • 环境变量 ZHIHU_COOKIE_KEY 管理加密密钥
  • 支持密钥轮换(rotateCookieKey

Cookie 加密格式

~/.hermes/credentials/zhihu-cookies.enc
├── [12 bytes: 随机 IV]
├── [16 bytes: GCM 认证标签]
└── [AES-256-GCM 加密的 Cookie 数据]

环境变量

变量 必填 说明
ZHIHU_COOKIE_KEY Cookie 加密密钥(openssl rand -hex 32 生成)
ZHIHU_APP_KEY 知乎 OpenAPI app_key(圈子互动)
ZHIHU_APP_SECRET 知乎 OpenAPI app_secret
ZHIHU_PROXY 代理地址(反爬场景)
CAPTCHA_API_KEY 打码平台 Key

测试

# 选择器冒烟测试
node tests/smoke-test.js

# Cookie 到期检测
node tests/cookie-check.js

# 端到端集成测试(沙箱模式)
ZHIHU_TEST_MODE=sandbox node tests/e2e-test.js

注意事项

  • ⚠️ 频率控制:HTTP 200-500ms 间隔,浏览器 5-10s 间隔
  • ⚠️ Cookie 有效期:约 30 天,到期需重新登录导出
  • ⚠️ 知乎改版config/selectors.json 可能需更新
  • ⚠️ 签名失效自动降级:C3b 失败自动切换 Plan B(浏览器通道)
  • ⚠️ 浏览器崩溃恢复:withCrashRecovery 自动重建会话
Usage Guidance
Install only if you are comfortable letting the agent operate your Zhihu account. Use a test or secondary account first, keep ZHIHU_COOKIE_KEY private, remove or rotate the saved cookie when finished, and require manual confirmation before any post, answer, question, comment, like, or follow is submitted.
Capability Tags
cryptorequires-sensitive-credentials
Capability Assessment
Purpose & Capability
The artifacts coherently match the stated Zhihu automation purpose, but the purpose includes high-impact public account actions: publishing articles/thoughts, answering, asking questions, liking, commenting, and following.
Instruction Scope
The documented flows and code submit public content once invoked, but they do not consistently require a final user confirmation or draft-first workflow before posting.
Install Mechanism
The registry says there is no install spec and no required binaries/env vars, while the skill documentation requires npm, Playwright, Python, and a cookie encryption key; this appears disclosed in SKILL.md/_meta.json but under-declared in registry metadata.
Credentials
Persistent Zhihu cookies, optional OpenAPI secrets, proxy/captcha settings, browser automation, and public account mutation are proportionate to the purpose but sensitive enough that users should review scope carefully.
Persistence & Privilege
The skill stores an encrypted long-lived Zhihu cookie and reuses browser sessions, which grants continuing account authority until the cookie/key is removed or rotated.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install zhihu-automation
  3. After installation, invoke the skill by name or use /zhihu-automation
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v2.0.2
v2.0.2 Phase A+B: 文章发布提速1000x, navigateTo稳定性, 放弃HTTP签名通道(浏览器通道兜底)
v2.0.1
v2.0.1 P0/P1/P2 完善: MIT LICENSE, CI, 社区文档, 测试充实, .github 模板, Security Policy, 分支 main
v2.0.0
v2.0.0 完整发布
Metadata
Slug zhihu-automation
Version 2.0.2
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is 知乎自动化 Skill?

知乎自动化 Skill(双通道)。发布文章(专栏)、发布想法、回答问题、提问、 互动(点赞/评论/关注)、数据提取(热榜/搜索/用户/问题)。使用 Playwright 浏览器自动化 + HTTP API 双通道,Cookie 持久化登录。 Trigger phrases: - "帮我发一篇知乎文章" / "写知... It is an AI Agent Skill for Claude Code / OpenClaw, with 34 downloads so far.

How do I install 知乎自动化 Skill?

Run "/install zhihu-automation" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 知乎自动化 Skill free?

Yes, 知乎自动化 Skill is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 知乎自动化 Skill support?

知乎自动化 Skill is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 知乎自动化 Skill?

It is built and maintained by liuboacean (@liuboacean); the current version is v2.0.2.

💬 Comments