360 Secure SkillHub
360 安全技能中心

XhsSkills

该 Skill 通过 Python CLI 调用打包的 Spider_XHS 小红书接口:pc 命名空间用于笔记、用户、搜索、评论、消息与信息流数据,creator 命名空间用于话题、位置查询、媒体上传、笔记发布及已发布笔记查询。依赖 Python 与 Node 运行时及打包的签名 JS,需调用方自行提供登录 Cookie。

cv-cat
cv-cat
热度 45.20
最近更新 2026-05-18 11:42:31
分类:营销依赖:代码执行 / 读写文件 / 第三方 API应用场景:社交媒体 / API 集成 / 数据处理 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add xhs-apis
Metadata
name
xhs-apis
description
Use this skill when you need to call the vendored Xiaohongshu/XHS APIs from Spider_XHS for PC web data or creator-platform publishing data. This skill only wraps the APIs in xhs_pc_apis.py and xhs_creator_apis.py, including note, user, search, comment, topic, location, media upload, note publishing, and creator published-note queries.

XHS APIs

Overview

Use this skill to run the vendored Spider_XHS APIs for XHS PC and creator-platform workflows. This skill only exposes the methods defined in xhs_pc_apis.py and xhs_creator_apis.py.

Quick Start

  1. Install Python dependencies:
pip install -r skills/xhs-apis/scripts/requirements.txt
  1. Install Node dependencies:
Set-Location skills/xhs-apis/scripts
npm install
  1. Inspect available methods:
python skills/xhs-apis/scripts/xhs_api_tool.py list
  1. Call an API:
python skills/xhs-apis/scripts/xhs_api_tool.py call pc get_note_info --params "{\"url\":\"https://www.xiaohongshu.com/explore/...\",\"cookies_str\":\"a1=...; web_session=...\"}"

Workflow

  • Use the pc namespace for public-site note, user, search, comment, message, and feed APIs.
  • Use the creator namespace for creator-platform topic lookup, location lookup, media upload, note publishing, and published-note queries.
  • If you are unsure which method to use, run list first or read api-index.md.

Parameter Rules

  • pc methods mostly expect cookies_str.
  • creator source methods often expect a cookies dict. The CLI accepts either cookies or cookies_str and converts automatically.
  • For creator file inputs, pass file paths in JSON. The CLI reads those files into bytes before calling the vendored API.
  • For creator.post_note, pass noteInfo.media_type as image or video, then provide either images or video.

Runtime Notes

  • The runtime shipped with this skill is a trimmed vendor copy that keeps only the code needed by xhs_pc_apis.py and xhs_creator_apis.py.
  • The CLI changes into its vendored runtime directory before import so the bundled JS signers can resolve their relative static/ files.
  • If jsdom or crypto-js errors appear, rerun npm install inside skills/xhs-apis/scripts.

References