← 返回 Skills 市场
109
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install toutiao-publish-skill
功能描述
头条号文章自动发布助手。用户给关键词,自动生成文章并发布到头条号。触发场景:(1) 用户要求发布文章到头条/今日头条,(2) 用户要求自动发布内容,(3) 用户给关键词要求写文章并发布。核心能力:登录头条号、填写标题正文、上传封面、发布文章。
使用说明 (SKILL.md)
头条号文章自动发布
工具选择策略
| 场景 | 工具 | 原因 |
|---|---|---|
| 登录/导航/填写标题正文/点击按钮 | OpenClaw browser | snapshot/act/evaluate 全可用 |
| 上传封面图 | puppeteer-core | browser upload 受目录限制,evaluate 受浏览器安全策略限制 |
| 验证发布结果 | puppeteer-core | 需监听 API 响应 |
关键结论:
- ✅ 默认用 browser 工具
- ⚠️ 唯一例外:文件上传用 puppeteer-core
- 💡 两者共享 CDP 端口 28800
发布流程(7步)
第1步:登录头条号
- 打开发布页 → 自动跳转登录页
- 切换到"账密登录"(默认是验证码模式)
- 填写手机号密码(必须用 nativeInputValueSetter)
- 勾选协议 → 点击登录
React 表单正确填写方式:
// 必须用 evaluate + nativeInputValueSetter
browser action=act kind=evaluate fn="() => {
const el = document.querySelector('input[placeholder*=\"手机号\"]');
const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
setter.call(el, '手机号');
el.dispatchEvent(new Event('input', { bubbles: true }));
return 'filled';
}"
第2步:导航到发布页
# browser action=open 会被 SSRF 策略拦截,直接用 puppeteer-core 脚本导航
node scripts/nav-publish.js
第3步:生成内容
根据关键词生成:
- 标题:20-30字,吸引眼球
- 正文:500-800字,分段清晰
第4步:填写标题
browser action=act kind=evaluate fn="() => {
const el = document.querySelector('.editor-title textarea');
const setter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value').set;
setter.call(el, '标题内容');
el.dispatchEvent(new Event('input', { bubbles: true }));
return 'title filled';
}"
第5步:填写正文
// 先聚焦
browser action=act kind=evaluate fn="() => {
const el = document.querySelector('.ProseMirror');
el.click(); el.focus();
return 'focused';
}"
// 再输入
browser action=act kind=type selector=".ProseMirror" text="正文内容..."
⚠️ 绝对不要用 innerHTML! ProseMirror 只认键盘输入
第6步:上传封面
6a. 生成封面图
// 用 Pollinations.AI 生成(下载为 .jpg)
const url = 'https://image.pollinations.ai/prompt/{英文描述}?width=800&height=600&nologo=true';
// Node.js https.get 下载到本地
6b. 选择"单图"模式
browser action=act kind=evaluate fn="() => {
// 滚动到封面区域并点击"单图"
const el = document.querySelector('.article-cover');
el?.scrollIntoView({ behavior: 'instant', block: 'center' });
// 遍历文本节点找"单图"并点击
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);
let node;
while (node = walker.nextNode()) {
if (node.textContent.trim() === '单图') {
node.parentElement?.click();
break;
}
}
return 'selected';
}"
6c. 上传封面(必须用 puppeteer-core)
// 1. 点击上传区域
browser action=act kind=evaluate fn="() => {
document.querySelector('.article-cover-add')?.click();
return 'clicked';
}"
// 2. 等2秒后用 puppeteer-core 上传
const fileInputs = await page.$$('input[type="file"]');
await fileInputs[0].uploadFile(coverPath); // 本地绝对路径
// 3. 等5秒后点"确定"
await page.evaluate(() => {
const btn = Array.from(document.querySelectorAll('button'))
.find(b => b.textContent?.trim() === '确定');
btn?.click();
});
使用 scripts/upload-cover.js 脚本:
node scripts/upload-cover.js
第7步:发布
7a. 点击"预览并发布"
browser action=act kind=evaluate fn="() => {
const btn = Array.from(document.querySelectorAll('button'))
.find(b => b.textContent?.trim() === '预览并发布');
btn?.click();
return 'clicked';
}"
7b. 点击"确认发布"(二次弹窗)
⚠️ 头条现在有二次确认弹窗!必须点"确认发布"才能真正发布
browser action=act kind=evaluate fn="() => {
const btn = Array.from(document.querySelectorAll('button'))
.find(b => b.textContent?.trim() === '确认发布');
btn?.click();
return 'clicked confirm';
}"
7c. 验证发布成功
页面跳转到文章列表页(URL 包含 /articles),文章出现在列表第一条。
常见陷阱
| 陷阱 | 解决方案 |
|---|---|
| React 表单值丢失 | 必须用 nativeInputValueSetter + dispatchEvent |
| 登录页找不到密码框 | 先切换到"账密登录"模式 |
| 封面上传失败 | 必须用 puppeteer-core 的 uploadFile() |
| 点发布无反应 | 先点"预览并发布"→ 等6秒 → 点"确认发布" |
| ProseMirror 显示空白 | 必须用 keyboard.type,不能用 innerHTML |
浏览器环境
- Chrome CDP 端口:28800
- 连接地址:
http://127.0.0.1:28800
详细文档
完整规则、失败原因排查、技术约束详见 references/detailed-rules.md
安全使用建议
Treat this as an incomplete review rather than a positive approval. Re-run with readable artifact files before installing or publishing.
能力评估
Purpose & Capability
Workspace inspection commands failed before metadata.json or artifact contents could be read, so purpose and capabilities could not be positively verified from artifacts.
Instruction Scope
No SKILL.md or runtime instructions were available for review due the read failure; no unsupported instruction-scope concern is reported.
Install Mechanism
Install specs and file manifest could not be inspected; there is no artifact evidence of an unsafe install mechanism in the provided prompt.
Credentials
Environment access could not be assessed from artifact files because the workspace was not readable through the available shell tool.
Persistence & Privilege
No artifact evidence of persistence, privilege escalation, credentials, or background behavior was available in the prompt, and local artifact inspection failed.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install toutiao-publish-skill - 安装完成后,直接呼叫该 Skill 的名称或使用
/toutiao-publish-skill触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
toutiao-publish-skill 1.0.1
- Added a comprehensive SKILL.md with tool selection strategies, step-by-step publishing workflow, technical tips, and troubleshooting guidance.
- Clearly documents the interaction between OpenClaw browser and puppeteer-core, specifying which tool to use at each step.
- Provides code snippets for critical automation tasks such as login, content input, cover upload, and publish confirmation.
- Lists common pitfalls and solutions to ensure robust automation on Toutiao’s platform.
- Details browser environment requirements and includes references for further documentation.
v1.0.0
toutiao-publish-skill v1.0.0
- Initial release: 自动生成并发布头条号文章的助手,支持关键词生成、登录、内容填写、封面上传及发布全流程。
- 详细描述各步骤,包括工具选型、表单正确填写、ProseMirror 编辑、封面生成与上传(puppeteer-core)、发布与验证机制。
- 详列常见陷阱及应对方案,覆盖表单、文件上传、ProseMirror 限制和发布交互等关键细节。
- 明确浏览器和工具端口配置,支持多工具协作(OpenClaw、puppeteer-core)。
- 提供全面流程和操作脚本示例。
元数据
常见问题
Toutiao Publish.Skill 是什么?
头条号文章自动发布助手。用户给关键词,自动生成文章并发布到头条号。触发场景:(1) 用户要求发布文章到头条/今日头条,(2) 用户要求自动发布内容,(3) 用户给关键词要求写文章并发布。核心能力:登录头条号、填写标题正文、上传封面、发布文章。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 109 次。
如何安装 Toutiao Publish.Skill?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install toutiao-publish-skill」即可一键安装,无需额外配置。
Toutiao Publish.Skill 是免费的吗?
是的,Toutiao Publish.Skill 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Toutiao Publish.Skill 支持哪些平台?
Toutiao Publish.Skill 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Toutiao Publish.Skill?
由 verifier(@liuxucai)开发并维护,当前版本 v1.0.1。
推荐 Skills