A lean CLI that publishes videos to TikTok via Chrome automation + exported session cookies.
Project description
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+.
Quick install (recommended)
# 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
- Install a cookie-export browser extension. Recommended:
- Get cookies.txt LOCALLY (Chrome) — exports Netscape
.txt - Cookie-Editor (all browsers) — exports JSON
- Get cookies.txt LOCALLY (Chrome) — exports Netscape
- Log into tiktok.com in your browser.
- Open the extension on the TikTok tab and export cookies. Either Netscape
.txtor JSON format works — auto-tiktok auto-detects. - 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.comdomain. 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
--headlessso 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-uploaderdoesn't reliably return the final TikTok URL. Check your profile.
Security
- Your
sessionidcookie is a full account credential. Treat it like a password. - Never commit
cookies.txtto source control (the bundled.gitignoreblocks it). - If you suspect a leak, go to
Settings → Security & permissions → Manage sessionson TikTok and log out all sessions to invalidate the cookie. - This tool makes no network calls outside Playwright's browser automation.
How it works
- Filters your
cookies.txtto TikTok-only entries and writes a temp file. - Applies two macOS-compat monkey patches to
tiktok-uploader:- Swaps
Ctrl+A→Cmd+Ain the caption clear step. - Wraps internal
_set_description/_set_interactivitywith a modal-dismissal pass.
- Swaps
- 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
- xtea/auto-instagram for the architectural blueprint.
tiktok-uploaderfor the underlying browser automation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file auto_tiktok-0.1.0.tar.gz.
File metadata
- Download URL: auto_tiktok-0.1.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4e42c79d206c92f8bcd3c4a4bb2170248366f0f56a99b390380fa1cf4639c4a
|
|
| MD5 |
93252e4b6ccf4bd0233f33769b72340b
|
|
| BLAKE2b-256 |
a808e2b3660b653ffd4b87b970276a7d4130603c128d859ac10eb90146061f4a
|
Provenance
The following attestation bundles were made for auto_tiktok-0.1.0.tar.gz:
Publisher:
release.yml on xtea/auto-tiktok
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
auto_tiktok-0.1.0.tar.gz -
Subject digest:
f4e42c79d206c92f8bcd3c4a4bb2170248366f0f56a99b390380fa1cf4639c4a - Sigstore transparency entry: 1359349937
- Sigstore integration time:
-
Permalink:
xtea/auto-tiktok@050ca0c682358c7f5b3955acf59f286f22565af5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/xtea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@050ca0c682358c7f5b3955acf59f286f22565af5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file auto_tiktok-0.1.0-py3-none-any.whl.
File metadata
- Download URL: auto_tiktok-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee418b1b5123392485a9ac9cb80e56c588ccc6a91d90016d581bb98f6fd16f6a
|
|
| MD5 |
827f24e2738045c1174d24c99b98e173
|
|
| BLAKE2b-256 |
9f81482928fdc6596206f8bf15f969060da7ce70788ecd0d86b313b82007d2e7
|
Provenance
The following attestation bundles were made for auto_tiktok-0.1.0-py3-none-any.whl:
Publisher:
release.yml on xtea/auto-tiktok
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
auto_tiktok-0.1.0-py3-none-any.whl -
Subject digest:
ee418b1b5123392485a9ac9cb80e56c588ccc6a91d90016d581bb98f6fd16f6a - Sigstore transparency entry: 1359349978
- Sigstore integration time:
-
Permalink:
xtea/auto-tiktok@050ca0c682358c7f5b3955acf59f286f22565af5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/xtea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@050ca0c682358c7f5b3955acf59f286f22565af5 -
Trigger Event:
push
-
Statement type: