X (Twitter) Tweet Scraper | Search, Hashtags & Profiles avatar

X (Twitter) Tweet Scraper | Search, Hashtags & Profiles

Pricing

from $3.00 / 1,000 tweets

Go to Apify Store
X (Twitter) Tweet Scraper | Search, Hashtags & Profiles

X (Twitter) Tweet Scraper | Search, Hashtags & Profiles

Scrape tweets from X.com (Twitter) by search query, hashtag, username, or URL. Returns tweet text, engagement metrics, author info, media, and more $3.00/1K. MCP/API-ready.

Pricing

from $3.00 / 1,000 tweets

Rating

0.0

(0)

Developer

Khadin Akbar

Khadin Akbar

Maintained by Community

Actor stats

0

Bookmarked

68

Total users

8

Monthly active users

2 days ago

Last modified

Share

๐Ÿฆ X (Twitter) Tweet Scraper | Search, Hashtags, Profiles & URLs

This Apify Actor collects tweets from X.com based on a search query, hashtag list, username list, direct X URL, or mentioning username. It accepts one source or multiple sources in a single run, and each dataset record represents one scraped tweet. The output includes tweet text, full text, author details, engagement metrics, media URLs, hashtags, external URLs, language, conversation data, source URL, and scrape timestamp, so the result is ready for analysis, filtering, and downstream workflows.

Best fit and connected workflows

This Actor fits workflows that need tweet-level data from X.com in a structured Apify dataset. It is a strong routing choice for:

  • keyword and phrase monitoring with searchQuery
  • hashtag collection with hashtags
  • profile-based tweet collection with handles
  • URL-based scraping with startUrls
  • mention-based monitoring with mentioning
  • AI or automation workflows that read Apify datasets through the platform or Apify MCP

It also connects naturally to Apify platform steps such as dataset export, scheduled runs, and API-based processing. If you already work with Apify MCP, this Actor is usable as an Apify Actor endpoint inside that workflow.

Input fields

FieldTypePurpose
searchQuerystringKeywords or X advanced search syntax
hashtagsarray[string]Hashtags to scrape, one query per hashtag
handlesarray[string]X usernames to scrape via from:username queries
startUrlsarray[object]Direct X.com or twitter.com profile/search URLs
mentioningstringUsername to find tweets that mention that account
sortstringLatest, Top, or Both
maxTweetsPerQueryintegerMax tweets per source
langstringISO 639-1 language filter
startDatestringSince date in YYYY-MM-DD format
endDatestringUntil date in YYYY-MM-DD format
minimumLikesintegerMinimum likes filter
minimumRetweetsintegerMinimum retweets filter
minimumRepliesintegerMinimum replies filter
onlyVerifiedbooleanVerified-account filter
onlyImagesbooleanImage-only filter
onlyVideosbooleanVideo-only filter
excludeRepliesbooleanExcludes reply tweets
excludeRetweetsbooleanExcludes retweets
includeSourceQuerybooleanAdds source_query to each record

Focused input example

{
"handles": ["OpenAI"],
"sort": "Latest",
"lang": "en",
"maxTweetsPerQuery": 10,
"excludeRetweets": true,
"excludeReplies": true,
"includeSourceQuery": true
}

Output fields

FieldTypePurpose
tweet_idstringUnique tweet identifier
textstringTweet display text
full_textstringComplete tweet text
author_handlestringAuthor username without @
author_namestringAuthor display name
author_idstringNumeric author ID
author_followersnumber or nullFollowers count
author_followingnumber or nullFollowing count
author_verifiedbooleanVerified status
created_atstringTweet timestamp
like_countnumberLike count
retweet_countnumberRetweet count
reply_countnumberReply count
quote_countnumberQuote count
view_countnumber or nullView count when available
is_replybooleanReply indicator
is_retweetbooleanRetweet indicator
is_quotebooleanQuote-tweet indicator
has_mediabooleanMedia indicator
media_urlsarray[string]Media URLs
hashtagsarray[string]Hashtags in the tweet
urlsarray[string]Expanded external URLs
langstring or nullDetected language
conversation_idstring or nullConversation root ID
in_reply_to_userstring or nullReplied-to username
urlstringDirect tweet permalink
source_urlstringQueried API URL
scraped_atstringExtraction timestamp

Illustrative output record

