Skip to content

xhs_publish_content ​

发布图文笔记或保存为草稿。

参数 ​

参数类型必填说明
titlestring是标题(最多 20 字)
contentstring是正文内容
imagesstring[]是图片绝对路径数组
tagsstring[]否话题标签
scheduleTimestring否定时发布时间(ISO 8601)
saveDraftboolean否是否保存为草稿,默认 false
accountstring否使用的账号
accountsstring[] | "all"否多账号发布

返回值 ​

json
{
  "success": true,
  "noteId": "xxx"
}

示例 ​

基本发布 ​

xhs_publish_content({
  title: "今日分享",
  content: "这是正文内容...",
  images: ["/path/to/image1.jpg", "/path/to/image2.jpg"]
})

保存为草稿 ​

xhs_publish_content({
  title: "草稿标题",
  content: "先保存,稍后发布...",
  images: ["/path/to/image.jpg"],
  saveDraft: true
})

带标签发布 ​

xhs_publish_content({
  title: "穿搭分享",
  content: "今天的OOTD...",
  images: ["/path/to/ootd.jpg"],
  tags: ["穿搭", "日常", "时尚"]
})

定时发布 ​

xhs_publish_content({
  title: "早安",
  content: "...",
  images: ["/path/to/image.jpg"],
  scheduleTime: "2024-01-20T08:00:00+08:00"
})

多账号发布 ​

xhs_publish_content({
  title: "...",
  content: "...",
  images: [...],
  accounts: ["账号1", "账号2"]
})

注意事项 ​

  • 图片路径必须是绝对路径
  • 标题最多 20 个字符
  • 发布操作需要显示浏览器窗口
  • 草稿保存到小红书创作者中心

Released under the MIT License.