zhihu-auto-publisher
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "zhihu-auto-publisher" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-b200dd482b1cf0af14e0e2a9bc6176f38f6904fb2c8dfc08ef15829e0ac41a93. Verify the upstream source and version against https://skillhub.cn/skills/user_5ee3d2f0/zhihu-auto-publisher before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Zhihu auto-publish assistant: simulate human actions to automatically publish answers and articles to Zhihu drafts. Supports Chrome, Edge, and Firefox and automatically detects and selects the best available browser. Uses Playwright to simulate real keyboard and mouse actions (clicking, typing, pasting). All operations save only to drafts for user review and manual publishing; can integrate with a “Zhihu content topic assistant” to share login state and topic data, supporting a workflow from topic selection to writing to draft publishing.
Introduction source: third_party · user_5ee3d2f0 · 1.1.0 Reference
SkillPi interpretation
- Software, accounts and paid services
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: zhihu-auto-publisher
version: 1.1.0
author: wuwei (xiaoyi)
description: >-
知乎自动发布助手 —— 在知乎上模拟人工操作自动发布回答和文章到草稿箱。
支持 Chrome / Edge / Firefox 三大浏览器,自动检测并选择最佳可用浏览器。
使用 Playwright 模拟真实键盘鼠标操作(点击、输入、粘贴),所有操作仅保存草稿,由用户手动审核发布。
可与「知乎内容选题助手」联动,共享登录态和选题数据,实现选题→写稿→发布的完整工作流。
tags:
- 知乎
- 自动化
- 内容创作
- 浏览器自动化
- Playwright
trigger:
- 发布知乎回答
- 发布知乎文章
- 知乎自动发布
- 知乎草稿
- 写知乎回答
- 写知乎文章
- 自动回答知乎
- 保存知乎草稿
dependencies:
- python: ">=3.10"
- pip: ["playwright"]
- playwright-browsers: ["chromium", "firefox"]
- system-browsers: "Chrome / Edge / Firefox (任一即可)"Zhihu Auto Publisher — 知乎自动发布助手
在知乎上自动完成回答和文章的草稿保存,全程模拟人工键盘鼠标操作。 只保存草稿,不发布。 用户手动审核后自行决定是否发布。
兼容浏览器
| 浏览器 | 类型 | 说明 |
|---|---|---|
| Google Chrome | 系统安装 | 自动检测,优先使用 |
| Microsoft Edge | 系统安装 | 自动检测 |
| Mozilla Firefox | 系统安装 | 自动检测 |
| Chromium | Playwright 内置 | 兜底浏览器(无需系统安装) |
自动选择逻辑:系统默认浏览器 > Chrome > Edge > Firefox > Chromium
可通过环境变量指定:
set ZHIHU_BROWSER=firefox
运行环境
首次使用前运行安装脚本:
python scripts/setup.py
安装过程:
- 安装
playwrightPython 包 - 下载 Chromium + Firefox(Playwright 内置)
- 自动检测系统已安装的 Chrome / Edge / Firefox
- 创建所需目录
推荐使用专用 venv(已预装依赖):
- 或任何安装了
playwright+chromium的 Python 3.10+ 环境
工作原则
- 使用 Playwright 控制浏览器,模拟真实人工操作(随机延迟、逐字输入、鼠标移动)。
- 所有发布操作只到"保存草稿"为止,绝不点击发布/提交按钮。
- Cookie 优先从"知乎内容选题助手"共享的
config/fallback-sources.json获取;若不存在或过期,引导用户重新登录获取。 - 发布内容由用户提供(文件路径或直接文本),不自行生成。
- 操作过程中每一步都截图反馈,让用户清楚看到进度。
一、Cookie 管理
1.1 Cookie 获取优先级
- 共享 Cookie:读取
~/.workbuddy/skills/zhihu-content-selection/config/fallback-sources.json中的cookie字段 - 自动提取:运行
python scripts/cookie_manager.py extract从 Chrome/Edge 浏览器配置文件中自动提取 - 手动粘贴:引导用户从浏览器 DevTools 复制 Cookie
1.2 Cookie 检测与引导流程
执行发布操作前,必须检测 Cookie 是否有效:
python scripts/check_login.py
如果检测到未登录或 Cookie 过期:
- 告诉用户:"请先在 Chrome 或 Edge 浏览器中打开 https://www.zhihu.com 并扫码登录"
- 等待用户确认登录完成
- 运行
python scripts/cookie_manager.py extract自动提取 Cookie - 如果自动提取失败,引导用户手动复制:
- 在知乎页面按 F12 打开开发者工具
- 点击 Network(网络) 标签
- 按 F5 刷新页面
- 点一个
api.zhihu.com开头的请求 - 右侧 Request Headers → 找到
Cookie:行 - 双击 Cookie 值 → Ctrl+A → Ctrl+C
- 把复制的 Cookie 发给我
- 收到 Cookie 后运行
python scripts/cookie_manager.py save "<cookie>"保存
1.3 Cookie 共享
保存成功后,自动同步到"知乎内容选题助手"的配置:
python scripts/cookie_manager.py share
二、回答发布流程
触发条件
用户提供问题链接(如 https://www.zhihu.com/question/1890153384096555048)和回答内容。
执行步骤
所有步骤通过 Playwright 完成,模拟人工操作:
1. 确认 Cookie 有效(运行 check_login.py)
2. 用 Playwright 打开问题链接
3. 等待页面加载完成
4. ★ 检测是否存在「编辑回答」按钮 → 如果存在,说明该问题已回答过,返回提示并退出
5. 定位并点击「写回答」按钮
6. 等待编辑器加载
7. 将内容逐段粘贴到编辑器中(模拟人工输入节奏)
8. 点击「保存草稿」按钮
9. 确认草稿保存成功
10. 截图反馈给用户
11. 告诉用户:"草稿已保存,请在浏览器中查看并决定是否发布"
已回答检测(v1.1.0)
发布前自动检测页面上是否存在「编辑回答」或「修改回答」按钮。 如果存在,说明该问题之前已经写过回答,不会再重复发布。 返回信息:
[INFO] 该问题之前已写回答,无需重复发布。
问题链接: https://www.zhihu.com/question/xxx
请前往链接手动编辑已有回答。
命令
python scripts/publish_answer.py \
--url "https://www.zhihu.com/question/1890153384096555048" \
--content "E:\path\to\answer.txt"
或者直接传入文本:
python scripts/publish_answer.py \
--url "https://www.zhihu.com/question/1890153384096555048" \
--text "这是回答内容..."
人工模拟细节
- 点击前鼠标先移动到按钮位置(模拟鼠标轨迹)
- 输入时逐段粘贴,段落间随机停顿 1-3 秒
- 不会一次性全选粘贴(避免触发反爬检测)
- 遇到弹窗/验证码时截图告知用户处理
三、文章发布流程
触发条件
用户要求发布知乎文章,需提供标题和正文内容。
执行步骤
1. 确认 Cookie 有效
2. 用 Playwright 打开 https://www.zhihu.com/
3. 确认页面已登录(检查头像/昵称元素)
4. 定位并点击「写文章」按钮
5. 等待文章编辑器加载
6. 在标题区域输入标题
7. 在正文区域逐段粘贴内容
8. 等待内容渲染完成
9. 点击「保存草稿」
10. 确认保存成功
11. 截图反馈
12. 告诉用户草稿已保存
命令
python scripts/publish_article.py \
--title "文章标题" \
--content "E:\path\to\article.txt"
四、与"知乎内容选题助手"联动
4.1 Cookie 共享
两个技能使用同一份 Cookie 配置:
- 存储位置:
~/.workbuddy/skills/zhihu-content-selection/config/fallback-sources.json - 本技能的
cookie_manager.py share命令会将 Cookie 写入该位置 - "知乎内容选题助手"的
auto_cookie.js提取的 Cookie 也存同一位置 - 任一方获取的 Cookie 另一方都能直接使用
4.2 问题链接传递
"知乎内容选题助手"数据库中 questions 表的 url 字段可直接作为本技能的回答发布链接:
# 从选题助手获取问题链接
python ~/.workbuddy/skills/zhihu-content-selection/scripts/query.py questions recommend --limit 5
# 将链接传给自动发布
python scripts/publish_answer.py --url "<获得的链接>" --content "content.txt"
工作流示例:
- 用"知乎内容选题助手"选取热点问题
- 在本地写好回答草稿
- 用本技能自动发布到知乎草稿箱
- 登录知乎查看草稿,决定是否发布
五、错误处理
| 错误 | 处理方式 |
|---|---|
| Cookie 过期 / 未登录 | 引导用户重新登录,重新提取 Cookie |
| 找不到「写回答」按钮 | 截图发给用户确认页面状态 |
| 编辑器加载超时 | 等待最多 30 秒,超时后截图告知 |
| 保存草稿失败 | 检查是否有"草稿已保存"提示,截图告知 |
| 验证码 / 滑块 | 截图告知用户,等待用户手动处理后继续 |
| 弹窗遮挡 | 尝试关闭弹窗,失败则截图告知 |
| 网络超时 | 重试一次,仍失败则停止 |
六、文件结构
zhihu-auto-publisher/
├── SKILL.md # 本文档
├── scripts/
│ ├── setup.py # 环境安装(首次使用)
│ ├── cookie_manager.py # Cookie 提取、保存、共享
│ ├── check_login.py # 登录状态检测
│ ├── publish_answer.py # 回答发布脚本
│ ├── publish_article.py # 文章发布脚本
│ └── browser_utils.py # Playwright 浏览器工具函数
├── config/
│ └── settings.json # 本技能配置(Cookie 路径等)
├── drafts/ # 本地草稿备份
└── references/
└── setup.md # 详细安装说明
七、安全原则
- 只保存草稿,不发布 — 所有操作终点是"保存草稿"按钮
- Cookie 仅本地存储 — 不上传到任何远程服务器
- 内容由用户提供 — 不自行生成或修改发布内容
- 操作过程全透明 — 每步截图反馈
- 合法合规 — 拒绝发布违法违规内容
八、版本历史
| 版本 | 日期 | 变更 |
|---|---|---|
| 1.1.0 | 2026-06-29 | 新增已回答检测:发布前检查页面上是否存在「编辑回答」按钮,如已回答过则跳过并返回链接 |
| 1.0.0 | 2026-06-29 | 首次发布:Cookie 管理、回答发布、文章发布、Chrome/Edge/Firefox 三浏览器兼容 |
Current listing version
1.1.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决知乎内容创作者高频刚需:自动化发布草稿,显著提升效率
- 支持多浏览器自动检测与选择,兼容性强
- 与「知乎内容选题助手」联动,实现选题→写稿→发布的完整工作流
Highlights
- 触发词覆盖全面:发布知乎回答、发布知乎文章、知乎自动发布等
- 边界清晰,不易与其他 Skill 重叠
Highlights
- 结构清晰:分 Cookie 管理、回答发布、文章发布、联动等模块
- 步骤详细,含端到端示例和命令
- frontmatter 完整,文档规范
Highlights
- 工具来源明确:Playwright + 系统浏览器
- 参数正确,覆盖主要异常(Cookie 过期、编辑器加载超时、验证码等)
- 不可逆操作有确认机制:只保存草稿,不发布
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- www.zhihu.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.