← 返回 Skills 市场
xiaohuaishu

Feishu → XHS Publisher

作者 xiaohuaishu · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
89
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install feishu-xhs-publisher
功能描述
将飞书文档/Wiki 转换为小红书图文帖子,生成竖版图片(1242×1660)并打包成新飞书文档供用户直接发布。 支持深色科技风格(代码块高亮、macOS 窗口样式)和知识卡片风格。 触发词:发布到小红书、转小红书格式、生成小红书图片、小红书排版、xhs-publisher。 输入:飞书文档链接(docx)或 W...
使用说明 (SKILL.md)

XHS Publisher

将飞书文档转换为小红书图文帖,全流程半自动化,用户收工直接发布。

工作流程(5步,每步与用户确认)

Step 1:读取飞书文档

  • docx 链接:直接提取 doc_token,用飞书 SDK docx.document.rawContent 读取内容
  • wiki 链接:先用 wiki.space.getNode 获取 obj_token,再读文档内容
  • Wiki token 提取:https://xxx.feishu.cn/wiki/ABC123 → token = ABC123
// 飞书 SDK(在 ~/.openclaw/extensions/feishu/ 目录下运行)
const client = new Lark.Client({ appId: '...', appSecret: '...' });

// wiki → obj_token
const node = await client.wiki.space.getNode({ params: { token: wikiToken } });
const objToken = node.node.obj_token;

// 读取内容
const content = await client.docx.document.rawContent({
  path: { document_id: objToken }, params: { lang: 0 }
});

Step 2:润色成小红书风格(AI 改写)

将原文改写为小红书风格,与用户确认文案后再进行图片渲染。

改写原则:

  • 长段落 → 拆成 2-3 行短句,每段加 emoji 开头
  • 标题层级 → 🔥 小节标题 风格
  • 列表 → 👉 要点一
  • 代码块 → 保留原文,另做代码截图卡
  • 表格 → 提炼关键信息转成对比句
  • 超链接 → 去掉 URL,保留链接文字

图片分组建议(按内容长度):

  • 短文(\x3C1000字):5-7 张
  • 中等(1000-2500字):7-10 张
  • 长文(>2500字):10-12 张,可分多篇发布

每个代码块额外生成 1 张代码截图卡(深色背景 + macOS 窗口样式)。

Step 3:生成 HTML 图片并渲染

在工作目录创建 cards/ 子目录,每张图一个 HTML 文件(命名按序号:01_xxx.html)。

图片规格:1242×1660px(3:4 小红书推荐比例)

渲染命令:

python3 ~/.openclaw/workspace/skills/xhs-publisher/scripts/render_images.py \
  \x3Ccards_dir> \x3Coutput_dir>

需要 Playwright:pip3 install playwright && playwright install chromium

设计风格参考:见 references/design-styles.md,默认使用「科技蓝·深空」风格。 内容卡模板参考:见 assets/templates/example_cover.html

渲染完成后打开图片供用户确认效果再继续。

Step 4:生成正文摘要 + 标题

与用户确认以下内容再进入 Step 5:

  1. 正文摘要(500-800字,小红书风格,含 emoji)
  2. 标题备选(3 个,20字以内,带钩子)
  3. 话题标签(8-10 个 #xxx 格式)

Step 5:上传到飞书文档

飞书 SDK 所在目录:~/.openclaw/extensions/feishu/(含 @larksuiteoapi/node-sdk

上传脚本:

cd ~/.openclaw/extensions/feishu
node ~/.openclaw/workspace/skills/xhs-publisher/scripts/upload_to_feishu.cjs \
  \x3Coutput_dir> \x3Cdoc_title> [summary_md_file]

图片上传三步法(顺序不能错):

  1. 创建空图片块(documentBlockChildren.createblock_type: 27
  2. 图片块 blockId 作为 parent_node 上传图片(⚠️ 不是 docId)
  3. patch 图片块填入 file_token
// ⚠️ 关键:parent_node 用 imageBlockId,不是 docId
const insertRes = await client.docx.documentBlockChildren.create({...});
const imageBlockId = insertRes.data.children[0].block_id;  // 注意是 .data.children

const uploadRes = await client.drive.media.uploadAll({
  data: { parent_type: 'docx_image', parent_node: imageBlockId, ... }
});

await client.docx.documentBlock.patch({
  path: { document_id: docId, block_id: imageBlockId },
  data: { replace_image: { token: uploadRes.file_token } }
});

文字内容写入用 Markdown 转换法:

const convertRes = await client.docx.document.convert({
  data: { content_type: 'markdown', content: markdownText }
});
await client.docx.documentBlockDescendant.create({
  path: { document_id: docId, block_id: docId },
  data: {
    children_id: convertRes.data.first_level_block_ids,
    descendants: convertRes.data.blocks,
    index: -1
  }
});

完成后发送飞书文档链接给用户。

飞书 SDK 配置

SDK 位于 ~/.openclaw/extensions/feishu/,所有脚本在此目录运行:

const Lark = require('./node_modules/@larksuiteoapi/node-sdk');
const client = new Lark.Client({
  appId: 'cli_a9249001d9f8dcc9',
  appSecret: 'IcxmMHOYNVUGWsuI4Ikp2fjtouXEwDUf',
  domain: Lark.Domain.Feishu,
});

文档所有者 open_id:ou_966010364ecf08ba373bf29bf198a04a

常见问题

问题 原因 解法
relation mismatch upload 时 parent_node 用了 docId 改用 imageBlockId
children is undefined insertRes.children 改用 insertRes.data.children
图片不显示 patch 未执行 确保三步法完整执行
文本块写入失败 直接用 batchUpdate 创建文本块 改用 document.convert + documentBlockDescendant.create
安全使用建议
Do not run this skill as-is. The scripts and SKILL.md embed an appId/appSecret and owner open_id which will be used as defaults — meaning your converted documents/images would be uploaded to that account unless you explicitly set your own FEISHU_APP_ID, FEISHU_APP_SECRET, and FEISHU_OWNER_ID. Before installing: (1) ask the author to remove hard-coded credentials and declare required env vars in the registry; (2) if you must run it, set your own Feishu app credentials in environment variables and verify the app's permissions and owner; (3) audit the scripts locally to confirm they only call Feishu endpoints and do not exfiltrate data elsewhere; (4) consider using a throwaway document or test account first; (5) if the embedded credentials look real, avoid uploading sensitive content and consider notifying your security/contact to rotate any leaked secrets.
功能分析
Type: OpenClaw Skill Name: feishu-xhs-publisher Version: 1.0.0 The skill bundle contains hardcoded Feishu (Lark) API credentials, including an 'appId' and 'appSecret', within both SKILL.md and scripts/upload_to_feishu.cjs. While these facilitate the stated document conversion and upload functionality, hardcoding sensitive secrets is a critical security vulnerability. Furthermore, the inclusion of a specific hardcoded 'ownerId' (ou_966010364ecf08ba373bf29bf198a04a) suggests that by default, the agent may operate under or provide access to a specific external account, which is highly unusual for a general-purpose tool.
能力评估
Purpose & Capability
The skill legitimately needs Feishu API access to read and upload documents, and it includes code to render images and call the Feishu SDK — that matches the stated purpose. However, the registry declares no required environment variables or primary credential while both SKILL.md and scripts clearly depend on FEISHU app credentials. Embedding an appId/appSecret and owner open_id in SKILL.md/code is disproportionate and inconsistent with the registry metadata.
Instruction Scope
Instructions explicitly tell the agent to read Feishu docs/wiki and upload images using the Feishu SDK (expected). But SKILL.md and scripts hard-code an appId/appSecret and owner open_id and reference running code under ~/.openclaw/extensions/feishu/, meaning by default user content would be accessed and uploaded using those embedded credentials. The runtime instructions therefore permit transferring user data to an external account unless the user overrides credentials — this scope of data movement is not made explicit in the registry.
Install Mechanism
There is no formal install spec in the registry (instruction-only), but the SKILL.md and scripts require installing Playwright (and Chromium) and having the @larksuiteoapi/node-sdk present in ~/.openclaw/extensions/feishu/. That means the operator must perform manual installs which will download browser binaries; this is moderate risk but expected for HTML-to-image rendering. The main issue is lack of declared dependency metadata and instructions defaulting to use embedded credentials.
Credentials
The upload script expects FEISHU_APP_ID, FEISHU_APP_SECRET, and FEISHU_OWNER_ID (documented in the script header), but the registry lists no required env vars. Critically, the script and SKILL.md include default hard-coded values for appId/appSecret/ownerId — meaning if env vars are not set, the skill will use these embedded credentials. This is disproportionate and risky: user documents and images could be uploaded to the author/third-party Feishu account without explicit consent. Hard-coded secrets in distributed code are a severe red flag.
Persistence & Privilege
The skill does not request 'always:true' and does not modify other skills or system-wide settings. It will, however, create documents in Feishu using whichever credentials are provided (or the embedded defaults). That grants the credential holder persistent access to any uploaded content — a privacy/privilege concern if the defaults are used.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install feishu-xhs-publisher
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /feishu-xhs-publisher 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
首次发布:飞书文档/Wiki 一键转小红书图文帖。支持深色科技风格图片渲染(1242×1660)、代码块 macOS 窗口截图、自动生成正文摘要和标题备选,最终打包成飞书文档供直接发布。
元数据
Slug feishu-xhs-publisher
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Feishu → XHS Publisher 是什么?

将飞书文档/Wiki 转换为小红书图文帖子,生成竖版图片(1242×1660)并打包成新飞书文档供用户直接发布。 支持深色科技风格(代码块高亮、macOS 窗口样式)和知识卡片风格。 触发词:发布到小红书、转小红书格式、生成小红书图片、小红书排版、xhs-publisher。 输入:飞书文档链接(docx)或 W... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 89 次。

如何安装 Feishu → XHS Publisher?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install feishu-xhs-publisher」即可一键安装,无需额外配置。

Feishu → XHS Publisher 是免费的吗?

是的,Feishu → XHS Publisher 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Feishu → XHS Publisher 支持哪些平台?

Feishu → XHS Publisher 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Feishu → XHS Publisher?

由 xiaohuaishu(@xiaohuaishu)开发并维护,当前版本 v1.0.0。

💬 留言讨论