Skip already-downloaded TikTok IDs across runs Log failed URLs to ./failed.txt for later retry
52 lines
1.2 KiB
Markdown
52 lines
1.2 KiB
Markdown
# TikDown
|
|
|
|
TikTok video & photo downloader — CLI tool and Telegram bot powered by yt-dlp.
|
|
|
|
## Setup
|
|
|
|
```bash
|
|
pip install python-telegram-bot yt-dlp python-dotenv
|
|
```
|
|
|
|
Place `yt-dlp.exe` (or `yt-dlp`) in the project root, or set `YT_DLP_PATH` in `downloader.py`.
|
|
|
|
### Telegram bot (optional)
|
|
|
|
Create a `.env` file:
|
|
|
|
```
|
|
TELEGRAM_API_TOKEN=your_bot_token
|
|
BOT_AUTH_PASSWORD=your_password
|
|
```
|
|
|
|
Create `authorized_users.txt` with one Telegram user ID per line. Users authenticate with `/authenticate <password>`.
|
|
|
|
## CLI Usage
|
|
|
|
```bash
|
|
# Download a single video/photo
|
|
python downloader.py https://www.tiktok.com/@user/video/123456789
|
|
|
|
# Batch download from a file (one URL per line)
|
|
python downloader.py in/my-urls.txt
|
|
|
|
# Retry previously failed downloads
|
|
python downloader.py failed.txt
|
|
```
|
|
|
|
## Downloads
|
|
|
|
Videos and photos are saved to `./downloads/`. Filenames include the upload date when metadata is available:
|
|
|
|
```
|
|
./downloads/2024-12-25_123456789_username_userid.mp4
|
|
```
|
|
|
|
## Duplicate detection
|
|
|
|
Downloaded TikTok IDs are tracked in `./downloaded_ids.txt`. Before any download, the ID is checked — already-downloaded URLs are skipped automatically.
|
|
|
|
## Failed downloads
|
|
|
|
URLs that fail to download (network errors, removed videos, etc.) are appended to `./failed.txt`.
|