小红书API代理
一个将小红书(Xiaohongshu)API封装为RESTful API服务器的微服务,允许用户在该平台上执行多种操作,例如获取笔记、搜索用户和内容、访问用户信息等。
服务介绍
Xiaohongshu API MCP Server | Little Red Book API Microservice
This is a microservice that encapsulates the Xiaohongshu (Little Red Book) API into a RESTful API server. It can be deployed using Docker.
Features
- RESTful API for Xiaohongshu operations | RESTful API for Little Red Book operations
- Multiple client support | Support for multiple clients
- Docker containerization | Docker containerization
- Easy to deploy and scale | Easy to deploy and scale
API Endpoints
The server provides the following endpoints:
/clients- Create and manage Xiaohongshu client instances/clients/{client_id}/note- Get note by ID/clients/{client_id}/note/html- Get note from HTML by ID/clients/{client_id}/search/notes- Search notes by keyword/clients/{client_id}/search/users- Search users by keyword/clients/{client_id}/user/info- Get user information by ID/clients/{client_id}/user/notes- Get user's notes/clients/{client_id}/feed/categories- Get recommended feed categories/clients/{client_id}/feed/{feed_type}- Get recommended feed by type/health- Health check endpoint
Project Structure
.
├── xhs_mcp_server/ # Main server directory
│ ├── app/ # Application core
│ ├── xhs/ # Xiaohongshu API module
│ ├── Dockerfile # Docker build file
│ └── requirements.txt # Python dependencies
└── xhs_api.py # API implementation
Quick Start
Prerequisites
- Docker
- Docker Compose
Installation and Running
- Build and start the Docker container:
bash
cd xhs_mcp_server
docker-compose up -d
The service will run at http://localhost:8000.
- Run directly with Python:
bash
pip install -r xhs_mcp_server/requirements.txt
python xhs_api.py
API Documentation
After the server is running, you can access the API documentation at the following locations:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
Usage Examples
- Create a client:
bash
curl -X POST "http://localhost:8000/clients"
-H "Content-Type: application/json"
-d {"cookie": "your_cookie_here"}
- Get a note by ID:
bash
curl -X POST "http://localhost:8000/clients/client_1/note"
-H "Content-Type: application/json"
-d {"note_id": "your_note_id", "xsec_token": "your_xsec_token"}
License
This project is intended for educational purposes only. Use at your own risk.