Skip to content
Projects

About

A tool for downloading videos and images from KuaiShou (快手) posts

Productivity & Automation

How these counts are measured

Measured star growth

in 24h
-1
in 7 days
0
in 15 days
+9
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README_EN.md

Original
KS-Downloader

KS-Downloader

English | 简体中文

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

🔥 KuaiShou Posts Download Tool: Completely free and open-source, based on curl_cffi module, for downloading KuaiShou video and image files!


📑 Project Features

  • ✅ Download KuaiShou posts
  • ☑️ Download posts cover images
  • ☑️ Download posts music files
  • ✅ Auto-skip downloaded files
  • ✅ File integrity verification
  • ✅ Persistent posts metadata storage
  • ✅ Track downloaded posts IDs
  • ✅ Resumable downloads
  • ✅ Dedicated storage folders
  • ✅ Custom filename formats
  • ☑️ Browser cookie extraction
  • ✅ Author alias configuration
  • ✅ Archive posts by author
  • ✅ Automatic author nickname updates
  • ✅ API integration
  • ☑️ Background clipboard monitoring

📸 Screenshots

前往 bilibili 观看演示;前往 YouTube 观看演示

🥣 Usage Guide

🖱 Application Execution

⭐ Mac OS/Windows 10+ users: Download pre-built packages from Releases or Actions. Extract and double-click main to run!

⭐ This project includes GitHub Actions for automatic builds - users can compile latest source code into executables anytime!

⭐ For the automatic building executable files tutorial, please refer to the Build of Executable File Guide section of this document. If you need a more detailed step-by-step tutorial with illustrations, please check out this article!

Note: Due to the macOS platform's executable file main not being code-signed, it will be restricted by system security measures on first run. Please execute the command xattr -cr project_folder_path in the terminal to remove the security flag, after which it can run normally.

Default download path: .\_internal\Volume\Download
Configuration file: .\_internal\Volume\config.yaml

Update Methods

Method 1: Download and extract the files, then copy the old version of the _internal\Volume folder into the new version's _internal folder.

Method 2: Download and extract the files (do not run the program), then copy all files and directly overwrite the old version.

⌨️ Source Code Execution

  1. Install Python interpreter version not lower than 3.12
  2. Download the latest source code or the source code released in Releases to your local machine
    1. Install project dependencies using pip
    2. Run the python -m venv venv command to create a virtual environment (optional)
    3. Run the .\venv\Scripts\activate.ps1 or venv\Scripts\activate command to activate the virtual environment (optional)
    4. Run the pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt command to install the required modules for the program
    5. Run the python .\main.py or python main.py command to start KS-Downloader
      Install project dependencies using uv (recommended)
    1. Run the uv sync --no-dev command to synchronize environment dependencies
    2. Run the uv run main.py command to start KS-Downloader

⌨️ Docker Execution

  1. Obtain Image:
    • Method 1: Build using Dockerfile
    • Method 2: Pull image via docker pull joeanamier/ks-downloader
    • Method 3: Pull image via docker pull ghcr.io/joeanamier/ks-downloader
  2. Create Container:
    • TUI Mode: docker run --name container_name(optional) -p HostPort:5557 -v ks_downloader_volume:/app/Volume -it <image name>
    • API Mode: docker run --name container_name(optional) -p HostPort:5557 -v ks_downloader_volume:/app/Volume -it <image name> python main.py api

    • Note: The <image name> here must be consistent with the image name you used in the first step (joeanamier/ks-downloader or ghcr.io/joeanamier/ks-downloader)
  3. Run Container:
    • Start: docker start -i [container_name/ID]
    • Restart: docker restart -i [container_name/ID]

Note: Docker version doesn't support browser cookie reading and clipboard monitoring. Other features remain functional. Please report any anomalies.

🖥 Server Mode

Start: Run the command: python .\main.py api

Stop: Press Ctrl + C to stop the server

Open http://127.0.0.1:5557/docs or http://127.0.0.1:5557/redoc; you will see automatically generated interactive API documentation!

🔗 Supported Links

  • https://www.kuaishou.com/f/share-code
  • https://v.kuaishou.com/share-code
  • https://www.kuaishou.com/short-video/postsID
  • https://kuaishou.cn/short-video/postsID
  • https://live.kuaishou.com/u/author-id/postsID

  • Recommend using share links; Multiple URLs supported (space separated).

