Skip to main content

auto-tiktok

A lean Python CLI that publishes videos to TikTok by driving a real Chrome browser with your exported session cookies. No official API, no OAuth dance — just paste your cookies and post.

Inspired by xtea/auto-instagram. Built on top of the excellent tiktok-uploader package.

Why

TikTok's official Content Posting API requires business verification, app review, and a hoop-jumping approval process. If you just want to automate publishing to your own account from your own machine, browser automation with session cookies is dramatically simpler.

Install

Requires Python 3.11+.

# via uv (installs globally, isolated)
uv tool install auto-tiktok
auto-tiktok install-browser

# or via pipx
pipx install auto-tiktok
auto-tiktok install-browser

# or plain pip
pip install auto-tiktok
auto-tiktok install-browser

The install-browser step downloads the Chromium binary Playwright needs (~150 MB). You only run it once.

One-shot run without installing

uvx auto-tiktok publish --video my.mp4 --caption "..."

From source

git clone https://github.com/xtea/auto-tiktok
cd auto-tiktok
uv sync
uv run auto-tiktok install-browser

Export your TikTok cookies

  1. Install a cookie-export browser extension. Recommended:
  2. Log into tiktok.com in your browser.
  3. Open the extension on the TikTok tab and export cookies. Either Netscape .txt or JSON format works — auto-tiktok auto-detects.
  4. Import them into auto-tiktok:
auto-tiktok import-cookies ~/Downloads/cookies.txt

This filters the file down to TikTok-only entries and saves it to ~/.config/auto-tiktok/cookies.txt (or the equivalent on your platform) with chmod 600.

Usage

Publish a video

auto-tiktok publish \
  --video ./my-video.mp4 \
  --caption "behind the scenes #tutorial #indiehacker"

The caption can include hashtags directly. Compose it however you want — auto-tiktok passes it through verbatim.

For long captions, read from a file instead:

auto-tiktok publish --video ./my-video.mp4 --caption-file ./caption.txt

Dry run

Preview what will be posted without launching Chromium:

auto-tiktok publish --video ./my-video.mp4 --caption "test" --dry-run

Schedule a post

TikTok supports scheduling 20 minutes to 10 days in the future:

auto-tiktok publish --video ./my-video.mp4 --caption "drop at noon" --schedule 60

Use a custom cookies file

auto-tiktok publish --video ./my-video.mp4 --caption "..." --cookies /path/to/cookies.txt

Run headless

auto-tiktok publish --video ./my-video.mp4 --caption "..." --headless

Note: headful (default) tends to trip fewer anti-bot heuristics.

Health check

auto-tiktok doctor

Reports whether tiktok-uploader is installed, Playwright Chromium is available, and your cookies file is present and non-empty.

Troubleshooting

  • "No TikTok cookies found" — your export doesn't include the .tiktok.com domain. Make sure you're on a tiktok.com tab when exporting.
  • Upload hangs at the caption box — TikTok is showing a modal. auto-tiktok tries to dismiss them automatically on macOS, but new variants appear; run without --headless so you can see and click through.
  • 2FA / login challenges — cookies expire. Re-export them from your browser and re-run import-cookies.
  • Chromium not found — run playwright install chromium.
  • Published URL not shown — tiktok-uploader doesn't reliably return the final TikTok URL. Check your profile.

Security

  • Your sessionid cookie is a full account credential. Treat it like a password.
  • Never commit cookies.txt to source control (the bundled .gitignore blocks it).
  • If you suspect a leak, go to Settings → Security & permissions → Manage sessions on TikTok and log out all sessions to invalidate the cookie.
  • This tool makes no network calls outside Playwright's browser automation.

How it works

  1. Filters your cookies.txt to TikTok-only entries and writes a temp file.
  2. Applies two macOS-compat monkey patches to tiktok-uploader:
    • Swaps Ctrl+A → Cmd+A in the caption clear step.
    • Wraps internal _set_description / _set_interactivity with a modal-dismissal pass.
  3. Calls tiktok_uploader.upload.upload_video() which launches Chromium via Playwright, injects cookies, navigates to the upload page, fills the caption, and clicks Post.

Development

uv sync --extra dev
uv run pytest
uv run ruff check src/ tests/

Status

Alpha. Works for the author's use case on macOS with Chromium. Windows and Linux should work but are less tested. TikTok breaks selectors periodically — if you hit issues, open an issue or PR.

License

MIT. See LICENSE.

Credits

Metadata

Release files for auto-tiktok 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for auto-tiktok 0.1.0
File Size Uploaded
auto_tiktok-0.1.0.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for auto-tiktok 0.1.0
File Interpreter ABI Platform
auto_tiktok-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.9 kB

Release files / auto_tiktok-0.1.0.tar.gz

Download URL auto_tiktok-0.1.0.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f4e42c79d206c92f8bcd3c4a4bb2170248366f0f56a99b390380fa1cf4639c4a
BLAKE2b-256 checksum
How to use checksums
a808e2b3660b653ffd4b87b970276a7d4130603c128d859ac10eb90146061f4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 22, 2026.

Transparency log

Release files / auto_tiktok-0.1.0-py3-none-any.whl

Download URL auto_tiktok-0.1.0-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee418b1b5123392485a9ac9cb80e56c588ccc6a91d90016d581bb98f6fd16f6a
BLAKE2b-256 checksum
How to use checksums
9f81482928fdc6596206f8bf15f969060da7ce70788ecd0d86b313b82007d2e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page