### API Demonstration URLs Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Example URLs for accessing the API documentation and demonstrations. ```APIDOC ## API Demonstration URLs - **Local API Documentation:** `http://localhost/docs` - **Online API Documentation:** `https://api.douyin.wtf/docs` **API Demos:** - **Crawl video data:** `https://api.douyin.wtf/api/hybrid/video_data?url=[视频链接/Video URL]&minimal=false` - **Download videos/photo albums:** `https://api.douyin.wtf/api/download?url=[视频链接/Video URL]&prefix=true&with_watermark=false` ``` -------------------------------- ### API Configuration Example Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Example configuration settings in a YAML file for customizing API behavior, including web settings, API host/port, and download options. ```yaml # config.yaml Web: PyWebIO_Enable: true Domain: https://douyin.wtf Max_Take_URLs: 30 API: Host_IP: 0.0.0.0 Host_Port: 80 Version: V4.1.2 Download_Switch: true # Enable/disable download endpoint Download_Path: "./download" Download_File_Prefix: "douyin.wtf_" # Platform-specific cookies (update in respective config files) # crawlers/douyin/web/config.yaml - Douyin cookie # crawlers/tiktok/web/config.yaml - TikTok cookie # crawlers/bilibili/web/config.yaml - Bilibili cookie ``` -------------------------------- ### Enable/Disable Auto-Start at Boot (Linux) Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Configure the Douyin_TikTok_Download_API service to automatically start on system boot or disable this behavior. ```bash sudo systemctl enable Douyin_TikTok_Download_API.service ``` ```bash sudo systemctl disable Douyin_TikTok_Download_API.service ``` -------------------------------- ### Douyin/TikTok Batch URL Examples Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Examples of batch URLs for Douyin and TikTok. Multiple URLs can be provided without specific separation. ```text https://v.douyin.com/L4NpDJ6/ https://www.douyin.com/video/7126745726494821640 2.84 nqe:/ 骑白马的也可以是公主%%百万转场变身https://v.douyin.com/L4FJNR3/ https://www.tiktok.com/t/ZTR9nkkmL/ https://www.tiktok.com/t/ZTR9nDNWq/ https://www.tiktok.com/@evil0ctal/video/7156033831819037994 ``` -------------------------------- ### Douyin Short URL Example Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Example of a Douyin short URL. This format is typically copied from within the Douyin app. ```text https://v.douyin.com/L4FJNR3/ ``` -------------------------------- ### Install douyin-tiktok-scraper Python Package Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Install the parsing library using pip. This package allows for convenient and quick integration into your projects. ```bash pip install douyin-tiktok-scraper ``` -------------------------------- ### Douyin Discovery Page URL Example Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Example of a Douyin discovery page URL. This format is typically copied from within the Douyin app. ```text https://www.douyin.com/discover?modal_id=7069543727328398622 ``` -------------------------------- ### Run Docker Container (Advanced) Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.md An example of running a Docker container with advanced configurations, including volume mounting for data persistence and setting environment variables. ```bash docker run -d --name douyin_tiktok_api -p 80:80 \ -v /path/to/your/data:/data \ -e MY_ENV_VAR=my_value \ evil0ctal/douyin_tiktok_download_api ``` -------------------------------- ### Douyin Normal URL Example Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Example of a Douyin normal URL. This format is typically copied from the web version of Douyin. ```text https://www.douyin.com/video/6914948781100338440 ``` -------------------------------- ### Run Docker Container (Basic) Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.md Start a Docker container in detached mode, naming it 'douyin_tiktok_api' and mapping host port 80 to container port 80. Adjust ports as necessary. ```bash docker run -d --name douyin_tiktok_api -p 80:80 evil0ctal/douyin_tiktok_download_api ``` -------------------------------- ### Install and Use douyin-tiktok-scraper Python Library Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Install the library using pip and import the Scraper class to programmatically parse Douyin and TikTok URLs. ```python # Install: pip install douyin-tiktok-scraper import asyncio from douyin_tiktok_scraper.scraper import Scraper api = Scraper() async def hybrid_parsing(url: str) -> dict: """Parse any Douyin/TikTok URL and get video data""" result = await api.hybrid_parsing(url) print(f"The hybrid parsing result:\n {result}") return result # Parse Douyin video asyncio.run(hybrid_parsing("https://v.douyin.com/L4FJNR3/")) # Parse TikTok video asyncio.run(hybrid_parsing("https://www.tiktok.com/@tiktok/video/7339393672959757570")) ``` -------------------------------- ### Get Douyin Live Room Product Information Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves product information from a Douyin live room. Requires a cookie, room ID, author ID, and limit. ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_live_room_product_result?cookie=YOUR_COOKIE&room_id=7356742011975715619&author_id=2207432981615527&limit=20" ``` -------------------------------- ### Douyin Sharing Password URL Example Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Example of a Douyin sharing password format. This format is typically copied from within the Douyin app. ```text 7.43 pda:/ 让你在几秒钟之内记住我 https://v.douyin.com/L5pbfdP/ 复制此链接,打开Dou音搜索,直接观看视频! ``` -------------------------------- ### Manage Service (Linux) Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.md Commands to control the Douyin_TikTok_Download_API service on a Linux system. Use these to start, stop, enable, or disable the service. ```bash sudo systemctl start Douyin_TikTok_Download_API.service ``` ```bash sudo systemctl stop Douyin_TikTok_Download_API.service ``` ```bash sudo systemctl enable Douyin_TikTok_Download_API.service ``` ```bash sudo systemctl disable Douyin_TikTok_Download_API.service ``` -------------------------------- ### Python Library Usage Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Instructions and examples for using the `douyin-tiktok-scraper` Python package to programmatically access API functionalities. ```APIDOC ### Installation ```bash pip install douyin-tiktok-scraper ``` ### Usage Example: Hybrid Parsing This example demonstrates how to parse any Douyin or TikTok URL to retrieve video data using the `Scraper` class. ```python import asyncio from douyin_tiktok_scraper.scraper import Scraper api = Scraper() async def hybrid_parsing(url: str) -> dict: """Parse any Douyin/TikTok URL and get video data""" result = await api.hybrid_parsing(url) print(f"The hybrid parsing result:\n {result}") return result # Example for Douyin video asyncio.run(hybrid_parsing("https://v.douyin.com/L4FJNR3/")) # Example for TikTok video asyncio.run(hybrid_parsing("https://www.tiktok.com/@tiktok/video/7339393672959757570")) ``` ``` -------------------------------- ### Fetch Bilibili Video Parts Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Get a list of parts or episodes for a Bilibili video using its BV ID. ```bash # Get video parts/episodes by BV ID curl "https://api.douyin.wtf/api/bilibili/web/fetch_video_parts?bv_id=BV1vf421i7hV" ``` -------------------------------- ### Fetch Bilibili Live Room Details Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Get the details of a Bilibili live room using its room ID. ```bash # Get live room details curl "https://api.douyin.wtf/api/bilibili/web/fetch_live_room_detail?room_id=22816111" ``` -------------------------------- ### TikTok Short URL Example Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Example of a TikTok short URL. This format is typically copied from within the TikTok app. ```text https://www.tiktok.com/t/ZTR9nDNWq/ ``` -------------------------------- ### TikTok Normal URL Example Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Example of a TikTok normal URL. This format is typically copied from the web version of TikTok. ```text https://www.tiktok.com/@evil0ctal/video/7156033831819037994 ``` -------------------------------- ### Fetch Bilibili User Collection Videos Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Get videos within a specific Bilibili collection folder. Requires the folder ID and supports pagination. ```bash # Get videos in a collection folder curl "https://api.douyin.wtf/api/bilibili/web/fetch_user_collection_videos?folder_id=1756059545&pn=1" ``` -------------------------------- ### Fetch Bilibili User Posted Videos Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Get a list of videos posted by a Bilibili user. Pagination is supported via the 'pn' parameter. ```bash # Get user's posted videos curl "https://api.douyin.wtf/api/bilibili/web/fetch_user_post_videos?uid=178360345&pn=1" ``` -------------------------------- ### Fetch Bilibili Video Danmaku Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Get the danmaku (real-time comments) for a Bilibili video. Requires the video's CID. ```bash # Get video danmaku (real-time comments) curl "https://api.douyin.wtf/api/bilibili/web/fetch_video_danmaku?cid=1639235405" ``` -------------------------------- ### Get Douyin Live Room Gift Ranking Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Fetches the gift ranking for a specific Douyin live room. Requires a room ID. ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_live_gift_ranking?room_id=7356585666190461731&rank_type=30" ``` -------------------------------- ### Fetch Bilibili Trending Videos Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Get a list of trending or popular videos on Bilibili. Pagination is supported via the 'pn' parameter. ```bash # Get trending/popular videos curl "https://api.douyin.wtf/api/bilibili/web/fetch_com_popular?pn=1" ``` -------------------------------- ### Fetch Bilibili Live Streamers by Category Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Get a list of live streamers within a specific Bilibili area category. Requires the area ID and supports pagination. ```bash # Get live streamers in a category curl "https://api.douyin.wtf/api/bilibili/web/fetch_live_streamers?area_id=9&pn=1" ``` -------------------------------- ### Deploy with One-Click Script (Linux) Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.md Use this script for a quick deployment on Ubuntu 20.04 LTS. Ensure you download the script to your server and execute it with sudo privileges. ```bash wget -O install.sh https://raw.githubusercontent.com/Evil0ctal/Douyin_TikTok_Download_API/main/bash/install.sh && sudo bash install.sh ``` -------------------------------- ### Start/Stop Service (Linux) Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Control the running state of the Douyin_TikTok_Download_API service using systemctl commands. ```bash sudo systemctl start Douyin_TikTok_Download_API.service ``` ```bash sudo systemctl stop Douyin_TikTok_Download_API.service ``` -------------------------------- ### Clone Repository Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/chrome-cookie-sniffer/README.md Use this command to download the source code of the extension. Alternatively, download the ZIP file and extract it. ```bash git clone # 或直接下载ZIP文件并解压 ``` -------------------------------- ### Deployment Preparation Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Essential steps and considerations before deploying the API, including handling cookie risk control and understanding limitations. ```APIDOC ## Preparation Work Before Deployment - **Crawler Cookie Risk Control:** You are responsible for managing crawler cookie risk control. Modify the configuration files and restart the service. It is recommended to use cookies from already logged-in accounts. - Douyin web cookie configuration: [https://github.com/Evil0ctal/Douyin_TikTok_Download_API/blob/30e56e5a7f97f87d60b1045befb1f6db147f8590/crawlers/douyin/web/config.yaml#L7](https://github.com/Evil0ctal/Douyin_TikTok_Download_API/blob/30e56e5a7f97f87d60b1045befb1f6db147f8590/crawlers/douyin/web/config.yaml#L7) - TikTok web-side cookies configuration: [https://github.com/Evil0ctal/Douyin_TikTok_Download_API/blob/30e56e5a7f97f87d60b1045befb1f6db147f8590/crawlers/tiktok/web/config.yaml#L6](https://github.com/Evil0ctal/Douyin_TikTok_Download_API/blob/30e56e5a7f97f87d60b1045befb1f6db147f8590/crawlers/tiktok/web/config.yaml#L6) - **Demo Site Limitations:** The online demo site's download function is disabled due to server crashing issues caused by large downloads. You can save videos by right-clicking on the parsing results page. - **Demo Site Cookies:** The cookies used on the demo site are personal and may not remain valid. Deploy your own instance for reliable access. - **TikTok Web API Direct Access:** Direct access to video links from TikTok Web API may result in HTTP 403 errors. Use the `/api/download` interface provided by this project for downloading TikTok videos. This feature is disabled on the demo site and requires self-deployment. - **Video Tutorial:** A video tutorial is available for reference: [https://www.bilibili.com/video/BV1vE421j7NR/](https://www.bilibili.com/video/BV1vE421j7NR/) ``` -------------------------------- ### Configuration File (`config.yaml`) Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Overview of key configuration options available in the `config.yaml` file for customizing API behavior. ```APIDOC ### `config.yaml` Structure ```yaml # config.yaml Web: PyWebIO_Enable: true Domain: https://douyin.wtf Max_Take_URLs: 30 API: Host_IP: 0.0.0.0 Host_Port: 80 Version: V4.1.2 Download_Switch: true # Enable/disable download endpoint Download_Path: "./download" Download_File_Prefix: "douyin.wtf_" # Platform-specific cookies (update in respective config files) # crawlers/douyin/web/config.yaml - Douyin cookie # crawlers/tiktok/web/config.yaml - TikTok cookie # crawlers/bilibili/web/config.yaml - Bilibili cookie ``` ### Key Configuration Sections: - **Web**: Controls web interface settings like PyWebIO enablement, domain, and maximum URLs. - **API**: Configures API host, port, version, download switch, download path, and file prefix. - **Platform-specific cookies**: Notes on where to update cookies for different platforms (Douyin, TikTok, Bilibili). ``` -------------------------------- ### Deploy API with Docker Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Commands for pulling the Docker image, running the container, and managing its lifecycle. Includes options for custom configuration. ```bash # Pull the latest image docker pull evil0ctal/douyin_tiktok_download_api:latest # Run the container docker run -d --name douyin_tiktok_api -p 80:80 evil0ctal/douyin_tiktok_download_api # Run with custom configuration and volume mount docker run -d --name douyin_tiktok_api -p 80:80 \ -v /path/to/your/data:/data \ -e MY_ENV_VAR=my_value \ evil0ctal/douyin_tiktok_download_api # Check container status docker ps # Stop and remove container docker stop douyin_tiktok_api && docker rm douyin_tiktok_api ``` -------------------------------- ### Parse Douyin, TikTok, or Bilibili Video with Hybrid API Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Automatically detects the platform from a share URL and returns unified video data. Use `minimal=true` for direct download URLs. ```bash curl "https://api.douyin.wtf/api/hybrid/video_data?url=https://v.douyin.com/L4FJNR3/&minimal=false" ``` ```bash curl "https://api.douyin.wtf/api/hybrid/video_data?url=https://www.tiktok.com/@tiktok/video/7339393672959757570&minimal=true" ``` ```bash curl "https://api.douyin.wtf/api/hybrid/video_data?url=https://www.bilibili.com/video/BV1M1421t7hT&minimal=true" ``` -------------------------------- ### Fetch Bilibili Live Room Video Stream Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieve the video stream URL for a Bilibili live room. Requires the room ID. ```bash # Get live room video stream curl "https://api.douyin.wtf/api/bilibili/web/fetch_live_videos?room_id=1815229528" ``` -------------------------------- ### Update Project (Linux) Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.md Navigate to the bash directory of the project and run the update script to update the project and its dependencies. Ensure this is executed within a virtual environment. ```bash cd /www/wwwroot/Douyin_TikTok_Download_API/bash && sudo bash update.sh ``` -------------------------------- ### Fetch Single TikTok Video Data Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves data for a single TikTok video using its itemId. This is the primary method for getting video-specific information. ```bash curl "https://api.douyin.wtf/api/tiktok/web/fetch_one_video?itemId=7339393672959757570" ``` -------------------------------- ### Check Running Containers Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.md Verify that the Docker container is running by listing all active containers. Look for 'douyin_tiktok_api' in the output. ```bash docker ps ``` -------------------------------- ### Docker Deployment Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Commands for deploying the API using Docker, including pulling the image, running containers, and managing their lifecycle. ```APIDOC ### Pulling the Latest Image ```bash docker pull evil0ctal/douyin_tiktok_download_api:latest ``` ### Running a Basic Container This command runs the API in detached mode, mapping host port 80 to container port 80. ```bash docker run -d --name douyin_tiktok_api -p 80:80 evil0ctal/douyin_tiktok_download_api ``` ### Running with Custom Configuration and Volume Mount This example shows how to run the container with a mounted volume for data persistence and environment variables for configuration. ```bash docker run -d --name douyin_tiktok_api -p 80:80 \ -v /path/to/your/data:/data \ -e MY_ENV_VAR=my_value \ evil0ctal/douyin_tiktok_download_api ``` ### Checking Container Status ```bash docker ps ``` ### Stopping and Removing a Container ```bash docker stop douyin_tiktok_api && docker rm douyin_tiktok_api ``` ``` -------------------------------- ### Fetch Douyin User's Liked Videos Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves a list of videos liked by a Douyin user, supporting pagination. Requires the user's `sec_user_id`. ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_user_like_videos?sec_user_id=MS4wLjABAAAAW9FWcqS7RdQAWPd2AA5fL_ilmqsIFUCQ_Iym6Yh9_cUa6ZRqVLjVQSUjlHrfXY1Y&max_cursor=0&counts=20" ``` -------------------------------- ### Fetch Douyin User's Posted Videos Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves a list of videos posted by a Douyin user, supporting pagination with `max_cursor` and `count` parameters. Requires the user's `sec_user_id`. ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_user_post_videos?sec_user_id=MS4wLjABAAAANXSltcLCzDGmdNFI2Q_QixVTr67NiYzjKOIP5s03CAE&max_cursor=0&count=20" ``` -------------------------------- ### Fetch Bilibili User Collection Folders Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieve the collection folders created by a Bilibili user using their UID. ```bash # Get user's collection folders curl "https://api.douyin.wtf/api/bilibili/web/fetch_collect_folders?uid=178360345" ``` -------------------------------- ### Add New Service Configuration Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/chrome-cookie-sniffer/README.md Modify the SERVICES constant in background.js to add support for new websites. Each service requires a name, display name, domains, and cookie domain. ```javascript const SERVICES = { douyin: { name: 'douyin', displayName: '抖音', domains: ['douyin.com'], cookieDomain: '.douyin.com' }, // 添加新服务 bilibili: { name: 'bilibili', displayName: 'B站', domains: ['bilibili.com'], cookieDomain: '.bilibili.com' } }; ``` -------------------------------- ### Fetch Bilibili Video Details Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Use this endpoint to retrieve details for a single Bilibili video using its BV ID. ```bash # Get single video details by BV ID curl "https://api.douyin.wtf/api/bilibili/web/fetch_one_video?bv_id=BV1M1421t7hT" ``` -------------------------------- ### Fetch Douyin Single Video Data by aweme_id Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves complete video metadata for a specific Douyin video using its `aweme_id`. The response includes detailed statistics and author information. ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_one_video?aweme_id=7372484719365098803" ``` -------------------------------- ### Generate Douyin msToken Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Generates the msToken, a crucial authentication token for many Douyin API requests. No parameters are required. ```bash curl "https://api.douyin.wtf/api/douyin/web/generate_real_msToken" ``` -------------------------------- ### Fetch Douyin Live Stream Data by room_id Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves live stream information for a Douyin room using its `room_id`. This endpoint is an alternative to fetching by `webcast_id`. ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_user_live_videos_by_room_id?room_id=7318296342189919011" ``` -------------------------------- ### Douyin Web Cookie Configuration Link Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Link to the configuration file for Douyin web cookies. Users need to obtain and replace their own cookies here. ```link https://github.com/Evil0ctal/Douyin_TikTok_Download_API/blob/30e56e5a7f97f87d60b1045befb1f6db147f8590/crawlers/douyin/web/config.yaml#L7 ``` -------------------------------- ### Fetch Douyin Live Stream Data by webcast_id Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves live stream information for a Douyin user using their `webcast_id`. This includes details about the ongoing live broadcast. ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_user_live_videos?webcast_id=285520721194" ``` -------------------------------- ### Douyin User Profile and Videos Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves user profile information and their posted videos with pagination support. ```APIDOC ## Douyin User Profile and Videos ### Description Retrieves user profile information and their posted videos with pagination support. ### Method GET ### Endpoint - /api/douyin/web/handler_user_profile - /api/douyin/web/fetch_user_post_videos - /api/douyin/web/fetch_user_like_videos - /api/douyin/web/fetch_user_collection_videos ### Query Parameters #### For handler_user_profile: - **sec_user_id** (string) - Required - The secure user ID. #### For fetch_user_post_videos, fetch_user_like_videos: - **sec_user_id** (string) - Required - The secure user ID. - **max_cursor** (string) - Optional - The cursor for pagination. - **count** (integer) - Optional - The number of items to retrieve per page. #### For fetch_user_collection_videos: - **cookie** (string) - Required - The user's Douyin cookie. - **max_cursor** (string) - Optional - The cursor for pagination. - **counts** (integer) - Optional - The number of items to retrieve per page. ### Request Example ```bash # Get user profile information curl "https://api.douyin.wtf/api/douyin/web/handler_user_profile?sec_user_id=MS4wLjABAAAAW9FWcqS7RdQAWPd2AA5fL_ilmqsIFUCQ_Iym6Yh9_cUa6ZRqVLjVQSUjlHrfXY1Y" # Get user's posted videos with pagination curl "https://api.douyin.wtf/api/douyin/web/fetch_user_post_videos?sec_user_id=MS4wLjABAAAANXSltcLCzDGmdNFI2Q_QixVTr67NiYzjKOIP5s03CAE&max_cursor=0&count=20" # Get user's liked videos curl "https://api.douyin.wtf/api/douyin/web/fetch_user_like_videos?sec_user_id=MS4wLjABAAAAW9FWcqS7RdQAWPd2AA5fL_ilmqsIFUCQ_Iym6Yh9_cUa6ZRqVLjVQSUjlHrfXY1Y&max_cursor=0&counts=20" # Get user's collection videos (requires user's own cookie) curl "https://api.douyin.wtf/api/douyin/web/fetch_user_collection_videos?cookie=YOUR_COOKIE&max_cursor=0&counts=20" ``` ``` -------------------------------- ### Fetch Douyin User Profile Information Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves profile information for a Douyin user using their `sec_user_id`. This is useful for obtaining user details before fetching their videos. ```bash curl "https://api.douyin.wtf/api/douyin/web/handler_user_profile?sec_user_id=MS4wLjABAAAAW9FWcqS7RdQAWPd2AA5fL_ilmqsIFUCQ_Iym6Yh9_cUa6ZRqVLjVQSUjlHrfXY1Y" ``` -------------------------------- ### Fetch Douyin User's Collection Videos Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves a list of videos saved in a Douyin user's collection. This endpoint requires the user's own cookie for authentication. ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_user_collection_videos?cookie=YOUR_COOKIE&max_cursor=0&counts=20" ``` -------------------------------- ### Fetch Douyin Video Comments Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves comments for a specific Douyin video using its `aweme_id`. Supports cursor-based pagination for fetching comments. ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_video_comments?aweme_id=7372484719365098803&cursor=0&count=20" ``` -------------------------------- ### Download Video/Image Directly with API Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Downloads videos or images directly, with options for watermark removal and prefixing filenames. For Bilibili, it automatically merges video and audio streams. ```bash curl -O "https://api.douyin.wtf/api/download?url=https://v.douyin.com/L4FJNR3/&prefix=true&with_watermark=false" ``` ```bash curl -O "https://api.douyin.wtf/api/download?url=https://www.tiktok.com/t/ZTR9nDNWq/&with_watermark=true" ``` ```bash curl -O "https://api.douyin.wtf/api/download?url=https://www.bilibili.com/video/BV1M1421t7hT&prefix=true" ``` ```bash curl -O "https://api.douyin.wtf/api/download?url=https://v.douyin.com/image_post_url/&with_watermark=false" ``` -------------------------------- ### Fetch All Bilibili Live Area Categories Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieve a list of all available live area categories on Bilibili. ```bash # Get all live area categories curl "https://api.douyin.wtf/api/bilibili/web/fetch_all_live_areas" ``` -------------------------------- ### Douyin Live Room Data Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Endpoints to fetch live room gift rankings and product information. ```APIDOC ## GET /api/douyin/web/fetch_live_gift_ranking ### Description Fetches the gift ranking for a Douyin live room. ### Method GET ### Endpoint https://api.douyin.wtf/api/douyin/web/fetch_live_gift_ranking ### Query Parameters - **room_id** (string) - Required - The ID of the live room. - **rank_type** (integer) - Required - The type of ranking to fetch (e.g., 30 for top gifts). ### Request Example ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_live_gift_ranking?room_id=7356585666190461731&rank_type=30" ``` ## GET /api/douyin/web/fetch_live_room_product_result ### Description Fetches product information from a Douyin live room. Requires a user cookie. ### Method GET ### Endpoint https://api.douyin.wtf/api/douyin/web/fetch_live_room_product_result ### Query Parameters - **cookie** (string) - Required - The user's Douyin cookie. - **room_id** (string) - Required - The ID of the live room. - **author_id** (string) - Required - The ID of the live room's author. - **limit** (integer) - Optional - The number of products to retrieve. ### Request Example ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_live_room_product_result?cookie=YOUR_COOKIE&room_id=7356742011975715619&author_id=2207432981615527&limit=20" ``` ``` -------------------------------- ### Pull Docker Image Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.md Fetch the latest Docker image for the Douyin_TikTok_Download_API from Docker Hub. Replace 'latest' with a specific version tag if needed. ```bash docker pull evil0ctal/douyin_tiktok_download_api:latest ``` -------------------------------- ### Batch Extract Douyin Video IDs Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Performs a POST request to batch extract aweme_ids from a list of Douyin video URLs. Accepts a JSON array of URLs. ```bash curl -X POST "https://api.douyin.wtf/api/douyin/web/get_all_aweme_id" \ -H "Content-Type: application/json" \ -d '["https://v.douyin.com/iRNBho6u/", "https://www.douyin.com/video/7298145681699622182"]' ``` -------------------------------- ### Generate Douyin verify_fp Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Generates the verify_fp token, which is part of the security mechanisms for Douyin API interactions. ```bash curl "https://api.douyin.wtf/api/douyin/web/generate_verify_fp" ``` -------------------------------- ### Generate Douyin A-Bogus Parameter Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Generates the A-Bogus parameter, another signing mechanism for Douyin API requests. Requires the target URL and user agent. ```bash curl "https://api.douyin.wtf/api/douyin/web/generate_a_bogus?url=https://www.douyin.com/aweme/v1/web/aweme/detail/?aweme_id=7372484719365098803&user_agent=Mozilla/5.0..." ``` -------------------------------- ### Fetch TikTok User Liked Videos Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves a list of videos that a TikTok user has liked. Requires the user's secUid and must be for public likes. ```bash curl "https://api.douyin.wtf/api/tiktok/web/fetch_user_like?secUid=MS4wLjABAAAAq1iRXNduFZpY301UkVpJ1eQT60_NiWS9QQSeNqmNQEDJp0pOF8cpleNEdiJx5_IU&cursor=0&count=35" ``` -------------------------------- ### Fetch Bilibili Video Stream URL Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieve the stream URL for a Bilibili video. Requires both the BV ID and the video's CID. ```bash # Get video stream URL (requires cid) curl "https://api.douyin.wtf/api/bilibili/web/fetch_video_playurl?bv_id=BV1y7411Q7Eq&cid=171776208" ``` -------------------------------- ### Fetch Douyin Comment Replies Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves replies to a specific comment on a Douyin video. Requires the `item_id` of the video and the `comment_id` of the parent comment, with cursor-based pagination. ```bash curl "https://api.douyin.wtf/api/douyin/web/fetch_video_comment_replies?item_id=7354666303006723354&comment_id=7354669356632638218&cursor=0&count=20" ``` -------------------------------- ### Generate Douyin X-Bogus Parameter Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Generates the X-Bogus parameter, a dynamic signature used to authenticate API requests. Requires the target URL and user agent. ```bash curl "https://api.douyin.wtf/api/douyin/web/generate_x_bogus?url=https://www.douyin.com/aweme/v1/web/aweme/detail/?aweme_id=7148736076176215311&user_agent=Mozilla/5.0..." ``` -------------------------------- ### Supported Submission Formats Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md The API supports various formats for submitting video links, including Douyin and TikTok sharing passwords, short URLs, normal URLs, discovery page URLs, and batch URLs. ```APIDOC ## Supported Submission Formats This API supports various formats for submitting video links: - **Douyin sharing password:** ```text 7.43 pda:/ 让你在几秒钟之内记住我 https://v.douyin.com/L5pbfdP/ 复制此链接,打开Dou音搜索,直接观看视频! ``` - **Douyin short URL:** ```text https://v.douyin.com/L4FJNR3/ ``` - **Douyin normal URL:** ```text https://www.douyin.com/video/6914948781100338440 ``` - **Douyin discovery page URL:** ```text https://www.douyin.com/discover?modal_id=7069543727328398622 ``` - **TikTok short URL:** ```text https://www.tiktok.com/t/ZTR9nDNWq/ ``` - **TikTok normal URL:** ```text https://www.tiktok.com/@evil0ctal/video/7156033831819037994 ``` - **Douyin/TikTok batch URL:** ```text https://v.douyin.com/L4NpDJ6/ https://www.douyin.com/video/7126745726494821640 2.84 nqe:/ 骑白马的也可以是公主%%百万转场变身https://v.douyin.com/L4FJNR3/ https://www.tiktok.com/t/ZTR9nkkmL/ https://www.tiktok.com/t/ZTR9nDNWq/ https://www.tiktok.com/@evil0ctal/video/7156033831819037994 ``` If you encounter link parsing failures, please open a new issue. ``` -------------------------------- ### Hybrid Video Parsing API Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Automatically detects the platform from a share URL (Douyin, TikTok, or Bilibili) and returns unified video data. Supports a minimal response format with direct download links. ```APIDOC ## Hybrid Video Parsing API ### Description Automatically detects the platform (Douyin, TikTok, or Bilibili) from any share URL and returns unified video data with optional minimal response format containing direct download links. ### Method GET ### Endpoint /api/hybrid/video_data ### Query Parameters - **url** (string) - Required - The share URL of the video. - **minimal** (boolean) - Optional - If true, returns a minimal response format with direct download URLs. Defaults to false. ### Request Example ```bash # Parse a Douyin video with full data response curl "https://api.douyin.wtf/api/hybrid/video_data?url=https://v.douyin.com/L4FJNR3/&minimal=false" # Parse a TikTok video with minimal data (includes direct download URLs) curl "https://api.douyin.wtf/api/hybrid/video_data?url=https://www.tiktok.com/@tiktok/video/7339393672959757570&minimal=true" # Parse a Bilibili video curl "https://api.douyin.wtf/api/hybrid/video_data?url=https://www.bilibili.com/video/BV1M1421t7hT&minimal=true" ``` ### Response #### Success Response (200) - **code** (integer) - The status code of the response. - **data** (object) - The video data. - **type** (string) - The type of content (e.g., "video"). - **platform** (string) - The platform the video is from (e.g., "douyin", "tiktok", "bilibili"). - **video_id** (string) - The unique identifier of the video. - **desc** (string) - The description of the video. - **video_data** (object) - Contains video URLs. - **wm_video_url** (string) - URL of the video with watermark. - **nwm_video_url_HQ** (string) - URL of the high-quality video without watermark. #### Response Example ```json { "code": 200, "data": { "type": "video", "platform": "douyin", "video_id": "7372484719365098803", "desc": "Video description", "video_data": { "wm_video_url": "https://...", "nwm_video_url_HQ": "https://..." } } } ``` ``` -------------------------------- ### Fetch TikTok User Playlists Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves the playlists created by a TikTok user, identified by their secUid. Supports pagination. ```bash curl "https://api.douyin.wtf/api/tiktok/web/fetch_user_play_list?secUid=MS4wLjABAAAAv7iSuuXDJGDvJkmH_vz1qkDZYo1apxgzaxdBSeIuPiM&cursor=0&count=30" ``` -------------------------------- ### Fetch Bilibili Video Comments Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieve comments for a Bilibili video using its BV ID. Pagination is supported via the 'pn' parameter. ```bash # Get video comments curl "https://api.douyin.wtf/api/bilibili/web/fetch_video_comments?bv_id=BV1M1421t7hT&pn=1" ``` -------------------------------- ### API Endpoints Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Provides API endpoints for crawling video data and downloading videos/photo albums from Douyin and TikTok. ```APIDOC ## API Endpoints ### Crawl Video Data This endpoint allows you to crawl video data from TikTok or Douyin. - **Method:** GET - **Endpoint:** `/api/hybrid/video_data` - **Query Parameters:** - **url** (string) - Required - The URL of the video. - **minimal** (boolean) - Optional - If true, returns minimal data. ### Download Videos/Photo Albums This endpoint allows you to download videos or photo albums from TikTok or Douyin. - **Method:** GET - **Endpoint:** `/api/download` - **Query Parameters:** - **url** (string) - Required - The URL of the video or photo album. - **prefix** (boolean) - Optional - If true, includes a prefix in the filename. - **with_watermark** (boolean) - Optional - If true, includes a watermark in the downloaded video. ``` -------------------------------- ### Douyin Live Stream Data Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieves live stream information including stream URLs and room details. ```APIDOC ## Douyin Live Stream Data ### Description Retrieves live stream information including stream URLs, room details, and gift rankings. ### Method GET ### Endpoint - /api/douyin/web/fetch_user_live_videos - /api/douyin/web/fetch_user_live_videos_by_room_id ### Query Parameters #### For fetch_user_live_videos: - **webcast_id** (string) - Required - The ID of the live webcast. #### For fetch_user_live_videos_by_room_id: - **room_id** (string) - Required - The ID of the live room. ### Request Example ```bash # Get live stream data by webcast_id curl "https://api.douyin.wtf/api/douyin/web/fetch_user_live_videos?webcast_id=285520721194" # Get live stream by room_id curl "https://api.douyin.wtf/api/douyin/web/fetch_user_live_videos_by_room_id?room_id=7318296342189919011" ``` ``` -------------------------------- ### Fetch Bilibili User Profile Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Retrieve the profile information for a Bilibili user using their UID. ```bash # Get user profile curl "https://api.douyin.wtf/api/bilibili/web/fetch_user_profile?uid=178360345" ``` -------------------------------- ### Douyin Video Comments Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Fetches comments and comment replies for specific videos with cursor-based pagination. ```APIDOC ## Douyin Video Comments ### Description Fetches comments and comment replies for specific videos with cursor-based pagination. ### Method GET ### Endpoint - /api/douyin/web/fetch_video_comments - /api/douyin/web/fetch_video_comment_replies ### Query Parameters #### For fetch_video_comments: - **aweme_id** (string) - Required - The unique ID of the Douyin video. - **cursor** (string) - Optional - The cursor for pagination. - **count** (integer) - Optional - The number of comments to retrieve per page. #### For fetch_video_comment_replies: - **item_id** (string) - Required - The ID of the item (video). - **comment_id** (string) - Required - The ID of the comment to fetch replies for. - **cursor** (string) - Optional - The cursor for pagination. - **count** (integer) - Optional - The number of replies to retrieve per page. ### Request Example ```bash # Get video comments curl "https://api.douyin.wtf/api/douyin/web/fetch_video_comments?aweme_id=7372484719365098803&cursor=0&count=20" # Get replies to a specific comment curl "https://api.douyin.wtf/api/douyin/web/fetch_video_comment_replies?item_id=7354666303006723354&comment_id=7354669356632638218&cursor=0&count=20" ``` ``` -------------------------------- ### Douyin Single Video Data Source: https://context7.com/evil0ctal/douyin_tiktok_download_api/llms.txt Fetches complete video metadata from Douyin using the video's aweme_id. ```APIDOC ## Douyin Single Video Data ### Description Fetches complete video metadata from Douyin using the video's aweme_id, including play counts, author info, and video URLs. ### Method GET ### Endpoint /api/douyin/web/fetch_one_video ### Query Parameters - **aweme_id** (string) - Required - The unique ID of the Douyin video. ### Request Example ```bash # Get single video data by aweme_id curl "https://api.douyin.wtf/api/douyin/web/fetch_one_video?aweme_id=7372484719365098803" ``` ### Response #### Success Response (200) - **Response includes**: video URLs, author data, statistics, music info, etc. ``` -------------------------------- ### Hybrid Parsing with douyin-tiktok-scraper Source: https://github.com/evil0ctal/douyin_tiktok_download_api/blob/main/README.en.md Use the Scraper class to perform hybrid parsing of Douyin, TikTok, or Bilibili URLs. Requires asyncio for asynchronous operations. ```python import asyncio from douyin_tiktok_scraper.scraper import Scraper api = Scraper() async def hybrid_parsing(url: str) -> dict: # Hybrid parsing(Douyin/TikTok URL) result = await api.hybrid_parsing(url) print(f"The hybrid parsing result:\n {result}") return result asyncio.run(hybrid_parsing(url=input("Paste Douyin/TikTok/Bilibili share URL here: "))) ```