{
"tweet_id": "1773456789012345678",
"text": "Just launched our new AI product! ๐Ÿš€ #AI #tech",
"full_text": "Just launched our new AI product! ๐Ÿš€ #AI #tech https://t.co/example",
"author_handle": "openai",
"author_name": "OpenAI",
"author_id": "1288285673",
"author_followers": 2500000,
"author_following": 342,
"author_verified": true,
"created_at": "Mon Mar 25 14:30:00 +0000 2024",
"like_count": 4200,
"retweet_count": 1100,
"reply_count": 830,
"quote_count": 210,
"view_count": 980000,
"is_reply": false,
"is_retweet": false,
"is_quote": false,
"has_media": true,
"media_urls": ["https://pbs.twimg.com/media/example.jpg"],
"hashtags": ["AI", "tech"],
"urls": ["https://openai.com/blog/example"],
"lang": "en",
"conversation_id": "1773456789012345678",
"in_reply_to_user": null,
"url": "https://x.com/openai/status/1773456789012345678",
"source_url": "https://twitter.com/i/api/2/search/adaptive.json?q=AI&count=40",
"scraped_at": "2026-03-31T12:00:00.000Z"
}

How it works

The Actor uses managed owner provider secrets (ScrapeCreators โ†’ SociaVault โ†’ TwitterAPI.io) for cookieless collection. Optional owner TWITTER_AUTH_TOKEN / TWITTER_CSRF_TOKEN env secrets can enable a browser path; customers never supply API keys or cookies. It supports search queries, hashtags, handles, direct URLs, and mention searches with sort, volume, language, date, and engagement filters. Each dataset record is one tweet with author, engagement, media, URL, and provenance fields. Default run options: latest build, 600s timeout, 512 MB.

Pricing

This Actor uses Apify's Pay Per Event pricing model. Charges are based on scraped tweet events, and Apify platform usage is billed separately according to your account and execution settings. Event-based pricing also applies to Actor start events as defined in the live contract. For the current pricing details, open the live Pricing tab on the Actor page.

For an event-count example in words: if a execution produces one hundred Tweet events, you are charged for one hundred scraped tweet events, plus the Apify platform usage tied to the run.

Use with AI agents (MCP)

This Actor is available as an Apify Actor usable through Apify MCP. The exact Actor identity is khadinakbar/x-tweet-scraper. In MCP-based automation, the tool helps an AI agent request tweet collection from X.com, then read the resulting dataset records for analysis or routing.

Collect the latest English tweets from the handle OpenAI, keep original tweets only, and return the dataset records with author, engagement, and URL fields.

When an agent reads the output, each dataset item represents one tweet. The tweet_id and url support deduplication and direct lookup, while source_url shows the queried API source. Pagination is handled by the Actor based on the requested inputs and maxTweetsPerQuery. Cost scales with the number of Tweet events returned, so smaller targeted queries usually stay easier to reason about than broad multi-source runs.

Example with the Apify API

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({
token: process.env.APIFY_TOKEN,
});
const input = {
handles: ['OpenAI'],
sort: 'Latest',
lang: 'en',
maxTweetsPerQuery: 5,
excludeRetweets: true,
};
const run = await client.actor('khadinakbar/x-tweet-scraper').call(input);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

Best results and outcome guidance

Target one clear source per run when you want easier analysis. searchQuery works well for keywords and X advanced search syntax, hashtags fits topic monitoring, handles fits profile timelines, and mentioning fits brand mention tracking. Latest is useful for recency-focused review, Top is useful for engagement-focused review, and Both broadens coverage across the two sort modes. Use includeSourceQuery when combining multiple sources so each tweet keeps its origin visible in the dataset.

Continue the workflow

Design note

I found that the live dataset contract requires tweet_id, text, author_handle, created_at, like_count, retweet_count, url, and scraped_at in every record. That makes the output easy to join, trace, and timestamp even before optional fields are considered.

FAQ

Can I scrape by keyword, hashtag, or profile in the same Actor?

Yes. The input schema includes searchQuery, hashtags, handles, startUrls, and mentioning, so you can route different X collection patterns through one Actor.

When should I use handles instead of searchQuery?

Use handles when the source is a username or profile timeline. Use searchQuery for keywords, phrases, or advanced X search syntax.

What is the difference between startUrls and handles?

startUrls accepts direct X.com or twitter.com profile or search URLs. handles accepts usernames and converts them into from:username queries.

How can I monitor mentions of a brand name?

Use mentioning with the brand username, for example OpenAI, to collect tweets that mention @OpenAI.

Can I trace which query produced each tweet?

Yes. Enable includeSourceQuery to add source_query to each dataset record.

Which fields are suited to analysis?

text, full_text, author_handle, author_name, created_at, like_count, retweet_count, reply_count, quote_count, view_count, hashtags, and urls are the main analysis fields in the dataset contract.

Responsible use

Use the Actor in ways that align with X.com access rules and Apify platform terms. Provider keys and any owner session cookies are Actor env secrets only โ€” never paste them into run input. When working with large or repeated collections, structure the run around the smallest clear query set that matches your workflow.