Unofficial TikTok API library: scrape video/user metadata and optionally download media (no API key required)
Project description
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/.
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 tiktok_api_unofficial-0.1.0.tar.gz.
File metadata
- Download URL: tiktok_api_unofficial-0.1.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
642e7880a0222b8efe0b989614e39eeae2c96baed7ee549bf2681ef8ab5d7902
|
|
| MD5 |
d6f40a6209af6652297d5a85105b5c23
|
|
| BLAKE2b-256 |
2632e65ac854b0e72e12101394e4b13c55f11ec15b3bf83c097a698564c26be4
|
File details
Details for the file tiktok_api_unofficial-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tiktok_api_unofficial-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59024864b131a020b1b93f3a177b480f67ffadc166defdaa2880ee17ab64bf03
|
|
| MD5 |
b47e2dd080a6fcac4728e0b271224fb2
|
|
| BLAKE2b-256 |
258f4ded7dc1743117549413be10b67ae2556457dec47b10412995967c584c1f
|