🚀「Douyin_TikTok_Download_API」is an out-of-the-box high-performance asynchronousTik Tok|TikTokData crawling tool, supports API call, online batch analysis and download.
🚨If you need to use a private server to run this project, please refer to the deployment method[Docker deployment,One-click deployment]
This project is based onPyWebIO,FastAPI,AIOHTTP, fast asynchronousTik Tok/TikTokIt is a data crawling tool, and realizes online batch analysis and download of video or atlas without watermark through the web terminal, data crawling API, iOS shortcut command without watermark download and other functions. You can deploy or transform this project yourself to achieve more functions, or you can call it directly in your projectscraper.pyor install an existingpip packageAs a parsing library, it is easy to crawl data, etc...
Some simple application scenarios:
Download prohibited videos for data analysis, download without watermark for iOS (withiOS built-in shortcut command APPCooperate with this project API to realize in-app download or read clipboard download), etc.....
**Tikhub-Opi:**support
Douyin|TikTok
Crawl the author's home page video data (remove watermark link, liked video list (permissions need to be public), video comment data, background music video list data, etc...), for details, please check TikHub- API documentation. In addition, TikHub-API is faster than this project's API when capturing TikTok data.
🍔Web APP:https://douyin.wtf/
🍟API Document:https://api.douyin.wtf/docs
🌭TikHub API Document:https://api.tikhub.io/docs
💾iOS Shortcut:Shortcut release
📦️Desktop downloader (recommended by warehouse):
🛸Other repositories based on this project
scraper.py:
- Towards[Douyin|TikTok]The API submits requests and retrieves data, returns a dictionary (dict) after processing, and supports asynchronous.
web_api.py:
- Get request parameters and use
Scraper()
The class processes the data and returns it in the form of JSON, video downloads, quick calls with iOS shortcuts, and asynchronous support.
web_app.py:
- for
web_api.py
as well asscraper.py
A simple web program made to process the value entered in the web page and then use itScraper()
class processing and matchingweb_api.py
The interface output is on the webpage (similar to the separation of front and back ends)
Most of the parameters of the above files can be found inconfig. inimake changes in
.
└── Douyin_TikTok_Download_API/
├── /static -> (PyWebIO static resources)
├── web_app.py -> (Web APP)
├── web_api.py -> (API)
├── scraper.py -> (Parsing library)
├── config.ini -> (Configuration file)
├── install.sh -> (Installation bash script)
- Douyin (overseas version of Douyin: TikTok) video/picture analysis
- Batch analysis on the web page (supports Douyin/TikTok mixed submission)
- Batch download of watermark-free videos from the analysis result page on the web page (removed in V3.X and later versions, please deploy V2.X version by yourself)
- API call to get link data
- makepip packageEasily and quickly import your projects
- iOS shortcut command to quickly call APIRealize in-app download without watermark video/photo gallery
- Parse all videos on the author's homepage (Tikhub-opySupport Douyin/TikTok)
- Parse all comment information in the video (Tikhub-opySupport Douyin/TikTok)
💡Suggestions or PRs are welcome to this repository ♪(・ω・)ノ)
- Write an asynchronous downloader on the desktop to achieve local batch download
- TikHub-API adds data crawling for hash_tag pages#101
- Add support for other short video platforms, such as: Douyin Volcano, Kuaishou, Watermelon Video, Bilibili
Install the parsing library:pip install douyin-tiktok-scraper
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 share URL here: ")))
💡Tips: Including but not limited to the following examples, if you encounter link parsing failures, please open a new oneissue
- Douyin sharing password (copy in APP)
7.43 pda:/ 让你在几秒钟之内记住我 https://v.douyin.com/L5pbfdP/ 复制此链接,打开Dou音搜索,直接观看视频!
- Douyin short URL (copy in APP)
https://v.douyin.com/L4FJNR3/
- Douyin normal URL (web version copy)
https://www.douyin.com/video/6914948781100338440
- Douyin Discovery Page URL (APP Copy)
https://www.douyin.com/discover?modal_id=7069543727328398622
- TikTok short URL (copy in APP)
https://www.tiktok.com/t/ZTR9nDNWq/
- TikTok normal URL (web version copy)
https://www.tiktok.com/@evil0ctal/video/7156033831819037994
- Douyin/TikTok bulk URLs (no need to use symbols to separate)
https://v.douyin.com/L4NpDJ6/
https://www.douyin.com/video/7126745726494821640
2.84 nqe:/ 骑白马的也可以是公主%%百万转场变身https://v.douyin.com/L4FJNR3/ 复制此链接,打开Dou音搜索,直接观看视频!
https://www.tiktok.com/t/ZTR9nkkmL/
https://www.tiktok.com/t/ZTR9nDNWq/
https://www.tiktok.com/@evil0ctal/video/7156033831819037994
💡Tip: You can also view the interface documentation in the code comments of web_api.py
API documentation:
local:http://localhost:8000/docs
online:https://api.douyin.wtf/docs
TikHub-API documentation:
online:https://api.tikhub.io/docs
API demo:
-
Crawl video data (TikTok or Douyin hybrid analysis)
https://api.douyin.wtf/api?url=[视频链接/Video URL]&minimal=false
-
Download video/photo gallery (TikTok or Douyin hybrid analysis)
https://api.douyin.wtf/download?url=[视频链接/Video URL]&prefix=true&watermark=false
-
Replace domain name to download video/photo gallery
[抖音] 原始链接: https://www.douyin.com/video/7159502929156705567 替换域名: https://api.douyin.wtf/video/7159502929156705567
[TikTok] original link: https://www.tiktok.com/@evil0ctal/video/7156033831819037994 Replace Domain: https://api.douyin.wtf/@evil0ctal/video/7156033831819037994
For more demos, please check the content of the document...
💡Tips: It is best to deploy this project to a server in the United States, otherwise strange bugs may appear.
recommend everyone to useDigitaloceanThe server, mainly because of free.
Sign up with my invitation link, you can get a $200 credit, and when you spend $25 on it, I can also get a $25 reward.
My invite link:
https://m.do.co/c/9f72a27dec35
Use the script to deploy this project with one click
-
Download using wget commandinstall.shto the server and run
wget -O install.sh https://raw.githubusercontent.com/Evil0ctal/Douyin_TikTok_Download_API/main/bash/install.sh && sudo bash install.sh
-
Automatically used after running the Bash scriptconfig.pyto help you modifyconfig. ini
Please edit config.ini, all input must be numbers!
Default API port: 8000
If you want use different port input new API port here: 80
Use new port for web_api.py: 80
Default API rate limit: 10/minute
If you want use different rate limit input new rate limit here: 60
Use new rate limit: 60/minute
Default App port: 80
If you want use different port input new App port here: 8080
Use new port: 8080
- The script will then ask you which services you want to start
api: started separatelyweb_api.py
web: started separatelyweb_app.py
all: start at the same timeweb_api.py
andweb_app.py
Run API or Web? [api/web/all/quit] api
Do you want to start the api service when system boot? [y/n] y
Created symlink /etc/systemd/system/multi-user.target.wants/web_api.service → /etc/systemd/system/web_api.service.
API service will start when system boot!
Starting API...
API is running! You can visit http://your_ip:port
You can stop the api service by running: systemctl stop web_api.service
Start/stop service
- web service:
systemctl start/stop web_app.service
- api service:
systemctl start/stop web_api.service
Turn on/off autorun at startup
- web service:
systemctl enable/disable web_app.service
- api service:
systemctl enable/disable web_api.service
update item
cd /www/wwwroot/Douyin_TikTok_Download_API/bash
sudo sh update.sh
💡Docker Image repo:Docker Hub
- install docker
curl -fsSL get.docker.com -o get-docker.sh&&sh get-docker.sh &&systemctl enable docker&&systemctl start docker
- Just leave the config.ini and docker-compose.yml files
- Run the command to let the container run in the background
docker-compose up -d
- View container logs
docker logs -f douyin_tiktok_download_api
- delete container
docker rm -f douyin_tiktok_download_api
- renew
docker-compose pull && docker-compose down && docker-compose up -d
API speed test (compared to official API)
Project interface
Start: 2021/11/06 GitHub:@Evil0ctalContact:[email protected]