Skip to main content

Pinchana Threads

This FastAPI module extracts public Threads posts from both threads.net and threads.com. It uses an HTTP-first strategy and a pooled browser fallback when the server-rendered response is gated or incomplete.

The fallback uses CloakBrowser 0.6.5 and the free, keyless Chromium 146 build. Leave CLOAKBROWSER_LICENSE_KEY unset. On first use, the wrapper downloads and verifies the binary directly from CloakBrowser's distribution channels.

Processing flow

  1. Normalize the post URL and resolve its shortcode.
  2. Fetch the canonical page through a shared curl-cffi session.
  3. Parse the server-rendered data-sjs payload for the requested post.
  4. Use an isolated page in the shared browser process only when the HTTP response is gated or incomplete.
  5. Download images, videos, covers, and supported music-preview assets into the shared cache.

The result can contain one image, one video, an ordered carousel, text-only metadata, or a Threads music preview. The gateway v1 contract represents music previews as a 30-second soundtrack asset with title and artist metadata plus a separate cover asset. Engagement fields are optional and must not be treated as guaranteed.

API

  • POST /scrape accepts {"url":"https://www.threads.com/@account/post/SHORTCODE"} and equivalent threads.net URLs.
  • GET /health reports service, VPN, HTTP-session, and browser readiness.

External clients, including Pinchana Bot, must use the gateway's authenticated POST /v1/scrape route. They must not call this module directly or depend on its legacy flat response.

Configuration

Variable Default Purpose
CACHE_PATH ./cache Base media cache path
CACHE_MAX_SIZE_GB 10.0 Maximum cache size before eviction
GLUETUN_CONTROL_URL http://localhost:8000 Private Gluetun control endpoint
THREADS_HTTP_CONCURRENCY 20 Maximum concurrent HTTP operations
THREADS_BROWSER_CONCURRENCY 2 Maximum simultaneous fallback pages

Development and diagnostics

uv sync --frozen
uv run uvicorn pinchana_threads.main:app --host 0.0.0.0 --port 8088 --reload

When the gateway rejects a valid Threads URL, correlate its request_id across scrape_request, scrape_route_selected, scrape_forward, and scrape_rejected. Confirm that both the gateway route patterns and this module accept the submitted hostname before changing the client.

# Run from the repository root.
docker build --file scrapers/pinchana-threads/Dockerfile --tag pinchana-threads:local .

Metadata

Release files for pinchana-threads 26.11.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pinchana-threads 26.11.15
File Size Uploaded Provenance Actions
pinchana_threads-26.11.15.tar.gz 14.8 kB With provenance Details for pinchana_threads-26.11.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pinchana-threads 26.11.15
File Interpreter ABI Platform Actions
pinchana_threads-26.11.15-py3-none-any.whl Python 3 none any Details for pinchana_threads-26.11.15-py3-none-any.whl

Total release size: 31.1 kB

Release files / pinchana_threads-26.11.15.tar.gz

Download URL pinchana_threads-26.11.15.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
20475245aa32e980883e0e7d9f0cd1d187e9f7f0e55ebe514bf4a5eec9df0c9f
BLAKE2b-256 checksum
How to use checksums
e63610ad2b340ca81bd1dfb0b543c31b2db048550e9401f796329be1f71c0ef2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / pinchana_threads-26.11.15-py3-none-any.whl

Download URL pinchana_threads-26.11.15-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
746d67f5fe00616168c7b3a8c564dbc98cb6bf6fd2a9a1a40e195d56c7974b3c
BLAKE2b-256 checksum
How to use checksums
d4c541c5cb51973bdef05d0a36b4442349d0b0ca9b141022d2d71658ae9c578a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for pinchana-threads 26.11.15

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pinchana_threads-26.11.15.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page