Twitter scraper API: tweets without the scraper.
A Twitter scraper API does the scraping for you (accounts, proxies, logins and parsing) and hands back tweets as JSON from a normal HTTP request. You pay per request or per result instead of keeping a scraper alive.
Below: how it compares with the official API and DIY scraping, what 100,000 tweets cost on each, and a Python script that exports a search to CSV.
Four ways to get tweets.
| Approach | Setup | You maintain | When X changes | 100,000 tweets |
|---|---|---|---|---|
| Scraper API | Sign up, copy a key | Nothing; the provider runs accounts and proxies | Provider fixes it | $3.00 to $20.00 |
| Official X API | Developer account, app, prepaid credits | Credentials and spending limits | X maintains it | $500.00 |
| DIY scraper | Library such as Twikit or twscrape, X accounts, proxies | Accounts, proxies, logins, parsing | You fix it, when X changes its site | Accounts, proxies and your time |
| Hosted scraper (Apify) | Apify account, configure a run | Run settings | Actor author fixes it | $40.00 |
What 100,000 tweets cost.
Scraper APIs price by request or by result, so the same export can differ by more than ten times. The official X API, at $500.00, is off this scale.
| Provider | Bar | Value |
|---|---|---|
| Sorsa$199 monthly plan | $2.00 | |
| cheapxapi | $3.00 | |
| twitterapis.com | $4.00 | |
| GetXAPI | $5.00 | |
| twitterapi.io | $15.00 | |
| SocialData | $20.00 | |
| Apify Tweet Scraper V2 | $40.00 |
Export a search to CSV in Python.
The script pages through a search with the cursor until it has 1,000 tweets or the results run out. That is 50 requests, about $0.03.
- 1. Get an API key and set it as
CHEAPXAPI_KEY. - 2.
pip install requests - 3. Change QUERY and run it.
import csv, os, requests
API = "https://api.cheapxapi.com/twitter/tweet/advanced_search"
HEADERS = {"x-api-key": os.environ["CHEAPXAPI_KEY"]}
QUERY = "from:NASA -filter:replies"
LIMIT = 1000
rows, cursor = [], ""
while len(rows) < LIMIT:
params = {"query": QUERY, "queryType": "Latest"}
if cursor:
params["cursor"] = cursor
res = requests.get(API, headers=HEADERS, params=params, timeout=75)
res.raise_for_status()
page = res.json()
for t in page.get("tweets", []):
rows.append([t["id"], t["createdAt"], t["author"]["userName"],
t["likeCount"], t["retweetCount"], t["text"]])
if not page.get("has_next_page") or not page.get("next_cursor"):
break
cursor = page["next_cursor"]
with open("tweets.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(["id", "created_at", "author", "likes", "retweets", "text"])
writer.writerows(rows[:LIMIT])
print(f"Saved {min(len(rows), LIMIT)} tweets")Search operators that do the filtering.
The search endpoint takes X’s advanced search syntax, so narrow the query instead of downloading everything and filtering afterwards. Fewer pages, smaller bill.
| Operator | Matches |
|---|---|
from:NASA | Tweets posted by @NASA |
to:NASA | Replies sent to @NASA |
since:YYYY-MM-DD until:YYYY-MM-DD | Tweets inside a date range |
min_faves:100 | At least 100 likes |
lang:en | Tweets in one language |
-filter:replies | Leave replies out |
"exact phrase" | Tweets containing the phrase |
Endpoint reference: Advanced search.
Questions.
What is a Twitter scraper API?
A hosted service that collects public X (Twitter) data for you and returns it as JSON over ordinary HTTP requests. The provider runs the accounts, proxies and parsing that a scraper needs; you send a request with an API key and pay per request or per result.
Can I scrape Twitter without the official API?
Yes, either with an open-source library that signs in with your own X accounts, or with a third-party scraper API that does that work for you. The first costs nothing in software but needs accounts and proxies and breaks when X changes; the second costs a small fee per request.
How many tweets does one request return?
On cheapxapi, a search or timeline request returns up to 20 tweets and costs $0.0006, so 1,000 tweets take 50 requests and cost about $0.03. Pages can hold fewer when X filters out ads or unavailable posts.
How do I scrape tweets with Python?
Call the search endpoint with requests, read tweets from each page, and pass next_cursor back as cursor until has_next_page is false. The script on this page does exactly that and writes the result to a CSV file.