A Python script to help download your favorite TikTok videos. The script adds download buttons to your favorites page and automatically handles the download process.
The project is organized into several modules for better maintainability:
main.py
- Entry point of the application. Initializes components and starts the download process.browser_manager.py
- Handles Chrome browser setup and profile management using undetected-chromedriver.tiktok_scraper.py
- Core TikTok interaction logic, including video detection and download handling.airtable_manager.py
- Manages Airtable integration for tracking downloaded videos.
Each module has a specific responsibility:
- Browser Manager: Configures and manages Chrome instances with user profiles
- TikTok Scraper: Handles all TikTok-specific operations (navigation, video detection, download buttons)
- Airtable Manager: Creates and updates records for downloaded videos
This tool is designed to be user-friendly, even if you're not familiar with programming! We recommend:
-
Using Windsurf Editor:
- Download and install Windsurf, a smart code editor that can help you set up and run this tool
- Windsurf will read this README and guide you through the setup process
- It can help you make necessary changes like setting your TikTok username
-
Before Running:
- You'll need to change the TikTok username in the code from
@dysonsmear
to your username - If you're concerned about security, feel free to:
- Review the code using ChatGPT or Claude
- Ask questions in the GitHub Issues section
- Have a tech-savvy friend review it
- You'll need to change the TikTok username in the code from
-
Safety First:
- Only download this code from the official GitHub repository
- Never enter passwords or sensitive information if prompted
- The script only needs your Chrome profile to access TikTok as you
- Uses your existing Chrome profile (no need to log in again)
- Configurable Chrome profile via
.env
file - Adds download buttons to your favorites page
- Automatically handles the download process
- Visual feedback for downloaded videos
- Works with TikTok's native download feature
- Python 3.7+
- Google Chrome browser
- Chrome profile with TikTok account
- Recommended: Windsurf Editor
- Clone this repository:
git clone https://github.com/bgarnr/DownloadSavedTiktoks.git
cd DownloadSavedTiktoks
- Install required packages:
pip install -r requirements.txt
-
Configure your Chrome profile:
- Create a
.env
file in the project directory - Add your Chrome profile name:
CHROME_PROFILE=your_profile_name
- Example:
CHROME_PROFILE=dysonsmear
- Create a
-
Update your TikTok username:
- Open
tiktok_downloader.py
in Windsurf or any text editor - Find the line with
@dysonsmear
and replace it with your TikTok username - Example: If your profile is at
tiktok.com/@your_name
, change it to@your_name
- Open
pip install -r requirements.txt
Create a .env
file in the project root with the following variables:
AIRTABLE_BASE_ID=your_base_id
AIRTABLE_ACCESS_TOKEN_VALUE=your_token
AIRTABLE_TABLE_NAME=your_table_name
TIKTOK_USERNAME=your_tiktok_username
DOWNLOAD_DIR=your_download_directory
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Drive API:
- Go to "APIs & Services" > "Library"
- Search for "Google Drive API"
- Click "Enable"
- Configure OAuth consent screen:
- Go to "APIs & Services" > "OAuth consent screen"
- Choose "External" user type
- Fill in the required information
- Add your email as a test user
- Create credentials:
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Choose "Desktop application"
- Download the credentials file
- Save it as
credentials.json
in the project root
- Create a new base in Airtable
- Create a table with the following fields:
- Video ID (Single line text)
- Description (Long text)
- Uploader (Single line text)
- Status (Single select: Downloaded, Failed)
- Video File (Attachment)
- Get your Base ID and API key from Airtable
- Close all Chrome windows
- Run the script:
python tiktok_downloader.py
- Log in using the QR code if needed
- Click the download buttons on videos you want to save
- The script will automatically handle the download process
To find your Chrome profile name:
- Open Chrome and go to
chrome://version
- Look for "Profile Path" - the last part of the path is your profile name
- Add this name to your
.env
file
Default
- The default Chrome profileProfile 1
,Profile 2
, etc. - Additional profiles- Custom named profiles will show their name
This script is designed for personal use and respects TikTok's native download functionality. Please be mindful of TikTok's terms of service and content creators' rights when downloading videos.
If you're having trouble:
- Open this project in Windsurf Editor for guided assistance
- Create an issue on GitHub with any questions
- If you're not comfortable with code, ask a technical friend to help review and set it up
Remember: Your safety is important! Always review code or ask for help if you're unsure about running something on your computer.