Skip to content

Tiktok auto downloader Automatically monitor TikTok users and download new videos with smart timestamp filtering. Features geo-bypass, anti-bot delays, SQLite tracking, and VPN support. Perfect for archiving content from your favorite creators.

License

Notifications You must be signed in to change notification settings

gabrielrahbar/TikTokAutoDownloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 TikTok Auto Downloader

Python Licence yt-dlp Integration Tests

Automatically monitor TikTok users and intelligently download only new videos. Features timestamp-based tracking to avoid duplicates and anti-bot behavior to appear human-like.

✨ Features

  • πŸ€– Automatic monitoring - Periodically checks for new videos
  • 🎯 Smart timestamp filtering - Downloads only truly new videos (no duplicates)
  • πŸ—„οΈ SQLite database - Tracks downloaded videos and metadata
  • 🌍 Automatic geo-bypass - Circumvents geographical restrictions
  • πŸͺ Cookie support - For restricted or private videos
  • ⏱️ Anti-bot delays - Randomized delays between downloads
  • πŸ”” Desktop notifications - Get alerted when new videos are downloaded
  • πŸ“ Professional logging - Detailed logs with file and console output
  • πŸ”„ Automatic retry - Handles network errors and rate limiting
  • πŸ“Š Reports & statistics - View downloads, views, likes
  • πŸ‘₯ Multi-user - Monitor multiple users simultaneously
  • 🎨 Interactive menu - User-friendly CLI with guided options
  • πŸ“ Organized downloads - Files named by author and date
  • βš™οΈ Configuration file - Customize settings with config.yaml

Highly Recommended

VPN Usage

Even if you're not in a restricted country, using a VPN is strongly recommended:

  • βœ… Better privacy - Masks your IP address from TikTok
  • βœ… Avoid rate limiting - Reduces risk of temporary bans
  • βœ… Consistent downloads - More stable connection to TikTok servers
  • βœ… Geographic diversity - Access content from different regions

Recommended VPN locations:

  • πŸ‡ΊπŸ‡Έ United States (best compatibility)
  • πŸ‡¨πŸ‡¦ Canada
  • πŸ‡©πŸ‡ͺ Germany

IMPORTANT ⚠️ Detailed restrictions list: View complete country restrictions list

Note: Restrictions change frequently. Some videos may be unavailable in specific regions regardless of country-level restrictions.

Setup:

# 1. Connect to VPN (USA recommended)
# 2. Run the monitor
python tiktok_monitor.py --auto --users username

# The built-in geo-bypass will work better with VPN active
## πŸš€ Installation

### Requirements
- Python 3.7 or higher
- pip (Python package manager)

### Quick Setup