🪟 Terminal Recommendation

⭐ Use Windows Terminal (default on Windows 11) for optimal display!

📜 Additional Notes

  • Windows requires admin privileges to read Chromium/Chrome/Edge cookies
  • The Browser Cookie Reading feature relies on a third-party module that has not been updated for a long time and may not properly support the latest browser versions. If the feature malfunctions, please try obtaining the cookies manually
  • Work data stored in ./Volume/Data/DetailData.db when enabled
  • Settings and download records in ./Volume/KS-Downloader.db
  • The project has a built-in request delay mechanism to avoid excessive request frequency. Code location: ./source/tools/sleep.py

⚙️ Configuration File

config.yaml (auto-generated) allows custom settings:

If features malfunction, configure cookies first!

Parameter Type Description Default
mapping_data str: str #Author alias mapping data, format: author ID: author alias null
work_path str Root path for work data/file storage Project root path/Volume
folder_name str Storage folder name for posts files Download
name_format str #Posts file name format, use spaces to separate fields; Supported fields: 作品类型、作者昵称、作者ID、作品描述、作品ID、发布日期 发布日期 作者昵称 作品描述
name_length int Posts file name length limit. Text exceeding the limit will be truncated. When setting a large value, please ensure the system supports this length 128
cookies str KuaiShou web interface Cookie (no login required) Dynamically fetched
proxy str Set program proxy null
data_record bool Save posts data to file (SQLite format) false
max_workers int Maximum concurrent download tasks 4
download_cover(Deactivate) str Cover download format (JPEG/WEBP), empty string disables Empty string
download_music(Deactivate) bool Download posts music track false
max_retry int Max retry attempts on failure (seconds) 5
timeout int Request timeout limit (seconds) 10
impersonate str Browser information, refer to curl_cffi documentation when setting chrome146
download_chunk int Download chunk size in bytes 2097152 (2 MB)
folder_mode bool Store files in individual folders (folder matches filename) false
author_archive bool #Whether to store each author's posts in separate folders; Folder name format: authorID_authorNickname false

name_format instructions (Currently only supports Chinese values) :

  • 作品ID: Posts ID
  • 作品描述: Posts Description
  • 作品类型: Posts Type
  • 发布时间: Publish Time
  • 作者昵称: Author Nickname
  • 作者ID: Author ID

When author_archive is set to true, the program will store each author's posts in dedicated folders. If an author's nickname changes, the program automatically updates the nickname portion in existing downloaded filenames!

Additionally, you can configure author aliases through the mapping_data parameter. When an alias is set, the program will use your custom alias instead of the original nickname in filenames!

📦 Build of Executable File Guide

This guide will walk you through forking this repository and executing GitHub Actions to automatically build and package the program based on the latest source code!


Steps to Use

1. Fork the Repository

  1. Click the Fork button at the top right of the project repository to fork it to your personal GitHub account
  2. Your forked repository address will look like this: https://github.com/your-username/this-repo

2. Enable GitHub Actions

  1. Go to the page of your forked repository
  2. Click the Settings tab at the top
  3. Click the Actions tab on the right
  4. Click the General option
  5. Under Actions permissions, select Allow all actions and reusable workflows and click the Save button

3. Manually Trigger the Build Process

  1. In your forked repository, click the Actions tab at the top
  2. Find the workflow named 构建可执行文件
  3. Click the Run workflow button on the right:
    • Select the master or develop branch
    • Click Run workflow

4. Check the Build Progress

  1. On the Actions page, you can see the execution records of the triggered workflow
  2. Click on the run record to view detailed logs to check the build progress and status

5. Download the Build Result

  1. Once the build is complete, go to the corresponding run record page
  2. In the Artifacts section at the bottom of the page, you will see the built result file
  3. Click to download and save it to your local machine to get the built program

Notes

  1. Resource Usage:

    • GitHub provides free build environments for Actions, with a monthly usage limit (2000 minutes) for free-tier users
  2. Code Modifications:

    • You are free to modify the code in your forked repository to customize the build process
    • After making changes, you can trigger the build process again to get your customized version
  3. Stay in Sync with the Main Repository:

    • If the main repository is updated with new code or workflows, it is recommended that you periodically sync your forked repository to get the latest features and fixes

Frequently Asked Questions

Q1: Why can't I trigger the workflow?

