Skip to main content

Unofficial PyPI distribution of Pinchana Twitter/X scraper maintained by radimbig

Project description

radimbig-pinchana-twitter

Unofficial PyPI distribution of the Pinchana Twitter/X scraper, maintained by radimbig for use as both a Pinchana plugin and an importable Python package.

Original project and copyright belong to Pinchana. This fork keeps the original logic and adds packaging metadata plus a small synchronous library wrapper.

Strategy

  1. Primary: X internal GraphQL (TweetResultByRestId) using guest token activation + CSRF (ct0) handling.
  2. Resilience: Automatic VPN IP rotation via Gluetun on rate limits (429/403).
  3. Fallback: api.fxtwitter.com for public tweet metadata when GraphQL is blocked.
  4. Media: Download media to local cache and expose via /media/twitter/{tweet_id}/{file}.

API

  • POST /scrape — scrape a tweet URL
  • GET /media/twitter/{tweet_id}/{filename} — serve cached media
  • GET /health — VPN status

Library Usage

Install the package:

pip install radimbig-pinchana-twitter

Import the package as pinchana_twitter:

from pinchana_twitter import download_x_post_assets

result = download_x_post_assets(
    post_url="https://x.com/user/status/1234567890",
    temp_directory="./temp_videos",
    user_id=42,
    request_id="abc123",
)

print(result["text"])
print(result["author_username"])
print(result["files"])

The synchronous wrapper returns:

{
    "text": "...",
    "author_username": "user",
    "files": [{"path": "...", "media_type": "photo"}],
}

Use media_type == "photo" for images and media_type == "video" for videos.

Publishing

The package publishes to PyPI when a v* tag is pushed and the repository has a PYPI_API_TOKEN secret configured.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

radimbig_pinchana_twitter-1.0.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

radimbig_pinchana_twitter-1.0.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file radimbig_pinchana_twitter-1.0.0.tar.gz.

File metadata

File hashes

Hashes for radimbig_pinchana_twitter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8d28f6d4af70a38fbbf6254481a0717038ec3e304613c05abab47a087618316b
MD5 211dad4d94cdc37de232c5e93d0beacd
BLAKE2b-256 fa6ccef40dd63a22ff997053be2291fac8df152da61939fa74516117d6c05dc4

See more details on using hashes here.

File details

Details for the file radimbig_pinchana_twitter-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for radimbig_pinchana_twitter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa22e9ce090d64f2d59ff439dc7c3ff8a0b13eefc5daa3b124ea78110b7ebc57
MD5 9a07bfe788072e67d63012ab1c212a6f
BLAKE2b-256 6a3e8283a2b7efe37cd57bb5696368400730db2455ecc8e925e967af1de6506b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page