For years, snscrape and twint were how Python developers read Twitter without paying for the API. Both are gone for that job:
- snscrape's issue #996, "All Twitter scrapes are failing:
blocked (404)", has been open since June 30, 2023. Its last release is from June 2023, and its maintainer wrote that authentication "will not be added". - twint's repository was archived on March 30, 2023.
- twikit works by signing in to an X account, and its issues report Cloudflare 403s (#396), broken key parsing (#408) and suspended accounts (#359).
X's own API now charges for every post it returns. This guide reads X with SocialTap instead: profiles, an account's posts, a post's replies and keyword search, with no X account.
The code that stopped working
Most snscrape code looked like this:
import snscrape.modules.twitter as sntwitter
for i, tweet in enumerate(sntwitter.TwitterSearchScraper("from:nasa").get_items()):
if i >= 100:
break
print(tweet.date, tweet.content)Since X stopped serving logged-out timelines and search to plain requests, every call ends in blocked (404).
The same data with one API key
SocialTap reads what X shows a logged-out visitor, with its own sessions and proxies, and returns it in one schema. Install the SDK:
pip install socialtapGet a key on the signup page and set it as SOCIALTAP_API_KEY. Every account starts with 100 free credits. This reads one profile:
from socialtap import SocialTap
client = SocialTap() # api_key defaults to os.environ["SOCIALTAP_API_KEY"]
res = client.x.profile.get(handle="NASA")
print(res.data)
print(res.credits.charged, res.meta.request_id)You get the exact follower, following and post counts, the bio with its links written out, verification and the profile picture.
An account's posts
TwitterSearchScraper("from:nasa") becomes client.x.posts.iterate(). It walks the account's posts, up to 100 a page, and stops at the guards you set:
from socialtap import SocialTap, APIError, NotFoundError, PrivateOrUnavailableError
client = SocialTap() # api_key defaults to os.environ["SOCIALTAP_API_KEY"]
try:
# Stops at the end of the list, or at the first guard it reaches.
items = client.x.posts.iterate(handle="NASA", max_pages=10, max_credits=100)
for item in items:
print(item)
print(items.pages_fetched, items.credits_charged, items.stop_reason, items.end_reason)
except NotFoundError as err:
# The item does not exist or was deleted.
print(err.code, err.remediation)
except PrivateOrUnavailableError as err:
# The item exists but isn't public: it is private, age- or region-restricted, or needs a login.
print(err.code, err.remediation)
except APIError as err:
# Retryable errors reach you only after the SDK's own retries. Failed requests cost no credits.
print(err.code, err.status, err.retryable, err.remediation, err.request_id)Each post has its full text, media, links, mentions and its exact view, like, reply, repost, quote and bookmark counts. Logged out, X shows each account one way: many organizations' timelines go back far, newest first, and for most other accounts X shows their most liked posts. sort picks between the two where X offers both.
Search posts by keyword
Keyword search is client.x.search_posts.iterate(). X doesn't serve search to logged-out visitors, so this endpoint finds posts through a web search engine's index of X: it finds what the index has crawled, which favors older and popular posts, and it ends after a few pages. For one account's posts, the posts endpoint above is the complete source.
From snscrape to SocialTap
| snscrape | SocialTap | Endpoint |
|---|---|---|
TwitterUserScraper(name).entity | client.x.profile.get() | X (Twitter) Profile API |
TwitterSearchScraper("from:name") | client.x.posts.iterate() | X (Twitter) User Posts API |
TwitterTweetScraper(id) | client.x.post.get() | X (Twitter) Post API |
TwitterSearchScraper("conversation_id:…") | client.x.comments.iterate() | X (Twitter) Comments API |
TwitterSearchScraper("keyword") | client.x.search_posts.iterate() | X (Twitter) Post Search API |
What it costs
You pay per successful request, and a list request returns a page:
- An account's posts: $0.0075–$0.02 per 1,000 posts.
- Profiles: $0.75–$1.97 per 1,000 profiles.
Failed requests and cache hits cost nothing. X's own API charges per post returned: the X (Twitter) API page sets its prices beside ours.
Frequently asked questions
Does snscrape still work for Twitter?
No. Every Twitter scrape has failed with blocked (404) since June 2023, when X stopped answering logged-out requests, and the issue is still open. snscrape still works for some other sites.
Is twint still working?
No. Its repository was archived in March 2023 and its last release is from 2020.
Do I need an X account or cookies?
No. SocialTap reads X logged out, so no account of yours is involved and none can be suspended. Libraries such as twikit sign in, and X suspends accounts it sees scraping.
Can I get replies to a post?
Yes, the ones X shows a logged-out visitor: the top replies, in X's ranking, each with its own counts. Replies X shows only to signed-in people aren't included.
How is this different from the official X API?
The official API charges for every post it returns, from prepaid credits, after you create an app. SocialTap needs only an API key and charges per request, and a list request returns a page of posts.