Skip to content

Latest commit

 

History

History
254 lines (254 loc) · 14.8 KB

README_EN.md

File metadata and controls

254 lines (254 loc) · 14.8 KB

XHS-Downloader

简体中文 | English

GitHub GitHub forks GitHub Repo stars Static Badge
GitHub code size in bytes GitHub release (with filter) GitHub all releases

🔥 Xiaohongshu Artwork Collection Tool: Collect information on Xiaohongshu artworks; Extract the download address of Xiaohongshu artworks; Download the Xiaohongshu watermark-free artwork files!

❤️ The author only releases XHS-Downloader on GitHub, without collaborating with any individuals or websites. Additionally, there are no charging plans for the tool!

⭐ Due to the author's limited energy, I was unable to update the English document in a timely manner, and the content may have become outdated. Suggest referring to Chinese documentation. If you want to contribute to translation, we warmly welcome you

📑 The Project Features:

  • ✅ Collect Xiaohongshu graphic/text or video artworks' information
  • ✅ Extract Xiaohongshu graphic/text or video artworks' download addresses
  • ✅ Download Xiaohongshu graphic/text or video artworks without watermarks
  • ✅ Supports Tampermonkey user scripts
  • ✅ Batch download account artworks (with user scripts)
  • ✅ Automatically skip already downloaded artworks
  • ✅ Mechanism for handling the integrity of artwork files
  • ✅ Customize the download format for graphic and text artworks
  • ✅ Persistently store artwork information to a file
  • ✅ Store artwork files in a separate folder
  • ☑️ Background monitoring of clipboard for downloading artworks
  • ☑️ Supports API calling functionality

📸 Program Screenshot


🎥 Click on the image to watch the demo video


🔗 Support Hyperlinks

  • https://www.xiaohongshu.com/explore/artwork's ID
  • https://www.xiaohongshu.com/discovery/item/artwork's ID
  • https://xhslink.com/share code

  • The program supports entering multiple artwork links in a single input box, separated by spaces.

🪟 About the Terminal

Windows Terminal (Default terminal in Windows 11) is recommended to run the program for optimal display performance!

🥣 How to Use

If you only need to download watermark-free artwork files, Program Running is recommended; If you have other needs, Source Code Running is recommended!

🖱 Program Running

Users with Windows 10 or above can go to Releases download the program zip file, unzip it, open the program folder, and double-click main.exe to run the program

If you use the program this way, the default download path for files is: .\_internal\Download; configuration file path: .\_internal\settings.json

⌨️ Source Code Running

  1. Install Python Interpreter with version >= 3.12
  2. Execute pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt to install the required modules for the program
  3. Download the latest source code or code released in Releases to your local workplace
  4. Run main.py to use the program

🕹 User Script

If your browser has installed Tampermonkey extension, add User script, and you can experience the project's functionalities without downloading the program!

Tip: You can use the XHS-Downloader user script to extract artwork links in batches from web pages. Combine it with the XHS-Downloader program to achieve batch downloading of watermark-free artwork files!

Script Functionality

  • Download Xiaohongshu watermark-free artwork files
  • Extract artwork links from the discovery page
  • Extract artwork links from account-published content
  • Extract artwork links from account-collected content
  • Extract artwork links from account-liked content

Script Screenshot


💻 Secondary Development

If there are other requirements, you can call or modify the program refer to the comments in main.py

# Example links
error_link = "https://github.com/JoeanAmier/XHS_Downloader"
demo_link = "https://www.xiaohongshu.com/explore/xxxxxxxxxx"
multiple_links = f"{demo_link} {demo_link} {demo_link}"
# Instance object
work_path = "D:\\"  # Artwork data/file save root path, default value: project root path
folder_name = "Download"  # Artwork file storage folder name (automatically created), default value: Download
user_agent = ""  # Request Header: User-Agent
cookie = ""  # Xiaohongshu web version Cookie, no need to log in
proxy = None  # Network proxy
timeout = 5  # Request data timeout limit, unit: seconds, default value: 10
chunk = 1024 * 1024 * 10  # When downloading files, the size of each data block obtained from the server each time, unit: bytes
max_retry = 2  # Maximum number of retries when requesting data fails, unit: seconds, default value: 5
record_data = False  # Whether to record artwork data to a file
image_format = "WEBP"  # Graphic artwork file download format, supports: PNG, WEBP
folder_mode = False  # Whether to store each artwork's file in a separate folder
async with XHS() as xhs:
    pass  # Use default parameters
