Skip to main content

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 and expiry 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tiktok_uploader-0.0.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tiktok_uploader-0.0.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file tiktok_uploader-0.0.1.tar.gz.

File metadata

  • Download URL: tiktok_uploader-0.0.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for tiktok_uploader-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2b537c9d405edff4374d9668df39a93da2c85d477997e5e5a13f2ca9a0a3510c
MD5 4e1144c624c0f87fd42c9ad28d3e3623
BLAKE2b-256 48b511e7306728b5294c936429b92231ccbc28d3ef8a8bc4a8a1eea0cc597023

See more details on using hashes here.

File details

Details for the file tiktok_uploader-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tiktok_uploader-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2d40b8b622e9b1850d6e3a36915b3723c8081bb359d8b7f81bc20d97601b27b
MD5 a2e103276c1f1ffcb24175b38a747620
BLAKE2b-256 cf186d5f29e0d9446750d7bcfb79cd28378fb280a8baacf3f150fec063f2189d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page