### Install Phantomwright Browser Binaries Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/AGENT.md After installing the Python package, install the necessary browser binaries for Phantomwright. This is a one-time setup step. ```bash phantomwright_driver install chromium ``` -------------------------------- ### Install tiktokautouploader Python Package Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/AGENT.md Use pip to install the tiktokautouploader library. All other Python dependencies are installed automatically. ```bash pip install tiktokautouploader ``` -------------------------------- ### Telegram Bot Integration for Batch Uploads Source: https://context7.com/haziq-exe/tiktokautouploader/llms.txt A standalone script example that uses Telegram commands to monitor and control automated video uploads from a local directory. ```python # TelegramAutomation/Fancy_Upload.py configuration import os from tiktokautouploader import upload_tiktok # Configure paths path = r'C:\Path\To\Videos' left = os.path.join(path, '!') # Completed uploads folder # Video settings desc = 'My video description' tags = ['#fyp', '#viral', '#trending'] acct = 'mytiktokaccount' # Telegram bot settings bot_token = 'YOUR_BOT_TOKEN' group_id = -1001234567890 # Your Telegram group ID # Upload function with error handling and stats tracking def upld_vid(video): global last_vid, upld_strk, last_upload_time try: vidz = os.path.join(path, video) upload_tiktok( video=vidz, description=desc, accountname=acct, hashtags=tags, sound_name='Swimming', sound_aud_vol='background' ) print(f"Uploaded {video}") upld_strk += 1 shutil.move(vidz, os.path.join(left, video)) last_upload_time = time.time() except Exception as e: bot.send_message(chat_id=group_id, text=f"Error: {e}") upld_strk = 0 # Telegram commands available: # /status - Show upload queue status # /stats - Alias for /status # /skip - Skip current timer, start next upload immediately ``` -------------------------------- ### Clone the Repository Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/TelegramAutomation/README.md Initial step to download the project source code. ```bash git clone https://github.com/TikTokAutoUploader.git ``` -------------------------------- ### Run the Automation Script Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/TelegramAutomation/README.md Execute the standalone script to begin the automated upload process. ```bash python Fancy_Upload.py ``` -------------------------------- ### Upload with Custom Cover Image Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Shows how to upload a video and specify a custom cover image. ```APIDOC ## POST /api/upload/video/cover ### Description Uploads a video to TikTok and allows selection of a custom cover image. The cover image must be baked into the last frame of the video. ### Method POST ### Endpoint /api/upload/video/cover ### Parameters #### Request Body - **video** (str) - Required - Path to the video file - **description** (str) - Required - Caption for the video - **accountname** (str) - Required - Which account to upload on - **cover_image** (str) - Optional - Path to a PNG/JPG to use as the cover. ### Request Example ```json { "video": "final.mp4", "description": "My caption", "accountname": "myaccount", "cover_image": "cover.png" } ``` ### Response #### Success Response (200) - **status** (str) - Upload status message #### Response Example ```json { "status": "Upload successful with custom cover" } ``` ``` -------------------------------- ### Prepare and Upload Custom Cover Image Source: https://context7.com/haziq-exe/tiktokautouploader/llms.txt Provides the FFmpeg commands to append a cover frame to a video and the corresponding Python code to trigger the cover selection during upload. ```bash # Step 1: Encode cover image as short video 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 # Step 2: Create concat file printf "file 'main.mp4'\nfile 'cover_clip.mp4'" > concat.txt # Step 3: Concatenate videos ffmpeg -f concat -safe 0 -i concat.txt -c copy final.mp4 ``` ```python from tiktokautouploader import upload_tiktok # Upload with custom cover (last frame selection) result = upload_tiktok( video='final.mp4', # Video with cover as last frame description='Custom thumbnail video', accountname='myaccount', cover_image='cover.png' # Triggers cover editor frame selection ) ``` -------------------------------- ### Upload with Copyright Check Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Demonstrates how to enable the copyright check feature before uploading. ```APIDOC ## POST /api/upload/video/copyrightcheck ### Description Uploads a video to TikTok and performs a copyright check beforehand. The upload will halt if the video fails the check. ### Method POST ### Endpoint /api/upload/video/copyrightcheck ### Parameters #### Request Body - **video** (str) - Required - Path to the video file - **description** (str) - Required - Caption for the video - **accountname** (str) - Required - Which account to upload on - **copyrightcheck** (bool) - Required - Set to `True` to enable copyright check. ### Request Example ```json { "video": "video.mp4", "description": "My video description", "accountname": "myaccount", "copyrightcheck": true } ``` ### Response #### Success Response (200) - **status** (str) - Upload status message #### Response Example ```json { "status": "Copyright check passed. Uploading..." } ``` ``` -------------------------------- ### Cookie Authentication Source: https://context7.com/haziq-exe/tiktokautouploader/llms.txt Explains the first-time login flow and how the library manages session persistence via JSON cookie files. ```APIDOC ## Authentication Flow ### Description On the first run for a specific account, the library opens a visible browser for manual login. Upon successful login, cookies are saved to a file named `TK_cookies_{accountname}.json` and reused in subsequent runs. ### Usage - First run: Browser opens for manual authentication. - Subsequent runs: Library automatically reads `TK_cookies_{accountname}.json` to authenticate without user intervention. ``` -------------------------------- ### Prepare Video with Custom Cover Image Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Append a cover image as the last segment of the video to use it as a custom cover. This involves encoding the image into a short video clip using ffmpeg. ```bash # 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 ``` -------------------------------- ### Basic Video Upload Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Demonstrates a basic video upload with a caption and account name. ```APIDOC ## POST /api/upload/video ### Description Uploads a video to TikTok with a specified caption and account. ### Method POST ### Endpoint /api/upload/video ### Request Body - **video** (str) - Required - Path to the video file - **description** (str) - Required - Caption for the video - **accountname** (str) - Required - Which account to upload on ### Request Example ```json { "video": "final.mp4", "description": "My caption", "accountname": "myaccount" } ``` ### Response #### Success Response (200) - **status** (str) - Upload status message #### Response Example ```json { "status": "Upload successful" } ``` ``` -------------------------------- ### Cookie Authentication Flow Source: https://context7.com/haziq-exe/tiktokautouploader/llms.txt Illustrates how the library handles initial manual login and subsequent automated authentication using persistent cookie files. ```python from tiktokautouploader import upload_tiktok # First run for 'myaccount' - browser opens for manual login # Cookies saved to: TK_cookies_myaccount.json result = upload_tiktok( video='video.mp4', description='First upload', accountname='myaccount' # Creates TK_cookies_myaccount.json ) # Subsequent runs use saved cookies automatically result = upload_tiktok( video='video2.mp4', description='Second upload', accountname='myaccount' # Reads existing cookie file ) # Multiple accounts - each gets its own cookie file result = upload_tiktok( video='video.mp4', description='Business account post', accountname='business_account' # TK_cookies_business_account.json ) ``` -------------------------------- ### Upload TikTok Video with Full Parameters Source: https://context7.com/haziq-exe/tiktokautouploader/llms.txt Demonstrates the complete configuration options for the upload_tiktok function, including scheduling, proxy settings, and sound customization. ```python from tiktokautouploader import upload_tiktok result = upload_tiktok( # Required parameters video='path/to/video.mp4', # Path to video file description='Video caption', # Caption text (no hashtags here) accountname='tiktok_username', # Account name for cookie file # Optional parameters cover_image=None, # Path to cover image (must be last frame of video) hashtags=['#tag1', '#tag2'], # List of hashtags (with or without #) sound_name='sound name', # TikTok sound to search for sound_aud_vol='mix', # Sound volume: 'main', 'mix', 'background' schedule='14:30', # Upload time HH:MM (minute % 5 == 0) day=15, # Day of month to schedule (max 10 days ahead) copyrightcheck=False, # Run copyright check before upload suppressprint=False, # Suppress all console output headless=True, # Run browser without visible window stealth=False, # Add extra delays for detection evasion proxy=None, # Proxy config dict search_mode='search' # 'search' or 'favorites' for sounds ) ``` -------------------------------- ### Full Parameter Reference Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md A comprehensive list of all available parameters for the upload_tiktok function. ```APIDOC ## Full Parameter Reference ### Parameters - **video** (str) - Required - Path to the video file - **description** (str) - Required - Caption for the video - **accountname** (str) - Required - Which account to upload on - **cover_image** (str) - Optional - Path to a PNG/JPG to use as the cover. Must already be baked into the last frame of the video. - **hashtags** (list) - Optional - List of hashtags to include - **sound_name** (str) - Optional - Name of the TikTok sound to use - **sound_aud_vol** (str) - Optional - Audio balance: `'main'`, `'mix'`, or `'background'` - **schedule** (str) - Optional - Upload time in `HH:MM` (your local time) - **day** (int) - Optional - Day to schedule the upload for - **copyrightcheck** (bool) - Optional - Run a copyright check before uploading - **suppressprint** (bool) - Optional - Silence all progress output from the function - **headless** (bool) - Optional - Run without a visible browser window - **stealth** (bool) - Optional - Add extra delays between operations on top of the always-on Phantomwright evasion - **proxy** (dict) - Optional - Proxy server config — see docs for the expected format - **search_mode** (str) - Optional - How to find the sound: `'search'` (default) or `'favorites'` ``` -------------------------------- ### Schedule Video Upload Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Schedule a video upload for a specific time and day. The 'schedule' parameter takes a time in HH:MM format, and 'day' specifies the day of the month. ```python upload_tiktok(video=video_path, description=description, accountname=accountname, schedule='03:10', day=11) ``` -------------------------------- ### Navigate to the Telegram Automation Folder Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/TelegramAutomation/README.md Change the working directory to the location of the automation script. ```bash cd TelegramAutomation ``` -------------------------------- ### Basic Video Upload Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Upload a video to TikTok with a description and hashtags. The first run for an account requires login, which is only done once. ```python from tiktokautouploader import upload_tiktok upload_tiktok( video='path/to/your/video.mp4', description='Check out my latest TikTok video!', accountname='mytiktokaccount', hashtags=['#fun', '#viral'] ) ``` -------------------------------- ### Run TikTok Uploader Headless with Stealth and Proxy Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Execute the TikTok uploader in headless mode for automated tasks, with stealth enabled for human-like behavior, and configure a proxy server for network requests. ```python 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={ 'server': 'http://yourproxy:port', 'username': 'user', 'password': 'pass' } ) ``` -------------------------------- ### Concatenate Video Files with FFmpeg Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Use FFmpeg's concat demuxer to combine video files. Create a text file listing the video files to be concatenated, then use ffmpeg to merge them. ```bash printf "file 'main.mp4'\nfile 'cover_clip.mp4'" > concat.txt ffmpeg -f concat -safe 0 -i concat.txt -c copy final.mp4 ``` -------------------------------- ### Headless Upload with Stealth and Proxy Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Configures an upload to run in headless mode with stealth features and proxy settings. ```APIDOC ## POST /api/upload/video/advanced ### Description Uploads a video to TikTok in headless mode, with enhanced stealth capabilities and optional proxy configuration. ### Method POST ### Endpoint /api/upload/video/advanced ### Parameters #### Request Body - **video** (str) - Required - Path to the video file - **description** (str) - Required - Caption for the video - **accountname** (str) - Required - Which account to upload on - **headless** (bool) - Optional - If `True`, runs without a visible browser window. - **stealth** (bool) - Optional - If `True`, adds extra human-like delays. - **suppressprint** (bool) - Optional - If `True`, silences all console output. - **proxy** (dict) - Optional - Proxy server configuration. Expected format: `{'server': 'http://yourproxy:port', 'username': 'user', 'password': 'pass'}`. ### Request Example ```json { "video": "video.mp4", "description": "My video description", "accountname": "myaccount", "headless": true, "stealth": true, "suppressprint": true, "proxy": { "server": "http://yourproxy:port", "username": "user", "password": "pass" } } ``` ### Response #### Success Response (200) - **status** (str) - Upload status message #### Response Example ```json { "status": "Headless upload initiated successfully" } ``` ``` -------------------------------- ### Basic TikTok Video Upload Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/Documentation.md Use this function for a standard video upload to TikTok. Ensure all required parameters like video path, description, and account name are provided. Optional parameters allow for customization of hashtags, sound, and scheduling. ```python from tiktokautouploader import upload_tiktok upload_tiktok( video='path/to/your/video.mp4', description='Check out my latest video!', accountname= 'mytiktokaccount', hashtags=['#fun', '#viral'], sound_name='popular_sound', sound_aud_vol='mix', schedule='15:00', day=5, copyrightcheck=True, suppressprint=False ) ``` -------------------------------- ### Upload with TikTok Sound Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Upload a video using a TikTok sound. You can search for sounds by name or use sounds from your favorites. The sound audio volume can be adjusted. ```python # Search for a sound by name (default behaviour) upload_tiktok(video=video_path, description=description, accountname=accountname, sound_name='trending_sound', sound_aud_vol='mix') # Pull a sound from your TikTok favorites instead upload_tiktok(video=video_path, description=description, accountname=accountname, sound_name='saved_sound', sound_aud_vol='mix', search_mode='favorites') ``` -------------------------------- ### Function: upload_tiktok Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/Documentation.md Detailed documentation for the upload_tiktok function used to automate video uploads to TikTok. ```APIDOC ## Function: upload_tiktok ### Description The `upload_tiktok` function automates the process of uploading or scheduling videos to TikTok. It includes features for adding TikTok sounds, hashtags, and performing copyright checks. ### Key Features - **Scheduling**: Supports scheduling video uploads. - **Enhancements**: Allows adding TikTok sounds and hashtags. - **Safety**: Includes automated copyright checks. - **Captcha Support**: Built-in capability to solve specific Captchas. ### Important Notes - Account recommendations and limitations apply regarding TikTok account status and scheduling capabilities. - Runtime varies based on the parameters selected. ``` -------------------------------- ### Upload TikTok Video with Custom Cover Image Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Upload a TikTok video and specify a custom cover image. The cover image must be baked into the last frame of the video. This option triggers the frame slider selection. ```python upload_tiktok( video='final.mp4', # last frame = your cover image description='My caption', accountname='myaccount', cover_image='cover.png', # triggers frame slider selection ) ``` -------------------------------- ### Python Core Function Signature Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/AGENT.md The main function for uploading TikTok videos. It accepts various parameters to control the upload process, including video path, description, account details, scheduling, and proxy settings. ```python upload_tiktok( video: str, # Path to video file description: str, # Caption text (no hashtags here) accountname: str, # Account name — determines which cookie file is used hashtags=None, # List of hashtag strings e.g. ['#fun', '#viral'] sound_name=None, # TikTok sound name to search for or find in favorites sound_aud_vol='mix', # 'mix' | 'main' | 'background' schedule=None, # 'HH:MM' in local time, minute must be multiple of 5 day=None, # Day-of-month integer (requires schedule) copyrightcheck=False, suppressprint=False, headless=True, stealth=False, # Extra delays on top of Phantomwright's always-on evasion proxy=None, # {'server': '...', 'username': '...', 'password': '...'} search_mode='search', # 'search' | 'favorites' ) -> str # Returns 'Completed' or 'Error' ``` -------------------------------- ### Upload TikTok Video with Copyright Check Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/README.md Perform a copyright check before uploading a TikTok video. The upload will be stopped if the video fails the copyright check. ```python upload_tiktok(video=video_path, description=description, accountname=accountname, hashtags=hashtags, copyrightcheck=True) ``` -------------------------------- ### Upload Video to TikTok Source: https://github.com/haziq-exe/tiktokautouploader/blob/master/Documentation.md Function to upload a video file to a specified TikTok account with various configuration options. ```APIDOC ## POST /upload ### Description Uploads a video to a TikTok account. Handles authentication via cookies on the first run and supports advanced features like scheduling, sound mixing, and proxy usage. ### Method POST ### Parameters #### Request Body - **video** (str) - Required - The input path for your video file. - **description** (str) - Required - The description text for the video. - **accountname** (str) - Required - The name of the account to post on. - **hashtags** (list of str) - Optional - Array of hashtag strings. - **sound_name** (str) - Optional - Name of the TikTok sound to use. - **sound_aud_vol** (str) - Optional - Volume mix ('mix', 'background', 'main'). Default: 'mix'. - **schedule** (str) - Optional - Upload time in HH:MM format (multiples of 5). - **day** (int) - Optional - Day of the current month for scheduling. - **copyrightcheck** (bool) - Optional - Perform copyright check. Default: False. - **stealth** (bool) - Optional - Add delays to avoid detection. Default: False. - **suppressprint** (bool) - Optional - Suppress progress logs. Default: False. - **headless** (bool) - Optional - Run in headless mode. Default: True. - **proxy** (dict) - Optional - Proxy server configuration dictionary. - **search_mode** (str) - Optional - Sound lookup mode ('search', 'favorites'). Default: 'search'. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.