tiktokautouploader

repository·master·Indexed 42 days ago

https://github.com/haziq-exe/tiktokautouploader

A Python library for automating TikTok video uploads. It features bot detection evasion via the Phantomwright engine, automated captcha solving, scheduling (up to 10 days in advance), sound integration with custom audio balancing, and copyright checks. Includes support for headless mode, proxies, and a Telegram-integrated automation script called Fancy_Upload.py for folder-based uploads and remote monitoring.

Tokens
3.6K
Snippets
11
Records
17
Agent score
55%

What's inside tiktokautouploader

  1. Overview of Fancy_Upload.py features

    master

    The Fancy_Upload.py script provides several automation features for TikTok management:

    • Folder Uploads: Automatically uploads videos from a specific folder in ascending order based on filenames.
    • Randomized Intervals: To evade TikTok rate limits, uploads occur at randomized intervals between 6 to 9 hours.
    • Post-Upload Management: Successfully uploaded videos are moved to a separate folder to maintain organization.
    • Telegram Notifications: The script sends error reports and upload status updates directly to a designated Telegram group.
  2. Configure sound search modes

    master

    The search_mode parameter determines how the library locates the sound specified in sound_name:

    • 'search' (Default): Searches TikTok globally for the sound by name.
    • 'favorites': Searches only within your TikTok account's saved/favorited sounds.

    Note: For 'favorites' mode to work, the sound must already be saved to your account before running the script.

  3. Schedule TikTok uploads

    master

    To schedule an upload, you must provide both the schedule and optionally the day parameter.

    Rules for Scheduling:

    • Time Format: Use HH:MM where MM is a multiple of 5 (e.g., 14:05, 14:10).
    • Timezone: Use your local time.
    • Lead Time: The scheduled time must be at least 15 minutes in the future.
    • Maximum Window: You can only schedule up to 240 hours (10 days) in advance.
    • Month Rollover: If scheduling for the next month, you can only schedule within the first 2 days of that month, provided they are within the 10-day window from the current date.
  4. Set a custom cover image

    master

    TikTok's standard upload interface often discards custom cover images. To reliably set a cover, you must bake your desired image as the last frame of your MP4 file using FFmpeg, then pass the path to that image via the cover_image parameter. This triggers the function to use TikTok's native cover editor to select that specific frame.

    # Step 1: Encode the static image as a short clip
    ffmpeg -loop 1 -i cover.png -t 2.5 -vf "scale=1080:1920,setsar=1" \
      -c:v libx264 -pix_fmt yuv420p cover_clip.mp4
    
    # Concatenate it onto the end of your main video
    printf "file 'main.mp4'\nfile 'cover_clip.mp4'" > concat.txt
    ffmpeg -f concat -safe 0 -i concat.txt -c copy final.mp4
    # Step 2: Pass cover_image when uploading
    upload_tiktok(
        video='final.mp4',        # last frame = your cover image
        description='My caption',
        accountname='myaccount',
        cover_image='cover.png',  # triggers frame slider selection
    )
  5. Use Telegram Bot commands to control Fancy_Upload.py

    master

    Once Fancy_Upload.py is running and integrated with your Telegram bot, you can control the automation and monitor status via specific Telegram commands sent to the bot:

    • /status or /stats: Retrieves current upload status or statistics.
    • /skip: Skips the current randomized timer interval to trigger the next upload immediately.
  6. Handle first-time initialization and login

    master

    The library performs several automated setup steps during its first execution:

    1. Dependency Download: Javascript dependencies are automatically downloaded. This adds 20-30 seconds to the very first run.
    2. Account Login: When uploading to a new account for the first time, you will be prompted to log in via the browser.
    3. Cookie Storage: Once logged in, your session cookies are saved to a file named TK_cookies_(youraccountname).json. Subsequent runs will use these cookies and will not require manual login.
  7. Install tiktokautouploader

    master

    Install the package using pip. Note that Node.js must be installed on your system as some components run JavaScript. The JS dependencies (playwright, playwright-extra, puppeteer-extra-plugin-stealth) are installed automatically during the first run, provided npm is in your PATH.

    pip install tiktokautouploader
  8. Set up Telegram Automation with Fancy_Upload.py

    master

    The Fancy_Upload.py script is a standalone automation tool that extends the tiktokautouploader library. It allows for automated folder-based video uploads to TikTok with Telegram bot integration for remote control and status monitoring.

    To use this script, follow these steps:

    1. Clone the repository and navigate to the TelegramAutomation directory.
    2. Install dependencies: Ensure the core tiktokautouploader library is installed, along with any additional libraries required by Fancy_Upload.py.
    3. Configure Telegram credentials: You must obtain a Telegram bot token and a group chat ID, then manually update these values within the Fancy_Upload.py script.
    4. Run the script: Execute the script using Python.
    git clone https://github.com/TikTokAutoUploader.git
    cd TelegramAutomation
    # Install dependencies (ensure tiktokautouploader is present)
    python Fancy_Upload.py
  9. Run copyright checks before uploading

    master

    Set copyrightcheck=True to run a check before the upload starts. The upload process will stop if the video fails the check.

    upload_tiktok(video=video_path, description=description, accountname=accountname, 
                  hashtags=hashtags, copyrightcheck=True)
  10. Run headless with stealth and proxy

    master

    For automated environments, you can run the uploader without a visible browser window (headless=True), enable additional human-like delays (stealth=True), and route traffic through a proxy.

    upload_tiktok(
        video=video_path,
        description=description,
        accountname=accountname,
        headless=True,       # no browser window
        stealth=True,        # additional human-like delays on top of baseline evasion
        suppressprint=True,  # no console output
        proxy={              # optional proxy config
            'server': 'http://yourproxy:port',
            'username': 'user',
            'password': 'pass'
        }
    )