```bash
# 1. Clone the repository
git clone https://github.com/gabrielrahbar/TikTokAutoDownloader.git
cd TikTokAutoDownloader

# 2. Install dependencies
pip install -r requirements.txt

# 3. Verify installation
python check_installation.py

If you see this output, you're ready:

βœ… EVERYTHING OK! Installation completed successfully!

πŸ“– Usage

Mode 1: Interactive Menu (Recommended)

The easiest way to get started:

python tiktok_monitor.py

You'll see this menu:

╔════════════════════════════════════════════════════════════╗
β•‘              TikTok Monitor - Main Menu v2.3               β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

πŸ‘₯ USER MANAGEMENT
  1. βž• Add user to monitor
  2. πŸ“‹ List monitored users
  3. ❌ Remove user from monitoring
  ...

Example workflow:

  1. Choose 1 to add a user (e.g., charlidamelio)
  2. Choose 7 to start automatic monitoring
  3. The bot will check every 30 minutes [Default] (you can choose it) and download new videos

Mode 2: Command Line (Advanced)

# Add users and start automatic monitoring (every 30 min)
python tiktok_monitor.py --auto --interval 30 --users charlidamelio khaby.lame

# Check once only (no loop)
python tiktok_monitor.py --check-once --users charlidamelio

# Show statistics
python tiktok_monitor.py --stats

Mode 3: Manual single download

To download a single video:

# Basic download
python tiktok_downloader_advanced.py https://www.tiktok.com/@user/video/123456789

# With cookies (for geo-restrictions)
python tiktok_downloader_advanced.py --cookies tiktok_cookies.txt URL

# Show cookie export instructions
python tiktok_downloader_advanced.py --help-cookies

πŸ› οΈ User Management CLI

Quick script to manage users without interactive menu:

# List all monitored users
python manage_users.py --list

# Add new user
python manage_users.py --add username

# Remove user (disable)
python manage_users.py --remove username

# Permanently delete (with confirmation)
python manage_users.py --delete username

# Re-enable disabled user
python manage_users.py --enable username

βš™οΈ Configuration File

Customizable settings using a config.yaml file in the project root.

monitor:
  interval_minutes: 30
  output_dir: "./tiktok_downloads"

download:
  quality: "best" 
  geo_bypass: true

notifications:
  enabled: false

πŸ“Š Reports & Statistics

View detailed download report:

python view_report.py

Example output:

╔════════════════════════════════════════════════════════════╗
β•‘                  TikTok Monitor Report                     β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

πŸ“Š GENERAL STATISTICS
────────────────────────────────────────────────────────────
Downloaded videos:  142
Total views:        1,245,890
Total likes:        89,234

πŸ‘₯ BY AUTHOR
────────────────────────────────────────────────────────────
@charlidamelio         45 videos  |  890,234 views  |  67,123 likes
@khaby.lame           38 videos  |  234,567 views  |  12,345 likes
...

πŸͺ Setting Up Cookies (for geo-restrictions)

If you get errors like "Video not available in your country":

Method 1: Browser Extension (Easiest)

  1. Install "Get cookies.txt LOCALLY" extension

  2. Go to tiktok.com and login

  3. Click extension icon β†’ Export

  4. Save as tiktok_cookies.txt

  5. Use cookies:

    python tiktok_downloader_advanced.py --cookies tiktok_cookies.txt URL

Method 2: VPN (Recommended)

Connect to a VPN (USA/UK) before running downloads. The automatic geo-bypass will handle the rest.

πŸ“ Main Project Structure

TikTokAutoDownloader/
β”œβ”€β”€ tiktok_monitor.py              # πŸ€– Main monitor with interactive menu
β”œβ”€β”€ tiktok_downloader_advanced.py  # πŸ“₯ Standalone downloader
β”œβ”€β”€ manage_users.py                # πŸ‘₯ CLI user management
β”œβ”€β”€ view_report.py                 # πŸ“Š Reports and statistics
β”œβ”€β”€ check_installation.py          # βœ… Installation verification
β”œβ”€β”€ requirements.txt               # πŸ“¦ Python dependencies
β”œβ”€β”€ README.md                      # πŸ“– This guide
β”œβ”€β”€ LICENSE                        # βš–οΈ MIT License
β”œβ”€β”€ .gitignore                     # 🚫 Files to ignore
β”œβ”€β”€ tiktok_downloads/              # πŸ“ Downloaded videos (auto-created)
└── tiktok_monitor.db              # πŸ—„οΈ SQLite database (auto-created)

βš™οΈ How It Works

Timestamp Filtering System

The monitor uses an intelligent timestamp-based system:

  1. First run: Saves the timestamp of the most recent video
  2. Subsequent checks: Downloads only videos with timestamp > last saved
  3. Anti-duplicates: Also checks database for safety
  4. Update: Always saves the timestamp of the newest downloaded video

This prevents the "false new videos" problem that other scrapers have.

Anti-Bot Behavior

To avoid TikTok bans:

  • ⏱️ Randomized delays between downloads (5-15 seconds)
  • 🎲 Delays between different users (10-30 seconds)
  • 🌐 User-Agent rotation
  • πŸ“… Variable check intervals (Β±10%)

Database Schema

The SQLite database tracks:

  • videos: id, url, title, author, timestamp, likes, views, file_path
  • monitored_users: username, last_check, last_video_timestamp, total_videos

πŸ”§ Troubleshooting

Problem: "yt-dlp not found"

pip install --upgrade yt-dlp

Problem: "Video not available in your country"

Use cookies (see Cookies section above) or connect to a VPN.

Problem: "Database is locked"

Close all monitor instances before restarting:

# Linux/Mac
pkill -f tiktok_monitor.py

# Windows (Task Manager)
Search "python" and close the processes

Problem: Slow downloads or timeouts

Increase timeout by modifying yt-dlp options in code or use a more stable connection.

Problem: "Too many requests"

The bot is going too fast. Increase delays in tiktok_monitor.py:

# Around line ~300
delay = random.uniform(10, 20)  # Increase these values

Verify Installation

python check_installation.py

🀝 Contributing

Contributions are welcome!

  1. Fork the project
  2. Create a branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

See CONTRIBUTING.md for details.

⚠️ Legal Notice

For personal and educational use only.

  • βš–οΈ Respect TikTok's Terms of Service
  • πŸ“ Video rights belong to their respective authors
  • 🚫 Do not use to redistribute content without permission
  • ⚠️ The author is not responsible for misuse of this software

πŸ“ Changelog

v2.4

  • 🎯 User-friendly error handling with clear solutions
  • πŸ“‹ ConfigManager for YAML-based configuration
  • πŸ”” Desktop notifications for new downloads
  • πŸ“Š Professional logging system with daily rotation
  • πŸ”„ Smart retry logic based on error type
  • βœ… Integration tests for TikTok API
  • πŸ§ͺ Comprehensive unit tests

v2.0

  • ✨ Added timestamp-based filtering (no more duplicates)
  • 🎯 Limited check to last 5 videos per user
  • πŸ› οΈ Improved anti-bot with randomized delays
  • πŸ“Š Added view_report.py for statistics
  • πŸ‘₯ Added manage_users.py for CLI
  • βœ… Added check_installation.py

v1.0

  • πŸŽ‰ Initial release
  • πŸ€– Basic automatic monitoring
  • πŸ“₯ Download with geo-bypass

πŸ“¬ Contact

Author: gabrielrahbar

πŸ“„ License

This project is released under the MIT License. See the LICENSE file for details.


⭐ If this project is useful to you, leave a star on GitHub! ⭐

Made with ❀️ by gabrielrahbar

About

Tiktok auto downloader Automatically monitor TikTok users and download new videos with smart timestamp filtering. Features geo-bypass, anti-bot delays, SQLite tracking, and VPN support. Perfect for archiving content from your favorite creators.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages