Twitter Profile Scraper avatar

Twitter Profile Scraper

Pricing

from $10.00 / 1,000 results

Go to Apify Store
Twitter Profile Scraper

Twitter Profile Scraper

Extract comprehensive Twitter/X profile data and tweets including all engagement metrics (likes, retweets, replies, quotes, bookmarks, views), profile details, media URLs, hashtags, and mentions with anti-detection features and authenticated scraping support.

Pricing

from $10.00 / 1,000 results

Rating

5.0

(7)

Developer

Crawler Bros

Crawler Bros

Maintained by Community

Actor stats

5

Bookmarked

86

Total users

16

Monthly active users

a day ago

Last modified

Categories

Share

Scrape tweets, engagement metrics, and full profile data from any public Twitter/X account. Extract likes, retweets, replies, views, bookmarks, media, hashtags, mentions, and more — no official API key required.

Twitter/X authentication cookies are required. See the Authentication section below for how to export your session cookies.


Features

  • Full profile metadata — display name, bio, location, website, joined date, follower/following counts, profile image, banner image, verification status
  • Complete tweet data — text, timestamp, tweet ID & URL, all engagement metrics (likes, retweets, replies, quotes, bookmarks, views)
  • Media extraction — images and video thumbnails from each tweet
  • Rich tweet context — hashtags, mentions, external URLs, reply-to username, is-reply / is-retweet flags
  • Filtering — include or exclude replies and retweets
  • Multi-profile — scrape multiple usernames in a single run
  • Block recovery — automatically detects rate limits and pauses before retrying
  • Stealth mode — Firefox with anti-detection headers, randomised delays, human-like mouse/scroll behaviour

Input Parameters

FieldTypeRequiredDefaultDescription
usernamesarray of stringsTwitter/X usernames to scrape (with or without @ prefix)
cookiesstring (secret)Twitter/X session cookies in JSON format (see Authentication below)
maxTweetsinteger50Max tweets to collect per profile (1–500)
includeRepliesbooleanfalseInclude reply tweets
includeRetweetsbooleantrueInclude retweets
proxyConfigurationobjectdisabledProxy settings — enable if you hit IP-based blocks

Minimal Input

{
"usernames": ["elonmusk"]
}

With Multiple Profiles and Filters

{
"usernames": ["elonmusk", "openai", "github"],
"maxTweets": 100,
"includeReplies": false,
"includeRetweets": true
}
{
"usernames": ["elonmusk"],
"maxTweets": 200,
"cookies": "[{\"name\":\"auth_token\",\"value\":\"your_token\",\"domain\":\".x.com\",\"path\":\"/\",\"httpOnly\":true,\"secure\":true}]"
}

Output Format

Each item in the dataset represents one tweet, enriched with the author's profile metadata. Empty fields (null, blank string, empty array, empty object) are omitted — the dataset never contains nulls.

{
"tweet_id": "1881234567890123456",
"tweet_url": "https://twitter.com/elonmusk/status/1881234567890123456",
"text": "Tweet content here",
"timestamp": "2025-01-20T14:32:00.000Z",
"likes_count": 42000,
"retweets_count": 8500,
"replies_count": 1200,
"bookmarks_count": 3100,
"views_count": 9800000,
"is_retweet": false,
"is_reply": false,
"reply_to": null,
"media_urls": [
"https://pbs.twimg.com/media/AbCdEf123.jpg"
],
"hashtags": ["AI", "Tesla"],
"mentions": ["openai"],
"urls": ["https://tesla.com"],
"scrapedProfile": "elonmusk",
"authorMeta": {
"username": "elonmusk",
"display_name": "Elon Musk",
"bio": "Tesla, SpaceX, Neuralink, The Boring Company",
"location": "Texas, USA",
"website": "https://tesla.com",
"joined_date": "Joined June 2009",
"birth_date": null,
"followers_count": 228100000,
"following_count": 1219,
"tweets_count": 47800,
"verified": true,
"profile_image_url": "https://pbs.twimg.com/profile_images/xyz/photo_400x400.jpg",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/xyz/banner.jpg",
"scraped_at": "2025-01-20T15:00:00.000000"
}
}

