X (Twitter) Search Scraper
Pricing
from $0.10 / 1,000 results
X (Twitter) Search Scraper
Search X (Twitter) by keyword, hashtag, or 'from:user' query and stream matching tweets. Supports Top / Latest / People / Photos / Videos tabs. HTTP-only, no native login flow.
Pricing
from $0.10 / 1,000 results
Rating
0.0
(0)
Developer
Farhan Febrian Nauval
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
17 hours ago
Last modified
Categories
Share
Search X (Twitter) tweets by keyword, hashtag, or from:USERNAME query — with two modes: anonymous per-user search (no setup) or authenticated general search (paste cookies once for full keyword/hashtag support).
Why use this actor
- No account required for per-user search — pass
from:jack twitterand get every tweet from@jackcontaining "twitter", newest first. Works out of the box. - General keyword and hashtag search with cookies — paste your logged-in X cookies once to unlock keyword (
bitcoin), hashtag (#worldcup), and combined queries that X login-walls anonymously. - Higher rate limits when authenticated — anonymous mode uses guest-token rate limits (~50 calls per 15 min). Cookies give you account-tier limits (~150 calls per 15 min for normal accounts, more for Premium).
- Multiple keywords supported —
from:elonmusk doge marsmatches tweets containing both "doge" AND "mars" (case-insensitive substring AND). - Pagination handled automatically — request up to 500 tweets per query; cursor-based pagination is streamed without you managing it.
- Bulk input — pass a list of queries in one run; one dataset row per matching tweet, tagged with the original query in
_input. - Stable JSON output — every record carries
_input,_source, and_scrapedAtenvelope fields so you can join results back to your input list. - Structured error envelope — when cookies expire or general search hits a server-side gate, you get one clean
_errorrecord per query instead of a crashed run.
How it works
- You provide a list of search queries. Optionally, paste X cookies into the
xCookiesinput field to enable authenticated mode. - The actor either:
- Authenticated: hits X's search endpoint directly with your session cookies, paginates via cursor, streams matching tweets.
- Anonymous +
from:USERNAME: resolves the username, walks the user's timeline, filters for keyword matches.
- Matching tweets stream into your dataset, ready to download as JSON, CSV, or Excel.
You do not need to manage scrapers, browsers, logins, or rotating IPs — all handled internally.
How to get X cookies (for authenticated mode)
This is a 1-minute, one-time setup. Required only if you want general keyword/hashtag search; from:USERNAME queries work without cookies.
- Install Cookie-Editor in Chrome or Firefox (free extension, 1M+ users).
- Log in to x.com in that browser, using either your real account or a throwaway. (Throwaway recommended for heavy automated use — see Notes.)
- Click the Cookie-Editor extension icon while on any x.com page.
- Click the "Export" icon (📤) in the bottom toolbar of the popup, choose "Export as JSON", and your clipboard will have the JSON.
- Paste the JSON into the
xCookiesfield on the Apify input form. Save and run.
The minimum required cookies are auth_token and ct0. The Cookie-Editor export includes them automatically along with helpful aux cookies (gt, twid, kdt, __cf_bm).
Alternative format: instead of the JSON export, you can paste a plain auth_token=xxx; ct0=yyy cookie string copied from your browser DevTools network tab.
Input
{"queries": ["bitcoin","from:elonmusk doge"],"maxResults": 20,"product": "Top","xCookies": "[ {\"name\":\"auth_token\",\"value\":\"...\"}, {\"name\":\"ct0\",\"value\":\"...\"} ]","proxyConfiguration": {"useApifyProxy": true,"apifyProxyGroups": ["DATACENTER"]}}
| Field | Type | Description |
|---|---|---|
queries | array | List of search queries. Two formats supported: (1) general keywords / hashtags like bitcoin, #worldcup, iphone 17 — require xCookies. (2) per-user from:USERNAME [keywords] like from:jack twitter — work without cookies. |
maxResults | integer | Max tweets returned per query. Default 20, max 500. Pagination handled automatically. |
product | string | One of Top, Latest, People, Photos, Videos. Applied to authenticated search only; anonymous from:USERNAME always returns user timeline regardless. Default Top. |
xCookies | string (secret) | Your logged-in X cookies as JSON array (Cookie-Editor export) or name=val; ... string. See the tutorial section above. Leave empty for anonymous mode. |
proxyConfiguration | object | Apify Proxy settings. Datacenter proxy works for both modes. |
Output
Input: from:jack twitter
{"_input": "from:jack twitter","_source": "S1-primary","_scrapedAt": "2026-05-18T11:06:09.702476+00:00","rest_id": "1189634360472829952","id_str": "1189634360472829952","conversation_id_str": "1189634360472829952","created_at": "Wed Oct 30 20:05:08 +0000 2019","full_text": "We've made the decision to stop all political advertising on Twitter globally. We believe political message reach should be earned, not bought. Why? A few reasons...","lang": "en","favorite_count": 308633,"retweet_count": 72664,"reply_count": 12506,"quote_count": 32307,"bookmark_count": 3628,"is_quote_status": false,"display_text_range": [0, 164],"entities": {"hashtags": [],"symbols": [],"urls": [],"user_mentions": []},"source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>","views": { "state": "Enabled" },"user_id_str": "12","author": {"rest_id": "12","screen_name": "jack","name": "jack","description": "no state is the best state","followers_count": 7537451,"friends_count": 3,"statuses_count": 30509,"is_blue_verified": true,"created_at": "Tue Mar 21 20:50:14 +0000 2006"}}
| Field | Type | Description |
|---|---|---|
_input | string | The query exactly as you supplied it. Use to join results back to your input list. |
_source | string | Internal tag for the fetch path used (S1-primary for both anonymous and authenticated runs). |
_scrapedAt | string | ISO-8601 UTC timestamp when the record was scraped. |
rest_id / id_str | string | Tweet ID (stable across edits). |
conversation_id_str | string | Root tweet ID of the thread this tweet belongs to. |
created_at | string | Original X-format timestamp (Wed Oct 30 20:05:08 +0000 2019). |
full_text | string | Full tweet body (no truncation). |
lang | string | ISO-639 language code detected by X. |
favorite_count | integer | Likes. |
retweet_count | integer | Reposts. |
reply_count | integer | Direct replies. |
quote_count | integer | Quote-tweets. |
bookmark_count | integer | Bookmarks (publicly counted). |
is_quote_status | boolean | true if this tweet quotes another. |
display_text_range | array | [start, end] character indices for the visible portion of full_text. |
entities | object | Structured hashtags, URLs, user mentions, symbols extracted by X. |
source | string | Client used to post (e.g. Twitter for iPhone). |
views.state | string | Enabled if view-count is publicly available, otherwise omitted. |
user_id_str | string | Author's numeric user ID (mirrors author.rest_id). |
author | object | Embedded author block: rest_id, screen_name, name, description, follower/following/tweet counts, is_blue_verified, created_at. |
Tweets with photos / videos also include extended_entities.media with full media_url_https, sizes, and (for videos) MP4 variants.
Error envelope
The actor surfaces structured errors instead of crashing the run:
{"_input": "bitcoin","_error": "login_required","_errorDetail": "X requires a logged-in user session for general keyword/hashtag search in 2025+. ...","_source": "S1-primary","_scrapedAt": "2026-05-18T11:06:10.848836+00:00"}
_error value | When |
|---|---|
login_required | General keyword / hashtag query was attempted without xCookies. Paste cookies or rewrite as from:USERNAME. |
cookies_invalid | xCookies was provided but X rejected them (expired or revoked). Re-export from Cookie-Editor after re-logging in to x.com. |
resolve_failed | The username after from: does not resolve (deleted, suspended, or typo). |
empty_results | The query is valid but no tweets matched within the pagination window. |
blocked | Transient block from X — retry later. |
Pricing
This actor is billed per result: $8.00 per 1,000 tweets (Tier 6 — X requires the most maintenance overhead of any platform: bundle queryId rotation, guest-token refresh, optional auth cookies). Each matching tweet returned = 1 result. Error envelope records (login_required, cookies_invalid, etc.) are not billed.
Other Sosmed Actors
| Platform | Actor | Best for |
|---|---|---|
| Twitter / X | X Account Scraper | Profile, bio, follower/following counts for any handle |
| Twitter / X | X Account Tweets Scraper | Full timeline of a user (no keyword filter) |
| Twitter / X | X Post Detail Scraper | Single-tweet detail with author and engagement |
| Bluesky | Bluesky Search Scraper | Full-text search across all of Bluesky (no login wall) |
| Reddit Search Scraper | Search posts across subreddits | |
| YouTube | YouTube Search Scraper | Search videos by keyword |
| Mastodon | Mastodon Account Scraper | Profile data for any Mastodon handle |
Browse the full catalog at apify.com/xtracto.
Notes
- X login-walls general search anonymously. To search by keyword or hashtag (anything that isn't
from:USERNAME), you must pastexCookiesfrom a logged-in x.com session. The Cookie-Editor tutorial above is the fastest path. - Cookie rotation:
auth_tokenis typically valid for several weeks to a few months;ct0rotates more often. If you start seeing_error: "cookies_invalid", just re-export from Cookie-Editor while logged in. The auth_token itself is what matters — refresh as needed. - Use a throwaway account for heavy automated use. X enforces per-account rate limits (~150 search calls per 15 minutes for normal accounts, scaling up for Premium). High-volume runs from a single account can trigger flags or a temporary lock. Best practice: use one or more disposable accounts dedicated to scraping, not your primary account.
- Pagination per query is automatic via cursor. The actor stops when it hits
maxResultsor when X returns no further pages. - Per-user mode is permanent. The anonymous
from:USERNAME [keywords]path will keep working even if your cookies expire — it doesn't depend on auth. - Keyword filter is AND + substring.
from:jack iphone twittermatches tweets containing bothiphoneandtwitter(case-insensitive).from:jack newwill also matchnews(no tokenisation). - Counters are eventually-consistent.
favorite_count,retweet_countetc. may lag the live network by a few minutes. - Quoted phrases (
"new policy"),OR,-exclude,lang:en, etc. are parsed by X server-side when running with cookies; in anonymousfrom:USERNAMEmode they are not interpreted (treated as plain tokens).