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
-
Install Dependencies:
pip install playwright requests playwright install chromium -
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.pyThis 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).
Scan to join WeChat group