Skip to main content

An automatic TikTok video uploader w/ CLI. Uses cookies from your browser to manage authentication and upload your videos automatically.

Project description

⬆️ TikTok Uploader

Downloads

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.

$ tiktok_uploader -v video.mp4 -d "this is my description" -c cookies.txt
upload_video('video.mp4', description='this is my description', cookies='cookies.txt') # single video

# Multiple Videos
videos = [
    {'path': 'video.mp4', 'description': 'this is my description'},
    {'path': 'video2.mp4', 'description': 'this is also my description'}
]
auth = AuthBackend(cookies='cookies.txt')
upload_videos(videos=videos, auth=auth)

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

The login script does have a login_accounts function, but this gets detected by the

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_video(username='mytiktokusername', password='*******')

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(options=options)

Note: Make sure to use the right selenium options for your browser

Headless Browsers

Headless browsers do not work at this time

If more experienced in Webscraping, I would really appreciate helping make this work. undetected-chromedriver was already tried and did not work

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.1.0.tar.gz (10.9 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.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tiktok_uploader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d66bd02c9f711e342ae5ac4760062f7b7467392198c9249e9e8b1e6745105475
MD5 5f36643ea7a89f71ccec74c2b3bdb4ff
BLAKE2b-256 bfaf120f5d524e371466fd655c83ccaf505a6204e2ab875904b940eaf0096738

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tiktok_uploader-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0ebca3f85f1c79235c97a66500fdbc40c255b6670e95ed800b5da065fb82cc6
MD5 13fa36fd451a887d94034bd6cfb230b0
BLAKE2b-256 d47360ab77dff2e1e3078531a0f54872d2a87a9f494ed0cef500a402f9aa57bc

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