tiktok-api
Unofficial TikTok API library: scrape video and user profile metadata, and optionally download videos, slides, and audio. No official API key required.
Install
pip install -e .
Or install dependencies only:
pip install requests beautifulsoup4 browser_cookie3
Then use the single module tiktok_api.py from this directory (e.g. add the directory to PYTHONPATH or copy the file).
Usage
from tiktok_api import TT_Content_Scraper
scraper = TT_Content_Scraper(
wait_time=0.35,
output_files_fp="data/",
progress_file_fn="progress_tracking/scraping_progress.db",
clear_console=False,
)
# Add video IDs (from TikTok URL) and/or usernames
scraper.add_objects(ids=["7398323154424171806"], title="batch1", type="content")
scraper.add_objects(ids=["tagesschau", "tiktok"], title="users", type="user")
# Scrape: metadata only, or with media (mp4/jpeg/mp3)
scraper.scrape_pending(scrape_files=False) # metadata only
# scraper.scrape_pending(scrape_files=True) # also download videos/slides/audio
- Content: use
type="content"and video IDs from the video URL. - Users: use
type="user"and usernames (with or without@).
Output is written under output_files_fp:
content_metadata/<video_id>.json– video/post metadatauser_metadata/<username>.json– user profile metadatacontent_files/– mp4, jpeg, mp3 whenscrape_files=True
Progress is stored in the SQLite database at progress_file_fn (pending/completed/error per ID).
Run as script
python tiktok_api.py
Runs a one-off example: one video ID, metadata only, output in data/.
Metadata
Release files for tiktok-api-unofficial 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tiktok_api_unofficial-0.1.0.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tiktok_api_unofficial-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.1 kB
Release files / tiktok_api_unofficial-0.1.0.tar.gz
| Download URL | tiktok_api_unofficial-0.1.0.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
642e7880a0222b8efe0b989614e39eeae2c96baed7ee549bf2681ef8ab5d7902
|
|
BLAKE2b-256 checksum How to use checksums |
2632e65ac854b0e72e12101394e4b13c55f11ec15b3bf83c097a698564c26be4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / tiktok_api_unofficial-0.1.0-py3-none-any.whl
| Download URL | tiktok_api_unofficial-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59024864b131a020b1b93f3a177b480f67ffadc166defdaa2880ee17ab64bf03
|
|
BLAKE2b-256 checksum How to use checksums |
258f4ded7dc1743117549413be10b67ae2556457dec47b10412995967c584c1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|