360 Secure SkillHub
360 安全技能中心

Xiaohongshu Auto Publisher

通过 Playwright 驱动浏览器操作小红书:首次运行 login.py 扫码登录并把会话保存到 state.json,之后用 post.py 传入标题、正文和图片/视频路径完成发布;默认使用可见浏览器,便于人工处理弹窗或验证码。

widebluesky
widebluesky
热度 49.88
最近更新 2026-05-11 17:37:23
分类:营销依赖:联网浏览搜索 / 代码执行 / 读写文件应用场景:社交媒体 / 自动化脚本

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add xiaohongshu-auto-publisher
Metadata
name
xhs-publisher
description
Posts content (images/videos) to Xiaohongshu (Little Red Book) automatically using Playwright. Use this skill when you need to publish content to Xiaohongshu.

Xiaohongshu Publisher

This skill automates the process of posting content to Xiaohongshu (Little Red Book) using Playwright. It supports both image and video uploads, along with title and content (description) text.

Setup Instructions

  1. Install Dependencies:

    pip install playwright requests
    playwright install chromium
    
  2. Initial Login: Before you can post, you must perform a manual login once to save your session state. Run the login script:

    python .trae/skills/xhs-publisher/scripts/login.py
    

    This will open a browser window. Scan the QR code or log in using your preferred method. Once logged in, the script will save the session to state.json.

Usage

To post content, use the post.py script:

python .trae/skills/xhs-publisher/scripts/post.py \
  --title "Your Post Title" \
  --content "Your post description here. #tags" \
  --files "/path/to/image1.jpg" "/path/to/image2.png"

Arguments

  • --title: The title of the post.
  • --content: The description or caption for the post.
  • --files: One or more paths to the images or video files you want to upload.

Notes

  • The script uses a visible browser window by default (headless=False) to help you monitor the process and handle any unexpected popups or captchas.
  • Ensure your files are in supported formats (e.g., JPG, PNG, MP4).