# XHS-Downloader

> MCP Server

XiaoHongShu (RedNote) data extraction tool. Extracts user/post links, scrapes info, and downloads watermark-free content.

## Overview

- **Category:** System Tools
- **Language:** Python
- **Stars:** 12124
- **Forks:** 1254
- **Owner:** JoeanAmier
- **GitHub:** https://github.com/JoeanAmier/XHS-Downloader
- **Homepage:** https://discord.com/invite/ZYtmgKud9Y
- **Created:** 2023-08-16T11:03:36+00:00
- **Updated:** 2025-08-08T10:05:59+00:00
- **Source:** https://model-context-protocol.com/servers/xhs-downloader

## Setup

## Setup

This section provides instructions for setting up and running XHS-Downloader using different methods: Program Execution, Docker, and Source Code Execution.

### 1. Program Execution

This method is recommended for users of macOS and Windows 10 or later who want a simple way to download files.

**Prerequisites:**

*   macOS or Windows 10 or later operating system.

**Installation Steps:**

1.  Download the program package from the [Releases](https://github.com/JoeanAmier/XHS-Downloader/releases/latest) page or [Actions](https://github.com/JoeanAmier/XHS-Downloader/actions) page.
2.  Extract the downloaded archive to a local directory.
3.  Open the extracted directory.
4.  Double-click the `main` executable to run the program.

    **Note:** On macOS, the `main` executable might need to be launched from the terminal.  The macOS executable has not been thoroughly tested and its functionality is not guaranteed.

**Configuration:**

*   The default download path is `.\_internal\Volume\Download`.
*   The configuration file is located at `.\_internal\Volume\settings.json`.

**Updating the Program:**

*   **Method 1:** Download and extract the new version. Copy the `_internal\Volume` folder from the old version to the new version.
*   **Method 2:** Download and extract the new version (without running it). Copy all files from the new version and overwrite the files in the old version.

### 2. Docker Execution

This method is suitable for users familiar with Docker who want a containerized environment.

**Prerequisites:**

*   Docker installed on your system.

**Installation Steps:**

1.  **Obtain the Docker image:**
    *   **Option 1:** Build the image using the provided `Dockerfile`.
    *   **Option 2:** Pull the image from Docker Hub using the command: `docker pull joeanamier/xhs-downloader`
    *   **Option 3:** Pull the image from GitHub Container Registry using the command: `docker pull ghcr.io/joeanamier/xhs-downloader`

2.  **Create a container:**

    *   **TUI Mode:** `docker run --name <container_name> -p <host_port>:5556 -v xhs_downloader_volume:/app/Volume -it <image_name>`
    *   **API Mode:** `docker run --name <container_name> -p <host_port>:5556 -v xhs_downloader_volume:/app/Volume -it <image_name> python main.py api`
    *   **MCP Mode:** `docker run --name <container_name> -p <host_port>:5556 -v xhs_downloader_volume:/app/Volume -it <image_name> python main.py mcp`

        Replace `<container_name>` with a name for your container (optional), `<host_port>` with the port you want to expose on your host machine, and `<image_name>` with the name of the image you pulled (either `joeanamier/xhs-downloader` or `ghcr.io/joeanamier/xhs-downloader`).

3.  **Run the container:**

    *   Start the container: `docker start -i <container_name>/<container_id>`
    *   Restart the container: `docker restart -i <container_name>/<container_id>`

**Limitations:**

*   Command-line mode is not supported in Docker.
*   Clipboard reading and monitoring features are not available.

### 3. Source Code Execution

This method is recommended for developers or users who want to customize the program or contribute to the project.

**Prerequisites:**

*   Python 3.12 installed.

**Installation Steps:**

1.  Download the latest source code from the GitHub repository or the [Releases](https://github.com/JoeanAmier/XHS-Downloader/releases/latest) page.
2.  Extract the downloaded archive to a local directory.
3.  Open a terminal and navigate to the project's root directory.
4.  Install the required Python modules using the command: `pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt`
5.  Run the program using the command: `python main.py`

**Configuration:**

*   Configuration is done through the `settings.json` file in the project root directory.  This file is automatically generated on the first run.

**Environment Variables:**

*   No specific environment variables are required.  Configuration is primarily handled through the `settings.json` file.

**settings.json Configuration Options:**

| Parameter       | Type    | Description

## Tools

## Available Tools

**Program Features:**

*   **Collect Xiaohongshu post information:** Gathers details about Xiaohongshu posts, such as title, description, author, and other metadata.
*   **Extract Xiaohongshu post download URLs:** Retrieves the direct download links for images and videos within a Xiaohongshu post.
*   **Download Xiaohongshu watermark-free post files:** Downloads the actual image and video files from Xiaohongshu posts without watermarks.
*   **Download Xiaohongshu livePhoto files (with watermark):** Downloads live photo files, which include watermarks.
*   **Automatically skip downloaded post files:** Prevents re-downloading of files by checking against a record of already downloaded posts.
*   **Post file integrity processing mechanism:** Ensures that downloaded files are complete and not corrupted.
*   **Customizable image-text post file download format:** Allows users to define how image and text posts are downloaded and organized.
*   **Persistently store post information to a file:** Saves post metadata to a file for later use or analysis.
*   **Store post files in separate folders:** Organizes downloaded files into individual folders for each post.
*   **Background monitoring of clipboard downloads:** Automatically detects Xiaohongshu links copied to the clipboard and initiates downloads.
*   **Record downloaded post IDs:** Keeps track of downloaded post IDs to prevent duplicates.
*   **Support command-line download of post files:** Enables users to download posts using command-line arguments.
    *   Example: `python .\main.py --browser_cookie Chrome --update_settings`
*   **Read Cookie from browser:** Allows the program to automatically fetch cookies from your browser for authentication.
    *   Example: `python .\main.py --browser_cookie Chrome --update_settings`
*   **Customizable file name format:** Lets users define the naming convention for downloaded files.
*   **Support API call function:** Enables programmatic access to the downloader's features through an API.
    *   Endpoint: `/xhs/detail`
    *   Method: `POST`
    *   Format: `JSON`
*   **Support MCP call function:** Enables programmatic access to the downloader's features through an MCP (Message Control Protocol).
    *   MCP URL: `http://127.0.0.1:5556/mcp/`
*   **Support breakpoint resume download:** Allows interrupted downloads to be resumed from where they left off.
*   **Intelligently identify post file types:** Automatically detects the type of files being downloaded (e.g., image, video).
*   **Support setting author notes:** Allows users to add custom notes or tags to downloaded posts.
*   **Automatically update author nicknames:** Keeps author nicknames up-to-date in downloaded file names and metadata.

**User Script Features:**

*   **Download Xiaohongshu watermark-free post files:** Downloads image and video files without watermarks directly from the Xiaohongshu website.
*   **Extract recommended page post links:** Extracts links from the "For You" page.
*   **Extract account published post links:** Extracts links from a user's profile page.
*   **Extract account collection post links:** Extracts links from a user's "Favorites" page.
*   **Extract account liked post links:** Extracts links from a user's "Likes" page.
*   **Extract account album post links:** Extracts links from a user's album page.
*   **Extract search results post links:** Extracts links from search result pages.
*   **Extract search results user links:** Extracts links to user profiles from search results.

## Related Articles

- [Mastering XHS-Downloader in 2025](https://model-context-protocol.com/blog/xhs-downloader-guide)
