Skip to main content

An unofficial X scraper and downloader

Project description

TwiX-dl

PyPI version License: MIT Python 3.10+

twix-dl is a Python library (and future CLI tool) for extracting tweet metadata and downloading all media attachments (photos, videos, GIFs) from a Twitter/X post.

📦 Installation

pip install twix-dl

Or install from source:

git clone https://github.com/JellyTyan/twix-dl.git
cd twix-dl
pip install -e .

📚 Data Structures

@dataclass
class AuthorData:
    id: str
    rest_id: str
    name: str
    screen_name: str
    url: str
    avatar_url: str
    profile_banner_url: str
    description: str
    is_blue_verified: bool
    favourites_count: int
    followers_count: int

@dataclass
class TweetMedia:
    type: Literal["photo", "video", "gif"]
    url: str
    width: Optional[int] = None
    height: Optional[int] = None
    duration: Optional[int] = None  # for videos/GIFs
    size: Optional[int] = None      # file size in bytes

@dataclass
class TweetInfo:
    tweet_id: str
    url: str
    full_text: Optional[str]
    author: AuthorData
    media: List[TweetMedia]
    favorite_count: Optional[int] = None
    retweet_count: Optional[int] = None
    reply_count: Optional[int] = None
    quote_count: Optional[int] = None
    lang: Optional[str] = None

@dataclass
class ErrorExtensions:
    name: str
    source: str
    code: int
    kind: str
    trace_id: Optional[str] = None

@dataclass
class TwitterError:
    """Twitter API error response"""
    message: str
    code: int
    kind: str
    name: str
    source: str
    trace_id: Optional[str]
    extensions: ErrorExtensions

@dataclass(frozen=True)
class GraphQLOperation:
    """GraphQL operation definition for Twitter API"""
    variables_schema: Dict[str, Any]
    operation_id: str
    name: str

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

twix_dl-0.2.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

twix_dl-0.2.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file twix_dl-0.2.0.tar.gz.

File metadata

  • Download URL: twix_dl-0.2.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for twix_dl-0.2.0.tar.gz
Algorithm Hash digest
SHA256 794dcf7acc9a4004e0b3183c3e8042e7957c4b27271fef6fe666c3163d83e0a0
MD5 86b934ce620c22ee3f8e33d5289cff49
BLAKE2b-256 5570c08754122050d08992846db99a4292e19cbb9da437495c0c7b55ec09c369

See more details on using hashes here.

File details

Details for the file twix_dl-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: twix_dl-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for twix_dl-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1496f5b25328b6c04ebd6fc066a1d39a0eb71400c467093704ca39ccf6c08f67
MD5 19a419d4abfb2af45ecb98187ea36356
BLAKE2b-256 b9a3d345d18e26179b3341502f847389191f234aa8da548c9f789650212d01b6

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