A modular Python package for downloading and uploading TikTok videos
Project description
TikTok Reup - Python Package
A modular Python package for downloading and uploading TikTok videos with enhanced organization and maintainability.
๐ Features
- ๐ Modular Architecture: Clean separation of concerns with organized modules
- โฌ๏ธ Download TikTok Videos: Download videos from any TikTok user profile
- ๐ฏ Single Video Download: Download individual videos by URL
- โฌ๏ธ Automated Upload: Upload downloaded videos back to TikTok with captions
- ๐ Bulk Operations: Handle multiple videos efficiently
- ๐ Multiple Download Methods: API scraping and Selenium fallback
- ๐ Caption Management: Automatic caption extraction and upload
- ๐ Progress Tracking: Visual progress bars and status updates
๐ฆ Installation
Option 1: Install from Source (Development)
# Clone the repository
git clone https://github.com/xuancuong2006/tiktok-reup.git
cd tiktok-reup
# Install in development mode
pip install -e .
Option 2: Install as Package
# Install from local directory
pip install .
Option 3: Install Dependencies Only
pip install -r requirements.txt
๐ Quick Start
As a Python Package
from tiktok_reup import TikTokDownloader, TikTokUploader, SeleniumHandler
# Initialize downloader
downloader = TikTokDownloader("downloads")
# Download videos from a user
downloader.download_user_videos("username", max_videos=10)
# Download single video
downloader.download_single_video("https://www.tiktok.com/@user/video/123456789")
# Initialize uploader
selenium_handler = SeleniumHandler()
uploader = TikTokUploader(selenium_handler)
# Upload videos
uploader.bulk_upload_videos("downloads/username", upload_limit=5)
As a Command Line Tool
# Run the CLI interface
tiktok-reup
# Or run the module directly
python -m tiktok_reup.cli
๐ Package Structure
tiktok_reup/
โโโ ๐ api/ # TikTok API handling
โ โโโ __init__.py
โ โโโ tiktok_api.py
โโโ ๐ config/ # Configuration settings
โ โโโ __init__.py
โ โโโ settings.py
โโโ ๐ core/ # Core downloader functionality
โ โโโ __init__.py
โ โโโ downloader.py
โโโ ๐ selenium_handler/ # Browser automation
โ โโโ __init__.py
โ โโโ browser.py
โโโ ๐ upload/ # Upload functionality
โ โโโ __init__.py
โ โโโ uploader.py
โโโ ๐ utils/ # Utility functions
โ โโโ __init__.py
โ โโโ helpers.py
โโโ __init__.py # Package initialization
โโโ cli.py # Command line interface
๐ฎ Usage Examples
Download Examples
from tiktok_reup import TikTokDownloader
# Create downloader instance
downloader = TikTokDownloader("my_downloads")
# Download all videos from a user
downloader.download_user_videos("cooluser123")
# Download limited number of videos
downloader.download_user_videos("cooluser123", max_videos=5)
# Download single video with custom filename
downloader.download_single_video(
"https://www.tiktok.com/@user/video/123456789",
custom_filename="my_video"
)
Upload Examples
from tiktok_reup import TikTokUploader, SeleniumHandler
# Initialize selenium handler and uploader
selenium_handler = SeleniumHandler()
uploader = TikTokUploader(selenium_handler)
# Login to TikTok (manual browser login)
uploader.login_to_tiktok()
# Upload videos from a folder
uploader.bulk_upload_videos("downloads/username")
# Upload with limit
uploader.bulk_upload_videos("downloads/username", upload_limit=3)
Configuration
from tiktok_reup import settings
# Access configuration
print(settings.DEFAULT_DOWNLOAD_FOLDER)
print(settings.MAX_CAPTION_LENGTH)
# Modify settings (if needed)
settings.DEFAULT_UPLOAD_DELAY = 20 # seconds between uploads
๐ง API Reference
TikTokDownloader
class TikTokDownloader:
def __init__(self, download_folder="downloads"):
"""Initialize downloader with custom download folder"""
def download_user_videos(self, username, max_videos=None):
"""Download all videos from a TikTok user"""
def download_single_video(self, video_url, custom_filename=None):
"""Download a single video by URL"""
def close_browser(self):
"""Close any open browser instances"""
TikTokUploader
class TikTokUploader:
def __init__(self, selenium_handler):
"""Initialize uploader with selenium handler"""
def login_to_tiktok(self):
"""Login to TikTok (manual browser login)"""
def upload_video(self, video_path, caption_path, custom_caption=None):
"""Upload a single video with caption"""
def bulk_upload_videos(self, user_folder, upload_limit=None):
"""Upload multiple videos from folder"""
โ๏ธ Configuration
Settings File (config/settings.py)
# Default settings
DEFAULT_DOWNLOAD_FOLDER = "downloads"
DEFAULT_UPLOAD_DELAY = 15 # seconds between uploads
MAX_CAPTION_LENGTH = 2200
MAX_SCROLLS = 5
UPLOAD_TIMEOUT = 120 # seconds
# Browser options
CHROME_OPTIONS_HEADLESS = [...] # Headless browsing options
CHROME_OPTIONS_UPLOAD = [...] # Upload browsing options
# API endpoints
API_ENDPOINTS = [...] # TikTok API endpoints
๐ Requirements
- Python 3.8+
- Google Chrome browser (for Selenium)
- All packages listed in
requirements.txt:- requests>=2.31.0
- tqdm>=4.65.0
- colorama>=0.4.6
- yt-dlp>=2023.7.6
- selenium>=4.15.0
- webdriver-manager>=4.0.1
- urllib3>=1.26.0
- certifi>=2023.7.22
๐ Security & Privacy
- Manual Login: Upload functionality requires manual login for security
- No Credentials Stored: The package does not store any login credentials
- Respectful Usage: Built-in delays to avoid rate limiting
- Terms Compliance: Please respect TikTok's Terms of Service
๐ ๏ธ Development
Install for Development
# Clone repository
git clone https://github.com/xuancuong2006/tiktok-reup.git
cd tiktok-reup
# Install in development mode
pip install -e .
# Install development dependencies
pip install -r requirements.txt
Building the Package
# Build distribution packages
python -m build
# Install locally
pip install dist/tiktok_reup-2.0.0-py3-none-any.whl
Running Tests
# Run the CLI interface
python -m tiktok_reup.cli
# Or use the installed command
tiktok-reup
๐ Module Descriptions
Core Module (core/downloader.py)
- Main
TikTokDownloaderclass - Video downloading logic
- User video scanning
- File management
API Module (api/tiktok_api.py)
TikTokAPIclass for API interactions- Multiple API endpoint handling
- Direct URL downloading
- JSON response parsing
Selenium Handler (selenium_handler/browser.py)
SeleniumHandlerclass for browser automation- User profile scraping
- Upload automation
- Login management
Upload Module (upload/uploader.py)
TikTokUploaderclass for upload operations- Bulk upload functionality
- Caption processing
- Upload status tracking
Utils Module (utils/helpers.py)
- Utility functions used across modules
- File naming and sanitization
- Caption processing
- BMP character filtering
Config Module (config/settings.py)
- Centralized configuration
- Browser options
- API endpoints
- CSS selectors
๐จ Troubleshooting
Common Issues
-
Chrome Driver Issues
# Update webdriver-manager pip install --upgrade webdriver-manager
-
Import Errors
# Reinstall package pip uninstall tiktok-reup pip install -e .
-
Upload Issues
- Ensure Chrome browser is installed
- Check TikTok login status
- Verify internet connection
Getting Help
- ๐ฑ Telegram: t.me/xuancuong2006
- ๐ Issues: GitHub Issues
- ๐ Documentation: See source code comments
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
โ ๏ธ Disclaimer
This software is for educational purposes only. Please respect TikTok's Terms of Service and applicable laws when using this software. The authors are not responsible for any misuse of this software.
๐จโ๐ป Author
Created by xuancuong2006
- ๐ฑ Telegram: t.me/xuancuong2006
- ๐ GitHub: xuancuong2006
โญ Star this repository if you find it helpful!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tiktok_reup-2.0.0.tar.gz.
File metadata
- Download URL: tiktok_reup-2.0.0.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c82fd8ed6de7fb5fa6cadbaa9d59bb80db87c2259a4bd53541cd5ce029c2ea8
|
|
| MD5 |
8ff3c509d1e8c675780753505ac6f459
|
|
| BLAKE2b-256 |
73a30ecd41a34a161ffcd35a1f2d8317143ca64f90b0b8c5cc62db22a2f754ad
|
File details
Details for the file tiktok_reup-2.0.0-py3-none-any.whl.
File metadata
- Download URL: tiktok_reup-2.0.0-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d9709cac67722b692df682449020c9b485d46e069a97727576ef09191d0a0f1
|
|
| MD5 |
33674a5ef7fc3ad282be6adff5599c4c
|
|
| BLAKE2b-256 |
dea44b3947e4a0321bd112fb1bce0847412597246147e7075212e9deeff58a5b
|