TikTokApi
The Unofficial TikTok API Wrapper in Python 3.
What it is and what it does
TikTokApi is an unofficial Python client for fetching public data from TikTok without requiring user authentication. It uses playwright for browser automation and httpx/requests for HTTP calls to retrieve trending videos, user profiles, and related metadata. The package is designed strictly for data retrieval—it cannot post, upload, or access any authenticated user routes.
The library is async-first, requiring asyncio for most operations. Installation involves both pip and a separate playwright browser setup step. Common friction points include TikTok's bot detection (which may require proxies or valid session tokens) and the need to maintain compatibility as TikTok's internal API structure changes. The package is actively maintained and supports modern Python versions.
Use it for:
- Fetch and analyze trending TikTok videos for research, trend monitoring, or content discovery
- Retrieve public user profile data and statistics for influencer analysis or audience research
- Build a local cache or database of TikTok metadata for offline analysis or reporting
- Monitor specific TikTok trends or hashtags by periodically scraping public data
- Integrate TikTok data into a dashboard or analytics tool that does not require user posting
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Unofficial Python wrapper for retrieving public TikTok data—trending videos, user information, and other metadata—without user authentication or posting capabilities.
Yes, if you need to retrieve public TikTok data and can manage the post-install playwright setup and potential bot-detection workarounds. The package is actively maintained, has no known vulnerabilities, and carries a permissive MIT license. Install it if data retrieval is your only goal; do not install if you need to post, upload, or access authenticated user content.
Install
tiktokapi on PyPI
pip
pip install tiktokapiuv
uv add tiktokapipoetry
poetry add tiktokapiInstalling TikTokApi
Before you install
Low friction installation with a pure Python wheel, though playwright browser installation is a required post-install step. The package is actively maintained with recent commits and a healthy repository signal.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both personal and commercial projects.
Quickstart
pip install TikTokApi
python -m playwright install
from TikTokApi import TikTokApi
import asyncio
async def get_trending():
async with TikTokApi() as api:
await api.create_sessions(ms_tokens=[None], num_sessions=1)
async for video in api.trending.videos(count=10):
print(video.as_dict)
asyncio.run(get_trending())
Requires Python 3.9+; playwright browser binaries must be installed via `python -m playwright install` after pip install; TikTok may block requests and require a proxy or valid ms_token from TikTok cookies.
Verify before relying
- Whether the package reliably handles TikTok's frequent API structure changes without breaking existing code
- Proxy requirements and success rates for different proxy tiers when facing bot detection
- Performance and rate-limiting behavior under sustained data retrieval workloads
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — requests, playwright, httpx, proxyproviders |
| Maintenance | actively maintained — 135 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 147,018/month — #11,083 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tiktokapi-7.3.3-py3-none-any.whl
Keywords: tiktok, python3, api, unofficial, tiktok-api, tiktok api
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
shortzyShortzy wraps the Adlinkfly API and alternative…
permissive · top 15,000 on PyPI
TikTokLiveConnect to TikTok livestreams and receive…
permissive · top 15,000 on PyPI
instaloaderDownloads public and private Instagram…
permissive · top 15,000 on PyPI
twikitTwikit is a Twitter scraper library that lets…
permissive · top 15,000 on PyPI
pytrendsProvides an unofficial interface to download…
permissive · top 5,000 on PyPI
trendspyFetch and analyze Google Trends data including…
permissive · top 15,000 on PyPI
instagrapiUnofficial Instagram API wrapper that automates…
permissive · top 5,000 on PyPI
ScweetScrape tweets, profiles, followers, and user…
permissive · top 15,000 on PyPI
oxylabsOfficial Python client for Oxylabs web scraping…
permissive · top 15,000 on PyPI
tiktok-business-api-sdk-officialProvides Python client libraries for the TikTok…
permissive · top 15,000 on PyPI