Output Fields Reference

Tweet fields

FieldTypeDescription
tweet_idstringUnique tweet ID
tweet_urlstringDirect URL to the tweet
textstringFull tweet text
timestampstringISO 8601 timestamp
likes_countintegerNumber of likes
retweets_countintegerNumber of retweets/reposts
replies_countintegerNumber of replies
bookmarks_countintegerNumber of bookmarks
views_countintegerNumber of views
is_retweetbooleanWhether this is a retweet
is_replybooleanWhether this is a reply
reply_tostring / nullUsername being replied to
media_urlsarrayImage/video URLs attached to the tweet
hashtagsarrayHashtags used (without #)
mentionsarrayUsernames mentioned (without @)
urlsarrayExternal URLs in the tweet
scrapedProfilestringUsername that was scraped
authorMetaobjectFull profile data (see below)

authorMeta fields

FieldTypeDescription
usernamestringTwitter/X handle
display_namestringFull display name
biostringProfile biography
locationstringLocation text from profile
websitestringWebsite URL from profile
joined_datestringWhen the account was created
birth_datestring / nullBirth date if set publicly
followers_countintegerNumber of followers
following_countintegerNumber of accounts followed
tweets_countintegerTotal post count
verifiedbooleanWhether the account is verified
profile_image_urlstringProfile picture URL (400×400)
profile_banner_urlstringHeader/banner image URL
scraped_atstringISO 8601 timestamp of when data was collected

Authentication

The actor ships with built-in session cookies so it works immediately without any configuration. For runs collecting 100+ tweets or scraping many profiles, providing your own fresh cookies reduces the chance of hitting rate limits.

How to Export Your Cookies

  1. Log into x.com in your browser
  2. Install the Cookie-Editor extension
  3. Click the extension icon and choose Export → Export as JSON
  4. Paste the JSON array into the cookies input field

Minimum Required Cookies

CookiePurpose
auth_tokenAuthenticates your session
ct0CSRF protection token
[
{
"name": "auth_token",
"value": "your_auth_token",
"domain": ".x.com",
"path": "/",
"httpOnly": true,
"secure": true
},
{
"name": "ct0",
"value": "your_ct0_value",
"domain": ".x.com",
"path": "/",
"httpOnly": false,
"secure": true
}
]

Note: Keep your cookies private. They give full access to your Twitter/X account.


Frequently Asked Questions

Why am I getting old tweets instead of recent ones?

Without valid authentication, Twitter shows a "Highlights" feed of popular old tweets rather than recent chronological posts. The actor's built-in cookies handle this automatically, but if they have expired, provide your own fresh cookies.

Can I scrape private/protected profiles?

Only if you are authenticated as an account that follows the private profile. Provide cookies from that account.

How many tweets can I scrape per run?

Up to 500 tweets per profile (maxTweets maximum). For very large profiles, multiple runs with different date ranges via the maxTweets limit are recommended.

Will my account get banned?

The actor uses randomised delays and human-like behaviour to minimise risk. Avoid running large jobs (500 tweets × many profiles) repeatedly in quick succession. Start with smaller batches to test.

What happens if I get rate limited?

The actor automatically detects rate-limit signals, navigates away, waits 45–55 seconds, then resumes. If a second block is detected, it saves what it has collected and stops gracefully.

Does this work without a proxy?

Yes — proxy is disabled by default. Enable proxyConfiguration only if you encounter persistent IP-based blocks.


Running Locally

Prerequisites

pip install apify-client playwright beautifulsoup4
playwright install firefox

Input File

Create storage/key_value_stores/default/INPUT.json:

{
"usernames": ["elonmusk"],
"maxTweets": 20
}

Run

$apify run

Limitations

  • Cannot access truly private accounts without being an authenticated follower
  • Twitter's DOM structure may change and require updates to selectors
  • Very high maxTweets values (300+) take significantly longer and carry higher block risk
  • Engagement counts for very old tweets may differ slightly from the official API

This actor scrapes publicly available data. Always comply with Twitter/X Terms of Service and applicable data protection regulations (GDPR, CCPA) when storing or processing scraped data.