Pinchana TikTok
radimbig-pinchana-tiktok is an unofficial PyPI distribution of the Pinchana
TikTok scraper maintained by radimbig. The Python import remains
pinchana_tiktok; the upstream project is
https://github.com/Pinchana/pinchana-tiktok.
This FastAPI module and importable Python library extract supported TikTok posts through a dedicated yt-dlp workflow. It handles ordinary videos and photo slideshows, including slideshow background audio when available.
Install and library usage
pip install radimbig-pinchana-tiktok
from pinchana_tiktok import download_tiktok_post_assets
result = download_tiktok_post_assets(
post_url="https://www.tiktok.com/@creator/video/1234567890",
temp_directory="./temp_videos",
user_id=42,
request_id="abc123",
)
The result contains caption, author_username, and ordered files. Each file
has a media_type of video, photo, or audio. Call this synchronous API
from a worker thread when the host application already runs an asyncio loop.
Processing flow
- Resolve supported canonical and short TikTok URLs.
- Extract media metadata with the project extractor.
- Reuse anonymous cookies, pace upstream work globally, and retry temporary failures within a bounded policy.
- When the deployment-wide VPN is enabled, rotate Gluetun once after a confirmed platform block.
- Download ordered media to
/app/cache/tiktok/{post_id}in containers.
The gateway's API v1 response represents slideshow images as ordered content assets and their audio as a soundtrack asset.
API
POST /scrapeaccepts{"url":"https://www.tiktok.com/@account/video/POST_ID"}.GET /healthreports module and VPN readiness.
External clients should call the gateway's authenticated POST /v1/scrape route.
Configuration
| Variable | Default | Purpose |
|---|---|---|
CACHE_PATH |
./cache |
Base media cache path |
CACHE_MAX_SIZE_GB |
10.0 |
Maximum cache size before eviction |
TIKTOK_REQUEST_INTERVAL_SECONDS |
0.5 |
Delay between upstream requests to reduce burst-rate throttling |
TIKTOK_PROXY_URL |
empty | Optional HTTP/SOCKS proxy applied to extraction and every media download |
TIKTOK_COOKIES_BASE64 |
empty | Base64-encoded Netscape cookies; highest priority |
TIKTOK_COOKIES |
empty | Raw Netscape cookie text, including escaped newlines |
TIKTOK_COOKIES_FILE |
empty | Path to a Netscape cookies file |
GLUETUN_CONTROL_URL |
http://localhost:8000 |
Private Gluetun control endpoint |
Cookies are passed to extraction, short-link resolution, and every media download request. Never commit or log their values; use a separate, age-verified TikTok account and refresh the export when TikTok rejects it.
Development
uv sync --frozen
uv run uvicorn pinchana_tiktok.main:app --host 0.0.0.0 --port 8081 --reload
# Run from the parent pinchana-api directory.
docker build --file pinchana-tiktok/Dockerfile --tag pinchana-tiktok:local .
Development Compose keeps VPN_ENABLED=false. VPN operation is controlled only
by the deployment-wide VPN_ENABLED setting; there is no TikTok-specific VPN
toggle. The scraper prefers anonymous public access but accepts operator-supplied
account cookies for posts requiring login or audience confirmation. It does not
use fabricated mobile identifiers or CAPTCHA-solving services.
Live tests are opt-in. Set PINCHANA_TIKTOK_LIVE=1 and provide the four
TIKTOK_LIVE_*_URL values documented in .env.example before running pytest.
Publishing
Pushing a v* tag builds wheel/sdist artifacts and publishes them to PyPI using
the repository secret PYPI_API_TOKEN.
Metadata
Release files for radimbig-pinchana-tiktok 1.0.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 | Provenance | Actions |
|---|---|---|---|---|
| radimbig_pinchana_tiktok-1.0.0.tar.gz | 15.9 kB | Without provenance | Details for radimbig_pinchana_tiktok-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| radimbig_pinchana_tiktok-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for radimbig_pinchana_tiktok-1.0.0-py3-none-any.whl |
Total release size: 34.6 kB
Release files / radimbig_pinchana_tiktok-1.0.0.tar.gz
| Download URL | radimbig_pinchana_tiktok-1.0.0.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62d20e1b89f0afdfa70c37625341b2f580a45d9221a38af2458eff2d97fa4c3e
|
|
BLAKE2b-256 checksum How to use checksums |
ebebc8ba0cc46e192a8578197b8f0765432f88e71f99d2879ce4c827bbf83e5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / radimbig_pinchana_tiktok-1.0.0-py3-none-any.whl
| Download URL | radimbig_pinchana_tiktok-1.0.0-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3d7c4be2a0bd2576ecf639fc2191f16a2e66f3c0c44b17de790f42ae85f1fdf
|
|
BLAKE2b-256 checksum How to use checksums |
e66c78b36b7a7cc67ff209d7603b8471a26c8e54bee2d193e77eb12097069f4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for radimbig-pinchana-tiktok 1.0.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.