Building an Efficient Xiaohongshu Workflow: A Deep Dive into the RedBookSkills Automation Tool
In the current wave of content creation, Xiaohongshu (also known as RED) has become an indispensable platform for traffic and engagement. For operators and creators, repetitive publishing tasks, cumbersome multi-account management, and data collection often consume valuable time. Today, we are taking an in-depth look at a command-line tool called RedBookSkills. By leveraging the Chrome DevTools Protocol (CDP), it achieves automation and intelligence for Xiaohongshu content publishing. This article is entirely based on the project documentation, providing a detailed breakdown of its features, installation, configuration, and practical application to help you build a highly efficient operation workflow.
What is RedBookSkills?
RedBookSkills is a command-line tool developed in Python, specifically designed to automate content publishing to the Xiaohongshu platform. Unlike traditional mouse-simulation scripts, it interacts directly with the browser using the Chrome DevTools Protocol (CDP), offering higher stability and reliability.
This tool goes beyond simply filling in titles and uploading images. It supports multi-account management, headless mode execution, material searching, and data scraping. Whether you are an individual creator looking to save time or an operations team needing to manage accounts in bulk, you will find a solution here.
Core Features Overview
Before diving into the operational details, let’s comprehensively understand the core capabilities provided by RedBookSkills. It is more than just a publishing tool; it is a complete automation hub for Xiaohongshu operations.
1. Intelligent Content Publishing
This is the soul of the tool. It simulates human operations to automatically complete the following workflow:
-
Automatic Form Filling: Automatically enters article titles and main body content. -
Smart Image Handling: Supports downloading images directly from URLs and uploading them. It automatically adds the Refererheader to bypass common hotlinking restrictions. It also supports uploading images from local file paths. -
Smart Hashtag Recognition: A highly user-friendly feature. The tool identifies #hashtagson the last line of the content body, strips them from the main text, and simulates the process of typing each tag individually, waiting, and confirming—perfectly mimicking human behavior.
2. Multi-Account and Login Management
Operators often manage more than one account. RedBookSkills provides a mature account management system:
-
Cookie Isolation: Each account has an independent Chrome Profile, ensuring no interference and reducing the risk of account association. -
Login Status Detection: Automatically determines if the user is currently logged in. If not, it automatically prompts for QR code scanning in windowed mode. -
Status Caching: To avoid wasting resources on frequent login checks, results from commands like check_loginare cached locally for 12 hours by default.
3. Flexible Browser Control Modes
The tool supports various browser running modes to adapt to different working scenarios:
-
Windowed Mode: Suitable for debugging or when visual preview of the publishing process is required. -
Headless Mode: Suitable for running on servers or in the background without occupying desktop display resources. -
Remote CDP Support: An advanced feature. You can connect to a Chrome browser on a remote server via --hostand--portparameters, enabling cloud-based automation.
4. Content Operations and Data Scraping
Beyond publishing, the tool covers upstream and downstream operational tasks:
-
Content Retrieval: Supports searching for notes by keyword and retrieving dropdown recommendation words. -
Details and Comments: Capable of fetching details of specific notes (including comment data) and even posting first-level comments via feed_idandxsec_token. -
Data Dashboard: Scrapes the “Note Basic Information” table from the Creator Center, including core metrics like exposure, views, and likes. It supports exporting to CSV files for easy data analysis.
Environment Preparation and Installation Guide
To use RedBookSkills, you must first set up the correct runtime environment. Please follow the steps below strictly.
System Requirements
Before installation, ensure your computer meets the following hardware and software prerequisites:
-
Operating System: Windows (Currently, only Windows systems have been tested; Win10/Win11 environments are recommended). -
Python Version: Python 3.10 or higher. The tool uses newer syntax features, so lower versions of Python may not run correctly. -
Browser: Google Chrome. The tool relies on Chrome’s debugging port functionality.
Installation Steps
First, obtain the project code and install the dependency libraries. Open your command line terminal (CMD or PowerShell) and execute the following command:
pip install -r requirements.txt
This command automatically reads the requirements.txt file in the project root directory and installs all necessary third-party libraries. Once completed, you are ready to start.
Practical Guide: The Complete Workflow from Login to Publish
Next, we will demonstrate how to complete daily publishing tasks using specific command examples.
Step 1: First Login and Account Initialization
Before using any features, you must log in to your Xiaohongshu account. The tool provides a dedicated login command that launches a Chrome browser window.
python scripts/cdp_publish.py login
After executing the command, the browser will automatically open the Xiaohongshu page. Simply scan the QR code on the screen with your phone. Once logged in, the browser saves the Cookie in the current Chrome Profile, eliminating the need to scan again for future uses.
Advanced Multi-Account Management:
If you need to manage multiple accounts, use the following commands:
-
List all accounts: python scripts/cdp_publish.py list-accounts -
Add a new account: python scripts/cdp_publish.py add-account myaccount --alias "My Account" -
Login with a specific account: python scripts/cdp_publish.py --account myaccount login
This allows you to safely switch and manage multiple identities on the same computer.
Step 2: Launching and Controlling the Browser
Although publishing scripts usually handle browser startup automatically, we can use the chrome_launcher.py script for fine-grained control during debugging or standalone browser sessions.
Start Test Browser (Windowed Mode Recommended):
python scripts/chrome_launcher.py
If you want the browser to run silently in the background (without a window), add the --headless parameter:
python scripts/chrome_launcher.py --headless
Other Common Management Commands:
-
Restart Browser: python scripts/chrome_launcher.py --restart -
Close Browser: python scripts/chrome_launcher.py --kill -
Check Login Status: python scripts/cdp_publish.py check-login
There is a very useful parameter here: --reuse-existing-tab. In windowed mode, without this parameter, the script might frequently bring the browser to the foreground, interrupting your other work. Adding this parameter ensures the script prioritizes reusing existing tabs, minimizing interference.
python scripts/cdp_publish.py check-login --reuse-existing-tab
Step 3: Publishing Your First Piece of Content
Publishing is the core feature. We recommend using publish_pipeline.py as the unified entry point. It integrates the full process from starting the browser to successful publication.
Basic Publishing Command (Headless Mode)
For server environments or background batch tasks, headless mode is the best choice. The following command demonstrates how to publish an article with a title, body, and an image from a URL:
python scripts/publish_pipeline.py --headless \
--title "Article Title" \
--content "Article Body" \
--image-urls "https://example.com/image.jpg"
Advanced Publishing Techniques
1. Using Local Images:
If you have already downloaded image materials, you can specify the local path directly:
python scripts/publish_pipeline.py --headless \
--title "Article Title" \
--content "Article Body" \
--images "C:\path\to\image.jpg"
2. Reading Content from Files:
Writing long articles directly in the command line is inconvenient. You can use file input:
python scripts/publish_pipeline.py --headless \
--title-file title.txt \
--content-file content.txt \
--image-urls "https://example.com/image.jpg"
3. Smart Hashtag Writing:
This is a highlight of the tool. You simply write the hashtags on the last line of your content.txt file, and the tool automatically recognizes and processes them.
Suppose your content.txt looks like this:
This is a dry guide about spring recruitment, hope it helps everyone.
#SpringRecruitment #ClassOf26 #CampusRecruitment #JobHunting #JobSearch
When the tool runs, it detects that the last line consists entirely of #hashtag formats and extracts it for hashtag input. It simulates human operation: typing each tag -> waiting 3 seconds -> pressing Enter to confirm. This strategy effectively avoids the risk of being flagged as a bot by the platform due to overly fast operations.
Note: It is recommended to keep the number of tags between 1 and 10 to comply with platform norms.
Remote Publishing Operations
If your Chrome browser is running on another machine (e.g., a cloud server), simply specify the remote address using the --host and --port parameters:
python scripts/publish_pipeline.py --host 10.0.0.12 --port 9222 \
--title "Article Title" \
--content "Article Body" \
--image-urls "https://example.com/image.jpg"
In this mode, the script skips the local browser startup logic and connects directly to the remote debugging port.
Deep Operations: Search, Interaction, and Data Scraping
RedBookSkills is not just a publishing tool; it possesses preliminary data collection and interaction capabilities, which are crucial for a closed operational loop.
Content Retrieval and Detail Fetching
Want to understand competitors or industry trends? Use the search function.
Search Notes:
python scripts/cdp_publish.py search-feeds --keyword "Spring Recruitment"
You can also add filters, for example, sorting by “Latest” or filtering for “Image-Text” types:
python scripts/cdp_publish.py search-feeds --keyword "Spring Recruitment" --sort-by Latest --note-type ImageText
Get Note Details:
Search results return a feed_id and xsec_token. Using these two parameters, we can fetch detailed data for a specific note:
python scripts/cdp_publish.py get-feed-detail \
--feed-id 67abc1234def567890123456 \
--xsec-token YOUR_XSEC_TOKEN
Auto-Comment Interaction
Maintaining account activity requires comment interaction. The tool supports posting first-level comments on specified notes:
python scripts/cdp_publish.py post-comment-to-feed \
--feed-id 67abc1234def567890123456 \
--xsec-token YOUR_XSEC_TOKEN \
--content "Very practical write-up, thanks for sharing!"
Data Export and Analysis
Data is the eye of operations. With the following command, you can scrape the “Note Basic Information” table from the Creator backend with one click. It includes key metrics like exposure, views, and likes, and exports them to a CSV file for easy deep analysis using Excel.
python scripts/cdp_publish.py content-data --csv-file "/abs/path/content_data.csv"
Additionally, you can scrape data from the “Comments and Mentions” notification interface:
python scripts/cdp_publish.py get-notification-mentions
Command Reference and Technical Details
For easy reference, we have organized the functions and parameters of the main scripts.
publish_pipeline.py Unified Publishing Entry
This is the most commonly used script for completing a full publishing process.
| Parameter | Description | Example |
|---|---|---|
--title TEXT |
Specify article title directly | --title "My Title" |
--content TEXT |
Specify body content directly | --content "Body Content" |
--title-file FILE |
Read title from file | --title-file title.txt |
--content-file FILE |
Read body content from file | --content-file content.txt |
--image-urls URL... |
List of image URLs (space-separated) | --image-urls "http://a.jpg" "http://b.jpg" |
--images FILE... |
List of local image paths | --images "C:\a.jpg" |
--headless |
Enable headless mode (no interface) | --headless |
--reuse-existing-tab |
Reuse existing tabs to reduce window switching | --reuse-existing-tab |
--account NAME |
Specify the account to use | --account myaccount |
--auto-publish |
Auto-click publish, skip manual confirmation | --auto-publish |
Hashtag Processing Rule Details:
The tool checks the “last non-empty line” of the body content. If this line consists entirely of text in the #hashtag format, the tool treats it as a hashtag list, removes that line from the body, and types them into the hashtag input box on the publishing page. This design keeps the body clean while achieving automated hashtag filling.
cdp_publish.py Underlying Control and Toolkit
This script provides finer granularity control and auxiliary functions.
-
Login & Accounts: login,list-accounts,add-account,switch-account, etc. -
Publishing Actions Breakdown: fill(fill form only),click-publish(click publish only). -
Data Operations: search-feeds,get-feed-detail,content-data.
Note on Image Types:
When handling Feed data, the documentation mentions two image types, which are important for developers understanding the data structure:
-
WB_PRV: Preview image. Smaller size, fast loading, typically used for list page display. -
WB_DFT: Default image. Better quality and complete dimensions, used for detail page display.
Frequently Asked Questions (FAQ)
You may encounter some questions during use. The following are answers to common questions based on the documentation.
Q1: Is this tool safe? Will it be detected by the platform?
A: The tool is based on the Chrome DevTools Protocol (CDP), which simulates real Chrome browser behavior rather than traditional simulated mouse movements. Additionally, a 3-second wait and enter confirmation mechanism is added when typing hashtags to mimic human operation as closely as possible. However, please note that risks exist with any automation tool. Please control usage frequency reasonably and abide by platform rules.
Q2: Can I run this tool on a server?
A: Yes. Please use the --headless parameter to start headless mode. If it is a remote server, ensure Chrome on the server has the debugging port open, and specify the remote address via --host and --port in your local command.
Q3: Why can’t I publish content? What if the login status expires?
A: First, check the login status by running python scripts/cdp_publish.py check-login. Login status is cached for 12 hours by default. If the cache expires or cookies are invalid, the tool will prompt for a new login. When logging in, ensure you use windowed mode (do not add --headless) so you can scan the QR code.
Q4: How many hashtags are supported?
A: According to the documentation, it is recommended to control the number of tags between 1 and 10. Although the tool automatically recognizes all tags, exceeding platform limits may result in publishing failure, so manual streamlining is advised.
Q5: Which operating systems are supported?
A: Currently, the official documentation points out that only the Windows operating system has been tested. While Python is cross-platform, path formats (e.g., C:\path\to\image.jpg) and Chrome startup logic may need adaptation for Linux/Mac.
Technical Architecture and Application Extension
The design of RedBookSkills is not limited to a standalone script; it also demonstrates potential for integration as a Skill tool. The documentation mentions that the project can be used as an AI tool for platforms like Claude Code or OpenCode that support Skills. By copying the project to a specific configuration directory (e.g., .claude/skills/post-to-xhs/), the capability to publish to Xiaohongshu can be integrated into an AI workflow. This means that in the future, we could use conversational commands to have AI automatically generate copy and call this tool to complete the publishing, realizing a true “AI + Automation” closed loop.
Important Notices and Compliance Disclaimer
Finally, and most importantly, please strictly observe the usage guidelines:
-
For Learning and Research Only: Do not use this tool to publish illegal, infringing, or spam content. -
Account Security: All Cookie data is stored in the local Chrome Profile. Please safeguard your computer and account information to prevent leakage. -
Maintenance and Updates: The Xiaohongshu platform page structure may update periodically. If publishing fails, you may need to check and update the page element selectors in cdp_publish.py.
Conclusion
RedBookSkills converts tedious Xiaohongshu operation tasks into a programmable automation workflow through standardized command-line interfaces. From basic login and publishing to advanced multi-account management, remote control, and data scraping, it provides a complete set of solutions. For technicians, it is an efficient automation script; for operators, it is a productivity booster. Through the detailed breakdown in this article, we hope to help you get started quickly and build your own efficient operation system.
Schema Markup (JSON-LD):
{
"@context": "https://schema.org",
"@type": "HowTo",
"name": "Automate Xiaohongshu Content Publishing with RedBookSkills",
"description": "A detailed tutorial on how to install and configure the RedBookSkills tool to achieve automated publishing, multi-account management, and data scraping for Xiaohongshu.",
"step": [
{
"@type": "HowToStep",
"name": "Install Dependencies",
"text": "Execute 'pip install -r requirements.txt' in the command line to install the required Python libraries.",
"image": "https://example.com/install-screenshot.png"
},
{
"@type": "HowToStep",
"name": "Login to Account",
"text": "Execute 'python scripts/cdp_publish.py login' and scan the QR code in the popped-up browser.",
"image": "https://example.com/login-screenshot.png"
},
{
"@type": "HowToStep",
"name": "Publish Content",
"text": "Execute 'python scripts/publish_pipeline.py --headless --title \"Title\" --content \"Body\" --image-urls \"URL\"'.",
"image": "https://example.com/publish-screenshot.png"
}
],
"tool": [
{
"@type": "HowToTool",
"name": "RedBookSkills"
},
{
"@type": "HowToTool",
"name": "Python 3.10+"
},
{
"@type": "HowToTool",
"name": "Google Chrome"
}
]
}

