Scweet¶
Scrape Twitter / X without the official API. Tweets, profiles, followers and trends, from Python or the command line.
Two ways to run it¶
Hosted — nothing to manage¶
The same engine runs on Apify. You need no X accounts, no cookies and no proxies. Configure a job in your browser, or call it from your code, and export the result. A free tier is included.
Self-hosted — full control¶
You bring your own X accounts and proxies, and you run the code inside your own infrastructure.
Quickstart¶
1. Install
2. Get your auth_token
Log in to x.com, open the developer tools with F12, then read
Application → Cookies → https://x.com and copy the value of auth_token.
That one value is all you need. Scweet builds the rest.
Use a dedicated account
Never use your personal account. X can lock an account that sends many requests.
3. Scrape
from Scweet import Scweet
s = Scweet(auth_token="YOUR_AUTH_TOKEN")
tweets = s.search("bitcoin", limit=100)
for tweet in tweets:
print(tweet["text"])
On the next run you need no credential, because Scweet keeps the account in a local state file:
Always set limit
Without it, a run continues until the account reaches its daily cap.
What you can read¶
| Operation | Method |
|---|---|
| Tweets from a search | search() |
| Tweets of a profile | get_profile_tweets() |
| Media of a profile | get_profile_media() |
| One tweet by its id | get_tweet_info() |
| The replies to a tweet | get_tweet_replies() |
| The accounts that reposted a tweet | get_reposters() |
| Followers, following, verified followers | get_followers(), get_following(), get_verified_followers() |
| The profile of a user | get_user_info() |
| A search for people | search_users() |
| The trends of now | get_trending() |
Each method has an async form with the prefix a, for example asearch(). Each one returns a
list[dict].
Read the full reference for every parameter.
Next steps¶
- Add a proxy before you read a large volume.
- Use several accounts to read more in one day.
- Read the configuration for every setting.
- Read the errors that Scweet raises, and what each one means.
- Use the command line instead of Python.
Support¶
- The code and the issues: github.com/Altimis/Scweet
- The package: pypi.org/project/scweet
- The changes of each version: changelog