An automatic TikTok video uploader w/ CLI
Project description
TikTok Uploader
A selenium-based uploader for TikTok Videos
Usage
While Tik Tok is pretty good about blocking bots (giving "too many requests" with FireFox's default installation"), simply copying your session tokens is enough to bypass this restriction and be able to upload your videos.
Uploading videos
This library revolves around the 'upload_video' function which takes in a list of videos which have filenames and descriptions and are passed as follows:
videos = [
{'video': 'video0.mp4', 'description': 'Video 1 is about ..'},
{'video': 'video1.mp4', 'description': 'Video 1 is about ..'}
]
Authentication
Authentication can come in the form of either: your saved cookies from Tik Tok (recommended) or your username and password. Optionally, both can be passed, an the program will automatically try and refresh your authentication tokens if the proccess begins to fail.
Cookie-based Authentication
To have the bot use your browser's cookies, log into TikTok with the computer which will be used as the bot.
Next, download Get cookies.txt from the chrome web store.
Right click while on TikTok and click 🍪 Get cookies.txt
to download the file.
Finally, pass the saved file path to upload_videos
.
upload_videos(cookies='cookies.txt')
Optionally, if you would like to pass your own cookies you may do as an array of dictionaries with keys
name
,value
,domain
,path
andexpiry
though there really is no need
Login-based Authentication
Login-based authentication will fail if human verification is required
To use password authentication, pass your username and password as keyword arguments to upload_videos
.
upload_videos(username='mytiktokusername', password='*******')
# or
upload_videos(login_info=('mytiktokusername', '*********')
As a side note, try to avoid keeping passwords as values in your code. You can read more about why here.
Browser Selection
Google Chrome is the prefered browser for TikTokUploader. The default anti-detection techniques used in this packaged are optimized for this. However, if you wish to use a different browser you may specify that in upload_videos
.
upload_videos(browser=['chrome', 'safari', 'chromium', 'edge', 'firefox'].choice()) # randomly picks a web browser (not recommended)
Custom Driver Options
This package has a set of default modifications to Selenium which help it avoid being detected by TikTok. However, you may pass custom driver configuration options as a keyword argument.
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('start-maximized')
upload_videos(browser_agent=options)
Note: Options are Browser specific
Installation
A prequisite to using this program is the installation of a Selenium-compatable Web Browser. Google Chrome
MacOS and Linux
pip install tiktok_uploader
Windows
pip install tiktok_uploader
Initial Setup
WebDriverManager is used to manage driver versions. On intial startup, you will be promted to install the correct driver for your selected broswer.
Notes
This bot is not fool proof. I have personally not gotten banned while using this bot, but to do this, my use was kept minimal and large time gaps were placed between each action.
Without a doubt, publishing hundreds or thousands of videos sequentially will likely get you ip banned.
Please think of this package as more of a scheduled uploader for TikTok videos, rather than a spam bot
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
Hashes for tiktok_uploader-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2d40b8b622e9b1850d6e3a36915b3723c8081bb359d8b7f81bc20d97601b27b |
|
MD5 | a2e103276c1f1ffcb24175b38a747620 |
|
BLAKE2b-256 | cf186d5f29e0d9446750d7bcfb79cd28378fb280a8baacf3f150fec063f2189d |