23 October 2011
When creating a Twitter account there is the very difficult problem of choosing a handle. I could try my full name, but apparently Twitter thinks it’s too long. I can’t even fit my full first and last name in the name field on the profile settings page. I’m stuck with just Friso. My first name as a handle was already taken and I don’t feel that @friso1981 looks very compelling. Beyond that I figured that it would be important to have a name that’s fairly easy to memorize, so people pick it up from slide decks easily (my main Twitter use case is communicating at conferences). With this in mind, I decided that I should have a three character Twitter handle. Of course, you’d expect all of these to be spoken for already. Guess again. There was exactly one available: @fzk.
How do you figure out which three character names are still there to pick? Well, you check all permutations against the API that Twitter’s sign up page uses to do the AJAX magic that let’s you know whether your chosen handle is still available.
import urllib import json result = open('tla.txt', 'w') str = "abcdefghijklmnopqrstuvwxyz" for permutation in ["" +x +y +z for x in str for y in str for z in str]: try: req = urllib.urlopen('http://twitter.com/users/username_available?suggest=0&username=' + permutation) data = json.loads(req.readline()) if (data['valid']): print "Got one: " + permutation result.write("Available: " + permutation + '\n') result.flush() else: print "Nope: " + permutation except: print "Error: " + permutation result.write("Error: " + permutation + '\n') result.flush()
Interestingly, these three character handles come and go. Apparently people free them up every now and then. Don’t know why. I decided to run the script again and at the time of this writing both @jqn and @zqo are available. Perhaps people had trouble with the names containing a q. Now I am tempted to run this daily and see how TLA Twitter handles get claimed and released over time…blog comments powered by Disqus