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 S

Installation

A prequisite to using this program is the installation of a Selenium-compatable Web Browser. Google Chrome is recommended

MacOS, Windows and Linux

$ pip install tiktok-uploader

Usage

While TikTok is strict about login in from Selenium, 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
from tiktok_uploader.upload import upload_video, upload_videos
from tiktok_uploaader.auth import AuthBackend

# single video
upload_video('video.mp4', description='this is my description', cookies='cookies.txt')

# 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_videos function which takes in a list of videos which have filenames and descriptions and are passed as follows:

from tiktok_uploader.upload import upload_videos
from tiktok_uploader.auth import AuthBackend

videos = [
{'video': 'video0.mp4', 'description': 'Video 1 is about ..'},
{'video': 'video1.mp4', 'description': 'Video 1 is about ..'}
]

auth = AuthBackend(cookies='cookies.txt')
failed = upload_videos(videos=videos, auth=auth)

for fail in failed: # each input video object which failed
    print(fail)

Authentication

Authentication uses your browser's cookies. This workaround was done due to TikTok's stricter stance on authetication.

To get your cookies, download 🍪 Get cookies.txt from the chrome web store.

Right click while on TikTok and click 🍪 Get cookies.txt to download the file.

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

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.

from random import choice

upload_videos(browser=choice(['chrome', 'safari', 'chromium', 'edge', 'firefox'])) # randomly picks a web browser (not recommended)

Supported Browsers:

  • Chrome (Recommended)
  • Safari
  • Chromium
  • Edge
  • FireFox

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

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

Accounts made using TikTok Uploader

  • @C_Span, a C-Span clips channel with split-screen video in the background

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tiktok_uploader-0.1.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for tiktok_uploader-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9d62d9a34d9a6be55550ad933a30cbed1b39856b34ce49ec879121f7b78cdbe3
MD5 4b68d36e9760e086156075effa895bcc
BLAKE2b-256 14331473b9f3fa9faece98dbb5775818506b2b2ebb1eed250bf5d1a7f49c46a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tiktok_uploader-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 16bfba9792c01904067aa9b9e3471510c7152daada3c5487b9b9c13b1e127796
MD5 06f258fbaaa2b76448b3c718c72e52f5
BLAKE2b-256 bedfcb94a1be0c1d9c98a8626d30d0d243383d2f5445815f2b8d8bef38261802

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