Scrape public tweets from X (Twitter) by keyword search, hashtag or user handle. No Twitter API subscription required. Returns tweet text, author, likes, retweets, views, date and media URLs. Pay per tweet delivered. Failed results are never charged.
Run it on Apify: apify.com/themineworks/twitter-x-scraper Docs, FAQ and pricing: themineworks.com/actors/twitter-x-scraper
Price: From $0.90 per 1,000 tweets on Apify's higher plans ($1.50 on the free plan), plus a $0.005 start fee per run. Failed and empty results are never charged.
- Keyword / hashtag search and profile timeline modes
- Engagement metrics: likes, retweets, replies, views
- Author verification badge, media URLs, hashtags, mentions
- Honest login-wall detection with clear no-results record
- Failed and empty results are never charged
You need a free Apify account and its API token (Settings, API & Integrations).
pip install apify-clientfrom apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("themineworks/twitter-x-scraper").call(run_input={
"searchTerms": [
"#AI",
"Anthropic Claude"
],
"handles": [
"AnthropicAI"
],
"maxTweets": 5,
"sessionCookies": [
{
"name": "auth_token",
"value": "1a2b3c4d5e6f7g8h9i0j",
"domain": ".twitter.com",
"path": "/"
}
]
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item)npm install apify-clientimport { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('themineworks/twitter-x-scraper').call({
"searchTerms": [
"#AI",
"Anthropic Claude"
],
"handles": [
"AnthropicAI"
],
"maxTweets": 5,
"sessionCookies": [
{
"name": "auth_token",
"value": "1a2b3c4d5e6f7g8h9i0j",
"domain": ".twitter.com",
"path": "/"
}
]
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);One request that runs the actor and returns the results in the response (for runs under 5 minutes):
curl -X POST "https://api.apify.com/v2/acts/themineworks~twitter-x-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"searchTerms": ["#AI", "Anthropic Claude"], "handles": ["AnthropicAI"], "maxTweets": 5, "sessionCookies": [{"name": "auth_token", "value": "1a2b3c4d5e6f7g8h9i0j", "domain": ".twitter.com", "path": "/"}]}'This repo includes ready-made clients that save results to JSON and CSV:
python3 twitter_x_scraper.py --token YOUR_APIFY_TOKEN --search-terms "#AI,Anthropic Claude" --handles "AnthropicAI" --max-tweets "5" --session-cookies ""
node twitter_x_scraper.mjs --token YOUR_APIFY_TOKEN --search-terms "#AI,Anthropic Claude" --handles "AnthropicAI" --max-tweets "5" --session-cookies ""| Field | Type | Default | Description |
|---|---|---|---|
searchTerms |
array | Keywords or hashtags to search for tweets | |
handles |
array | X usernames to scrape timeline tweets from (without @) | |
maxTweets |
integer | 20 |
Maximum tweets to return per search term or handle |
searchFilter |
string | "top" |
Filter search results to top tweets or latest |
sessionCookies |
array | Cookie objects from a logged-in X session | |
useBrowserFallback |
boolean | false |
Off by default |
One row per result, as JSON, CSV, Excel or through the API.
| Field | Type | Description |
|---|---|---|
tweetId |
string | Unique tweet ID from X |
tweetUrl |
string | Full URL to the tweet on x.com |
authorName |
string | Display name of the tweet author |
authorHandle |
string | Username of the tweet author (without @) |
authorUrl |
string | URL to the author's X profile |
authorVerified |
boolean | Whether the author has a verified / blue checkmark badge |
text |
string | Full text content of the tweet |
date |
string | ISO 8601 timestamp when the tweet was published |
likes |
integer | Number of likes on the tweet |
retweets |
integer | Number of retweets / reposts |
replies |
integer | Number of replies |
views |
integer | View count if visible (not always available) |
isRetweet |
boolean | True if this tweet is a repost of another tweet |
isReply |
boolean | True if this tweet is a reply to another tweet |
mediaUrls |
array | URLs of images or videos attached to the tweet |
hashtags |
array | Hashtags extracted from tweet text |
mentions |
array | Usernames mentioned in tweet text |
source |
string | The search term or @handle that returned this tweet |
scraped_at |
string | ISO 8601 timestamp of when the record was scraped |
The actor works as a tool in Claude, Cursor or any MCP client through Apify's MCP server:
https://mcp.apify.com/?tools=themineworks/twitter-x-scraper
No. The actor uses a real browser with residential proxy to access publicly visible X pages, with no Twitter developer account needed.
X enforces a strict login gate on automated sessions. When X detects a non-authenticated browser, it redirects all requests to the sign-in page. The actor detects this and exits cleanly with no result charges. Results depend on the residential IP assigned to your run.
Tweet ID, URL, author name and handle, verified status, tweet text, timestamp, likes, retweets, replies, views, media URLs, hashtags, and @mentions.
Yes. The searchFilter input accepts "top" or "latest" to control the X search tab used for keyword queries.
No. When X returns a login wall instead of results, the run records that plainly and nothing is charged for the attempt.
From $0.90 per 1,000 tweets on Apify's higher plans ($1.50 on the free plan), plus a $0.005 start fee per run. Failed and empty results are never charged. You can cap what a single run may spend with the maximum cost setting on Apify.
Yes. Every run saves to an Apify dataset you can download as JSON, CSV, Excel or XML, or read through the API. The Python and Node clients in this repo also write the results to local files.
Yes. Save your input as a task on Apify and attach a schedule, or call the API from your own cron job. Scheduled runs are billed the same way as manual ones.
- Threads Scraper: Meta Threads data that returns actual data
- Reddit Scraper: Free Reddit data with full comment trees
- LinkedIn Post Scraper: Search LinkedIn posts by keyword without login
Part of The Mine Works: 151 pay-per-result scrapers with no login and no browser setup on your side.
MIT © The Mine Works