Skip to content

Instantly share code, notes, and snippets.

@nikes
Forked from kentbrew/finding_twitter_user_id.md
Created January 2, 2024 12:00
Show Gist options
  • Save nikes/838b2391bee8c9258a39b99e0d0ca485 to your computer and use it in GitHub Desktop.
Save nikes/838b2391bee8c9258a39b99e0d0ca485 to your computer and use it in GitHub Desktop.
Finding Twitter User IDs

Finding Twitter User IDs

User accounts on Twitter are commonly identified by screen name, which may be changed by operators when they take over an account, or have been sitting on an old account for a long time and want to transition it into malicious use.

User IDs, however, are permanent. There are several services out there that will try to find them for you but it seems like a bad idea to me, since you're alerting them to the fact that there's something interesting about this account. There's also plenty of bad advice that uses many long-since-abandoned Twitter API endpoints.

As of this writing (2018-02-18) you can view source and search for /profile_banners/, which will show something like this:

.enhanced-mini-profile .mini-profile .profile-summary {
  background-image: url(https://pbs.twimg.com/profile_banners/2622731/1401943819/mobile);
}

The number after profile_banners/ is the account's Twitter user ID, which won't change if the account's screen name is changed. Here, 2622731 is my personal Twitter ID. (Expect to see much later numbers for more recent accounts; mine is quite old.)

Deleted Accounts?

If someone has just deleted their account it's often possible to find it in Google's most recent cache. Try searching for this:

twitter thatRecentlyDeletedUserName

Click the little down-arrow in the green URL, just below the blue headline, and then choose Cached. If it works, you'll see a page from http://webcache.googleusercontent.com/ with a View Source link somewhere near the top. Search as shown above.

ID to User Name?

To translate an ID to the current user name, visit the Intents url. Here's mine:

https://twitter.com/intent/user?user_id=2622731

This will show my current Twitter user name, which is @kentbrew. You should follow me, of course. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment