Automatically Finding A Short Twitter Username
Twitter has many short user IDs available, but it might take some time to find the right one. That's why I wrote a script to automate this.
By Den in Hackery
December 30, 2020
I had a chat with a friend the other day, and he mentioned off-hand that in his life there is a very unique problem - lack of a short username for their Twitter account. Seems like everything good is already taken, which makes sense considering that Twitter itself is 14 years old. You can bet that in 14 years, a lot of people did get very creative with usernames. Or did they?
I set out to figure out a way to automate this process. I could throw a dictionary at the problem, or just literally generate every word out of a combination of characters, and see what’s available and what’s not by going to https://twitter.com/{letter_combination}
and see which pages exist. This could work in theory, but there is just so much variability about the process, and zero insights on whether the account is actually available, because there could be several reasons why the account is not displayed.
Manual iteration is going to take some time - assuming that I can check one username every 3 seconds, that puts 1000 usernames at 3000 seconds in ideal conditions. So almost an hour of typing and seeing the results. Also, I don’t know about all other engineers, but “ideal conditions” doesn’t quite apply to me, because I will have typos and at some point will need coffee. Besides, if I take all possible combinations of 5 letter words, that puts me at 11,881,376 words to try. So this approach is not quite workable.
So maybe there is a better way? Twitter already does this when I try to change the username, and a little bit API digging uncovers the big prize:
|
|
Coolio, if I make requests against this API, I should be able to quickly pinpoint what’s available and what is not. Here’s a Python script to do this, where I throw a list of generated words at the problem:
|
|
In this case, I took the headers word-for-word from the HTTP request in the browser, just to make sure that my script is as close to the expected environment as possible. Running it, I am able to see what aliases are available - there is a good amount of 5 character IDs still up for grabs (that’s the minimum for Twitter these days)!
With the script, you can check roughly 500 combinations every 15 minutes. And if you are one of those people that is into usernames that start with 0x
(say, if you just like HEX codes so much), there are plenty of 5-letter usernames starting with 0x
, like 0x02b
or 0x0fd
. You can also create custom word combinations based on rules you have in mind, such as “all 6 character words that start with xp
” and drop them in the text file that is read at the beginning of this script, and you’re golden.
Good luck finding the perfect Twitter username!
Feedback
Have any thoughts? Let me know over email by sending a note to hi followed by the domain of this website.