async with XHS(work_path=work_path,
               folder_name=folder_name,
               user_agent=user_agent,
               cookie=cookie,
               proxy=proxy,
               timeout=timeout,
               chunk=chunk,
               max_retry=max_retry,
               record_data=record_data,
               image_format=image_format,
               folder_mode=folder_mode,
               ) as xhs:  # Use custom parameters
    download = True  # Whether to download artwork files, default value: False
    # Return detailed information about the artwork, including download addresses
    print(await xhs.extract(error_link, download))  # Return an empty dictionary when data retrieval fails
    print(await xhs.extract(demo_link, download))
    print(await xhs.extract(multiple_links, download))  # Support input of multiple artwork links

⚙️ Configuration File

settings.json in the project's root directory, generated automatically on the first run, and allows customization of certain runtime parameters

If your computer doesn't have a suitable program to edit JSON files, it is recommended to use JSON Online Tool to edit the content of the configuration file

Parameters Type Meaning Default Value
work_path str Artwork data/file save root path Project root path
folder_name str Artwork file storage folder name Download
user_agent str Request Header: User-Agent Default UA
cookie str Xiaohongshu web version Cookie,No need to log in, modification recommended Default Cookie
proxy str Set program proxy null
timeout int Request data timeout limit, unit: seconds 10
chunk int Size of each data block obtained from the server when downloading files, unit: bytes 1048576(1 MB)
max_retry int Maximum number of retries when requesting data fails, unit: seconds 5
record_data bool Whether to record artwork data to TXT file false
image_format str Graphic and text artwork file download format, support: PNGWEBP PNG
folder_mode bool Whether to store each artwork's file in a separate folder; folder names are consistent with file names false
language str Set programming language, currently support: zh_CN, en_GB zh_CN

🌐 Cookie

  1. Open the browser (optional in incognito mode), visit any page on Xiaohongshu
  2. Press F12 to open developer tools
  3. Click the Console
  4. Input document.cookie then press Enter to confirm
  5. The output content is the Cookie

♥️ Support the Project

If XHS-Downloader is helpful, please consider giving it a Star ⭐, thank you for your support!

WeChat Alipay
微信赞助二维码 支付宝赞助二维码

If you wish, consider funding additional support for the XHS-Downloader!

✉️ Contact us

If you contact me via email, I may not be able to check and respond promptly. I will do my best to reply to your email within seven days. If there are urgent matters or you need a faster response, please contact me through other means. Thank you for your understanding!

If you're interested in DouYin / TikTok, you can check out my other open-source project TikTokDownloader

⚠️ Disclaimer

  • Users decide on their own how to use this project and bear the risks themselves. The author is not responsible for any losses, liabilities, or risks incurred by users in the use of this project
  • The code and functionalities provided by the author of this project are developed based on existing knowledge and technology. The author strives to ensure the correctness and security of the code but does not guarantee that the code is completely error-free or defect-free.
  • Users must strictly adhere to the provisions in GNU General Public License v3.0 , and appropriately mention the use of code adhering GNU General Public License v3.0.
  • Under no circumstances shall users associate the author of this project, contributors, or other related parties with the user's usage behavior, or demand that they be held responsible for any losses or damages incurred by the user's use of this project.
  • Users must independently study relevant laws and regulations when using the code and functionalities of this project and ensure that their usage is legal and compliant. Users are solely responsible for any legal liability and risks resulting from violations of laws and regulations.
  • The author of this project will not provide a paid version of the XHS-Downloader project, nor will they offer any commercial services related to the XHS-Downloader project.
  • Any secondary development, modification, or compilation of the program based on this project is unrelated to the original author. The original author is not responsible for any consequences related to secondary development or its results. Users should take full responsibility for any situations that may arise from secondary development on their own.
Before using the code and functionalities of this project, please carefully consider and accept the above disclaimer. If you have any questions or disagree with the statement, please do not use the code and functionalities of this project. If you use the code and functionalities of this project, it is considered that you fully understand and accept the above disclaimer, and willingly assume all risks and consequences associated with the use of this project.