A: Please ensure that you have followed the steps to Enable Actions. Otherwise, GitHub will prevent the workflow from running

Q2: What should I do if the build process fails?

A:

  • Check the run logs to understand the cause of the failure
  • Ensure there are no syntax errors or dependency issues in the code
  • If the problem persists, please open an issue on the Issues page

Q3: Can I directly use the Actions from the main repository?

A: Due to permission restrictions, you cannot directly trigger Actions from the main repository. Please use the forked repository to execute the build process

🌟 Contribution Guidelines

Welcome to contributing to this project! To keep the codebase clean, efficient, and easy to maintain, please read the following guidelines carefully to ensure that your contributions can be accepted and integrated smoothly.

  • Before starting development, please pull the latest code from the develop branch as the basis for your modifications; this helps avoid merge conflicts and ensures your changes are based on the latest state of the project.
  • If your changes involve multiple unrelated features or issues, please split them into several independent commits or pull requests.
  • Each pull request should focus on a single feature or fix as much as possible, to facilitate code review and testing.
  • Follow the existing coding style; make sure your code is consistent with the style already present in the project; please use the Ruff tool to maintain code formatting standards.
  • Write code that is easy to read; add appropriate annotation to help others understand your intentions.
  • Each commit should include a clear and concise commit message describing the changes made. The commit message should follow this format: <type>: <short description>
  • When you are ready to submit a pull request, please prioritize submitting them to the develop branch; this provides maintainers with a buffer zone for additional testing and review before final merging into the master branch.
  • It is recommended to communicate with the author before starting development or when encountering questions to ensure alignment in direction and avoid redundant efforts or unnecessary commits.

Reference materials:

✉️ Contact the Author

✨ Other Open Source Projects by the Author:

♥️ Support the Project

If KS-Downloader has been helpful to you, please consider giving it a Star ⭐. Thank you for your support!

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

If you are willing, you may consider making a donation to provide additional support for KS-Downloader!

⚠️ Disclaimer

  1. The user's use of this project is entirely at their own discretion and responsibility. The author assumes no liability for any losses, claims, or risks arising from the user's use of this project.
  2. The code and functionalities provided by the author of this project are based on current knowledge and technological developments. The author strives to ensure the correctness and security of the code according to existing technical capabilities but does not guarantee that the code is entirely free of errors or defects.
  3. All third-party libraries, plugins, or services relied upon by this project follow their respective open-source or commercial licenses. Users must review and comply with those license agreements. The author assumes no responsibility for the stability, security, or compliance of third-party components.
  4. Users must strictly comply with the requirements of the GNU General Public License v3.0 when using this project and properly indicate that the code was used under the GNU General Public License v3.0.
  5. When using the code and features of this project, users must independently research relevant laws and regulations and ensure their actions are legal and compliant. Any legal liabilities or risks arising from violations of laws and regulations shall be borne solely by the user.
  6. Users must not use this tool to engage in any activities that infringe intellectual property rights, including but not limited to downloading or distributing copyright-protected content without authorization. The developers do not participate in, support, or endorse any unauthorized acquisition or distribution of illegal content.
  7. This project assumes no responsibility for the compliance of any data processing activities (including collection, storage, and transmission) conducted by users. Users must comply with relevant laws and regulations and ensure that their processing activities are lawful and proper. Legal liabilities resulting from non-compliant operations shall be borne by the user.
  8. Under no circumstances may users associate the author, contributors, or other related parties of this project with their usage of the project, nor may they hold these parties responsible for any loss or damage arising from such usage.
  9. The author of this project will not provide a paid version of the KS-Downloader project, nor will they offer any commercial services related to the KS-Downloader project.
  10. Any secondary development, modification, or compilation based on this project is unrelated to the original author. The original author assumes no liability for any consequences resulting from such secondary development. Users bear full responsibility for all outcomes arising from such modifications.
  11. This project grants no patent licenses; if the use of this project leads to patent disputes or infringement, the user bears all associated risks and responsibilities. Without written authorization from the author or rights holder, users may not use this project for any commercial promotion, marketing, or re-licensing.
  12. The author reserves the right to terminate service to any user who violates this disclaimer at any time and may require them to destroy all obtained code and derivative posts.
  13. The author reserves the right to update this disclaimer at any time without prior notice. Continued use of the project constitutes acceptance of the revised terms.
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.

⭐ Star History

💡 Project References

Explore related projects

Loading…