3 minutes

How to Scrape a Twitter User Profile

Get complete user profile data — bio, followers, following, tweet count, join date, and verification status — in one API call.

1

Get your API key

Sign up at scrapebadger.com and copy your API key.

2

Lookup by username

The simplest way to get a profile is by @username.

from scrapebadger import ScrapeBadger

sb = ScrapeBadger(api_key="YOUR_API_KEY")
user = sb.twitter.users.get_by_username("elonmusk")

data = user["data"]
print(f"Name: {data['name']}")
print(f"Bio: {data['bio']}")
print(f"Followers: {data['followers_count']:,}")
print(f"Following: {data['following_count']:,}")
print(f"Tweets: {data['tweet_count']:,}")
print(f"Verified: {data['verified']}")
3

Lookup by numeric ID

If you have the numeric user ID, use the by_id endpoint.

user = sb.twitter.users.get_by_id("44196397")
print(user["data"]["username"])  # "elonmusk"
4

Bulk lookup multiple profiles

Fetch up to 100 profiles in a single request for efficiency.

users = sb.twitter.users.batch_by_usernames(
    usernames="elonmusk,sama,sataborasu"
)
for u in users["data"]:
    print(f"@{u['username']}: {u['followers_count']:,} followers")

Frequently Asked Questions

User ID, username, display name, bio, follower count, following count, tweet count, join date, verified status, profile image URL, banner URL, and pinned tweet.

You can get basic public data (name, bio, follower count) for private accounts, but not their tweets or follower lists.

Call the endpoint on a schedule and store results. Compare snapshots to track follower growth, bio changes, etc.

No. "ElonMusk" and "elonmusk" both return the same profile.