Python SDK for X/Twitter API access, scraping, and automation
Top 24.1% on sourcepulse
This Python library provides a comprehensive client for interacting with the X (formerly Twitter) API, including v1, v2, and GraphQL endpoints. It is designed for developers and power users who need to automate tasks, scrape data, or manage their X accounts programmatically. The library offers functionalities for account management, data scraping, search, and even specialized features like live audio capture from Spaces.
How It Works
The client is structured into several modules: Account
for performing actions like tweeting, replying, liking, and managing profiles; Scraper
for fetching various types of data such as user profiles, tweets, media, and relationships; and Search
for executing complex queries. It leverages session management via cookies or credentials, with a recommendation to use cookies due to potential instability with username/password logins. The library also includes utilities for handling pagination and offers batching for certain endpoints (e.g., users_by_ids
, tweets_by_ids
) to improve efficiency and adhere to rate limits.
Quick Start & Requirements
pip install twitter-api-client -U
proton-api-client
is required.Highlighted Details
tweets_by_ids
with ~220 items per request).Maintenance & Community
The repository is maintained by trevorhobenshield. Further community or maintenance details are not explicitly provided in the README.
Licensing & Compatibility
The README does not specify a license. Users should verify licensing before commercial use or integration into closed-source projects.
Limitations & Caveats
The README notes that login via username/password is unstable as of Fall 2023, recommending cookie-based authentication. Some API endpoints might be subject to X's rate limits and terms of service.
1 year ago
1 day