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.17

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.17
File Size Uploaded Provenance Actions
pinchana_threads-26.11.17.tar.gz 14.9 kB With provenance Details for pinchana_threads-26.11.17.tar.gz

Built distribution (wheel)

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

Total release size: 31.2 kB

Release files / pinchana_threads-26.11.17.tar.gz

Download URL pinchana_threads-26.11.17.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ef36fbbf956af4e61a34edfa1c3bb5281ab3e9c478b8465309ae56f36d1b2084
BLAKE2b-256 checksum
How to use checksums
867bd8fc2840d8b38fced43e93850ab4ae22eba072d175ef7e5e521f88b21691
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.17-py3-none-any.whl

Download URL pinchana_threads-26.11.17-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17ef0f2dd3817e7b9f8bfaacf8197ec05eeb123f53d6bf87ba6062b64feffc14
BLAKE2b-256 checksum
How to use checksums
c882478da833478fe3524cc0658bd2a3ad5b53de155b0fe2815c356a3af1bb3c
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.17

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.17.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