In today’s digital world, the need to store and share videos from platforms like TikTok and Douyin is growing fast. The most common hurdle is the watermark (logo) automatically added on download, which hurts both aesthetics and professionalism.
Douyin_TikTok_Download_API is an open-source tool by Evil0ctal featuring a high-performance asynchronous architecture, modern technologies, and a beginner-friendly web interface.
LEGAL NOTICE:
Use this tool only for lawful purposes. Respect copyrights and ByteDance’s terms. Do not share cookies or session information to protect your account.
Key Features
No-watermark downloads: Grab original-quality videos from TikTok/Douyin with the watermark removed.
High-throughput async processing: Built with AIOHTTP and FastAPI to handle many concurrent requests efficiently.
Multi-platform support: Beyond TikTok/Douyin, it also works with Bilibili and Kuaishou.
Integrated web UI: Uses PyWebIO so non-developers can operate it easily.
Deploy with Docker Compose
1) Prerequisites
You’ll need:
- Docker
- Docker Compose
If Docker isn’t installed: How to Install Docker on Ubuntu: A Step-By-Step Guide
2) Deployment Steps
Step 1: Clone the repository
git clone https://github.com/Evil0ctal/Douyin_TikTok_Download_API.git
cd Douyin_TikTok_Download_API
Step 2: Configure cookies (important)
The API requires valid cookies. If you’re not sure how to obtain them, see:
Detailed Guide on How to Get Douyin and TikTok Cookies
Douyin:
- Open crawlers/douyin/web/config.yaml
- Replace the cookie (line 11) with a cookie from a logged-in session on douyin.com
TikTok:
- Open crawlers/tiktok/web/config.yaml
- Replace the cookie (line 8) with a cookie from a logged-in session on tiktok.com
Step 3: Create a downloads folder
mkdir -p downloads
chmod 755 downloads
Step 4: Build & run with Docker Compose
A basic docker-compose.yml is included:
version: "3.9"
services:
douyin_tiktok_download_api:
image: evil0ctal/douyin_tiktok_download_api
network_mode: host
container_name: douyin_tiktok_download_api
restart: always
volumes:
- ./douyin_tiktok_download_api/douyin_web/config.yaml:/app/crawlers/douyin/web/config.yaml
- ./douyin_tiktok_download_api/tiktok_web/config.yaml:/app/crawlers/tiktok/web/config.yaml
- ./douyin_tiktok_download_api/tiktok_app/config.yaml:/app/crawlers/tiktok/app/config.yaml
environment:
TZ: Asia/Shanghai
PUID: 1026
PGID: 100
privileged: true
Recommended optimized version:
version: "3.9"
services:
douyin_tiktok_download_api:
build:
context: .
dockerfile: Dockerfile
container_name: douyin_tiktok_download_api
restart: unless-stopped
ports:
- "80:80"
- "443:443" # Enable HTTPS if needed
volumes:
# Mount config files from host for easy edits
- ./crawlers/douyin/web/config.yaml:/app/crawlers/douyin/web/config.yaml:ro
- ./crawlers/tiktok/web/config.yaml:/app/crawlers/tiktok/web/config.yaml:ro
- ./crawlers/tiktok/app/config.yaml:/app/crawlers/tiktok/app/config.yaml:ro
- ./crawlers/bilibili/web/config.yaml:/app/crawlers/bilibili/web/config.yaml:ro
- ./config.yaml:/app/config.yaml:ro
# Download directory
- ./downloads:/app/download
environment:
- TZ=Asia/Ho_Chi_Minh
- PUID=1000
- PGID=1000
networks:
- douyin_api_network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/docs"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
douyin_api_network:
driver: bridge
volumes:
downloads:
driver: local
Run:
# Build from source
docker-compose build
# Or pull the prebuilt image
docker-compose pull
# Start the container
docker-compose up -d
# Tail logs
docker-compose logs -f
3) Verify the deployment
- Web interface
- URL: http://localhost or http://your-server-ip
- API docs
- URL: http://localhost/docs or http://your-server-ip/docs
- Check container status
docker-compose ps
docker-compose logs douyin_tiktok_download_api
4) Useful management commands
# Stop services
docker-compose down
# Restart
docker-compose restart
# Update & rebuild
docker-compose down
docker-compose build --no-cache
docker-compose up -d
# Live logs
docker-compose logs -f douyin_tiktok_download_api
# Shell into the container
docker-compose exec douyin_tiktok_download_api bash
5) Advanced configuration
Nginx reverse proxy:
version: "3.9"
services:
nginx:
image: nginx:alpine
container_name: nginx_proxy
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/nginx/ssl:ro
depends_on:
- douyin_tiktok_download_api
networks:
- douyin_api_network
douyin_tiktok_download_api:
# ...same config as above
expose:
- "80"
networks:
- douyin_api_network
networks:
douyin_api_network:
driver: bridge
Environment variables:
- Create a .env file (nano .env)
- Paste:
# Timezone
TZ=Asia/Ho_Chi_Minh
# Port mapping
HOST_PORT=80
CONTAINER_PORT=80
# Download settings
DOWNLOAD_PATH=./downloads
MAX_DOWNLOADS=10
# API settings
API_HOST=0.0.0.0
API_PORT=80
6) Troubleshooting
Invalid cookie
- Re-check cookies in config files
- Ensure the cookie is still valid
- Restart the container after changes
Port already in use
# Check port usage
sudo netstat -tlnp | grep :80
# Change port in docker-compose.yml
ports:
- "8080:80" # use 8080 instead of 80
Container won’t start
# Inspect logs
docker-compose logs douyin_tiktok_download_api
# Check resources
docker stats douyin_tiktok_download_api
7) Security & production tips
- Use HTTPS
- Configure an SSL certificate
- Put the API behind Nginx/Traefik
- Resource limits
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
- Backups
volumes:
- ./backups:/app/backups
Set up & use with Python
System requirements
- Python 3.6+
- Git
- Stable internet connection
Installation
Step 1: Clone the repo
git clone https://github.com/Evil0ctal/Douyin_TikTok_Download_API.git
Step 2: Enter the project
cd Douyin_TikTok_Download_API
Step 3: Install dependencies
pip install -r requirements.txt
Main libraries: PyWebIO (web UI), FastAPI (API), AIOHTTP (async HTTP).
Step 4: Optional config
nano config.ini # or your preferred editor
This file lets you adjust port, host, and related options.
Quick install via pip
pip install douyin-tiktok-scraper
Usage & examples
Start the API server
Run the web application
python web_app.py
Web UI: http://localhost:8080/
Run the API server
python web_api.py
Swagger docs: http://localhost:8000/docs
API endpoints
Analyze a single Douyin/TikTok video
curl -X 'GET' \
'http://localhost:8080/api/hybrid/video_data?url=[VIDEO_URL]&minimal=false' \
-H 'accept: application/json'
Download a video
curl -X 'GET' \
'http://localhost:8080/api/download?url=[VIDEO_URL]&prefix=true&with_watermark=false' \
-H 'accept: application/json'
Other useful endpoints include:
- Get full details for a video
- Fetch all videos from a TikTok/Douyin channel
- Retrieve like counts
- List comments and replies
- Extract lists of user IDs or video IDs
- …and more
Python examples
Use as a Python library
import asyncio
from scraper import Scraper
async def download_video():
scraper = Scraper()
url = "https://www.tiktok.com/@username/video/1234567890"
result = await scraper.get_video_data(url)
print(result)
asyncio.run(download_video())
Integrate with FastAPI
from fastapi import FastAPI
from scraper import Scraper
app = FastAPI()
scraper = Scraper()
@app.get("/download")
async def download_video(url: str):
result = await scraper.get_video_data(url)
return result
Use via Web Interface
- Open your browser: http://localhost:8080/
- Paste the URL of a TikTok/Douyin video
- Analyze to process
- Download in your preferred quality
A handy tool for creators & developers
Douyin_TikTok_Download_API is more than a downloader—it’s a flexible toolkit for managing and processing social video content. With open-source code, robust features, and strong performance, it’s a solid choice for:
- Content creators: Download/edit videos without watermark issues
- Developers: Integrate into larger systems via a powerful API
- Individuals: Save favorite videos in high quality
Give Douyin_TikTok_Download_API a try and streamline your content creation and sharing workflows.
IMPORTANT:
Always respect copyright and platform terms. Only download content you’re allowed to use, or for learning/research.