Skip to main content

Simple TikTok video uploader using Playwright - no API key required

Project description

TikTok Uploader

Simple TikTok video uploader using Playwright. No API key required.

Features

  • Simple API - Upload videos with one line of code
  • CLI Tool - Upload from command line
  • Session Management - Easy login flow, reusable sessions
  • GitHub Actions Ready - Works in CI/CD pipelines
  • Cross-Platform - Windows, macOS, Linux

Installation

pip install tiktok-uploader
playwright install chromium

Quick Start

1. Get Session Token (one-time)

Run this on your local machine (needs a display):

tiktok-upload auth

This opens a browser → you log in → it gives you a session token.

2. Upload Videos

CLI:

export TIKTOK_SESSION="your_token_here"
tiktok-upload video.mp4 --caption "My awesome video #fyp #viral"

Python:

from tiktok_uploader import upload

upload("video.mp4", "My awesome video #fyp #viral")

Usage

Command Line

# Login and get session token
tiktok-upload auth

# Upload a video
tiktok-upload upload video.mp4 --caption "Hello TikTok! #fyp"

# Upload with visibility setting
tiktok-upload upload video.mp4 --caption "Friends only" --visibility friends

# Check if session is valid
tiktok-upload check

Python API

from tiktok_uploader import TikTokUploader, upload

# Simple one-liner (reads TIKTOK_SESSION from env)
upload("video.mp4", "My caption #fyp")

# With more control
uploader = TikTokUploader(
    session="your_session_token",  # or reads from TIKTOK_SESSION env
    headless=True,
)

result = uploader.upload(
    video="video.mp4",
    description="My awesome video #fyp #viral",
    visibility="everyone",  # or "friends", "private"
)

if result.success:
    print("Upload successful!")
else:
    print(f"Upload failed: {result.error}")

Upload Multiple Videos

from tiktok_uploader import TikTokUploader

uploader = TikTokUploader()

videos = [
    {"video": "video1.mp4", "description": "First video #fyp"},
    {"video": "video2.mp4", "description": "Second video #viral"},
]

results = uploader.upload_many(videos)

GitHub Actions

name: Upload to TikTok

on:
  workflow_dispatch:

jobs:
  upload:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.11'

      - name: Install dependencies
        run: |
          pip install tiktok-uploader
          playwright install chromium --with-deps

      - name: Upload to TikTok
        run: tiktok-upload upload video.mp4 --caption "Automated upload! #fyp"
        env:
          TIKTOK_SESSION: ${{ secrets.TIKTOK_SESSION }}

Session Management

Getting a Session Token

tiktok-upload auth

This opens a browser for you to log in. After login, it outputs a session token.

Using the Session Token

Option 1: Environment Variable

export TIKTOK_SESSION="your_token"

Option 2: GitHub Secrets

  1. Go to your repo → Settings → Secrets → New secret
  2. Name: TIKTOK_SESSION
  3. Value: your token

Option 3: Pass directly

uploader = TikTokUploader(session="your_token")

Session Expiration

Sessions last approximately 30 days. When expired, run tiktok-upload auth again.

Error Handling

from tiktok_uploader import upload, SessionExpiredError, LoginRequiredError

try:
    upload("video.mp4", "My caption")
except LoginRequiredError:
    print("No session found. Run 'tiktok-upload auth' first.")
except SessionExpiredError:
    print("Session expired. Run 'tiktok-upload auth' to refresh.")

Requirements

  • Python 3.9+
  • Playwright (with Chromium)

Limitations

  • TikTok may change their site, which could break uploads
  • Sessions expire after ~30 days
  • Interactive login requires a display (run locally, use token in CI)

License

MIT

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

simple_tiktok_uploader-0.1.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

simple_tiktok_uploader-0.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simple_tiktok_uploader-0.1.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for simple_tiktok_uploader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a90f18cbe81fa1af41521421397533058cc12f951e6b8b9a6f404af212e482c
MD5 c4244ba0e594ffa1e8c89b5faf98e706
BLAKE2b-256 b2eb8873537a92a2fe37cd8d3227e4d70e2175a41730d1b7bde7a2c756c4d043

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simple_tiktok_uploader-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ee1baa2c5cc688d2981f810688d6e23b09b62186b9e93e154e03e595bbca518
MD5 18f6d021a83ea1fd4f635457bf94622e
BLAKE2b-256 cc6df1b466ca4b9c6e7d0ee4cad48d2fd45391d05711ff06c63d43e11b3fe74f

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