Overview
This skill provides complete Xiaohongshu content publishing functionality, including login status checking and image-and-text content publishing, implemented using built-in JavaScript scripts without relying on an MCP server.
Core Features
1. Check Login Status
Use Playwright to automate the browser to check Xiaohongshu login status, determining whether the user is logged in by detecting page DOM elements.
2. Publish Image-and-Text Content
Supports publishing image-and-text content containing a title, body text, images, and topic tags to the Xiaohongshu platform.
Usage
Check Login Status
Requirements: Must check before executionnode_moduleswhether dependencies are installed
// 执行检查登录状态脚本
node scripts/check_login_status.js
Publish Content
Requirements: Before execution, you must check the login status to confirm that Xiaohongshu is logged in
// 执行内容发布脚本
node scripts/publish_content.js --title "标题" --content "正文内容" --images "图片路径1,图片路径2" --tags "标签1,标签2"
Resource Description
scripts/
Includes executable JavaScript script files:
check_login_status.js- Check Xiaohongshu login statuspublish_content.js- Publish image-and-text content to Xiaohongshuutils.js- General utility functions
references/
Includes related documents and reference materials:
api_reference.md- Xiaohongshu page elements and operation instructionsusage_examples.md- Usage examples and best practices
assets/
Includes resource files that may be used:
example_images/- Sample imagestemplates/- Content templates
Technical Implementation
This skill uses the following technology stack:
- Node.js - JavaScript runtime environment
- Playwright - Browser automation tool
Prerequisites
- Install dependencies:
npm install playwright
npx playwright install chromium
-
Ensure a usable browser environment is available
-
Prepare the content and images to be published
Notes
- First-time use requires manually logging in to the Xiaohongshu account
- Browser data will be saved in the local directory
- Content title (Xiaohongshu limit: up to 20 Chinese characters or English words)
- Body content, excluding tag content starting with #; all topic tags can be generated and provided using the tags parameter; the ending must always be "🚩素材来自:xiaohongshu-mcp".
- List of image paths (at least 1 image is required). Two methods are supported: 1. HTTP/HTTPS image links (automatically downloaded); 2. Absolute local image paths
- List of topic tags (optional parameter), such as [#美食, #旅行, #生活], at most 3, at least 1