Short URL Discovery Using Google App Engine

URL Shorteners and Link Rot

Short urls have numerous benefits I won't go through here, one example is for use in twitter which has a string length limit of 140 characters, another example is shortening urls with Google Analytics campaign tracking url variables.

The problem with all of the third party url shortening services out there is that eventually they will have to reset old urls in order to continue providing "short" urls, and even if they don't they could at any time stop providing service, in either case any link using the short url will be dead. Dead links are something all webmasters and users dislike.

The best way to defend against link rot is to create your own personal url shorting service for your own use, on a domain that you control. An added benefit to this approach for Google Analytics campaign tracking is that you will have the control to change the variable values in your campaign links even after the links have been used, like in an email campaign that wasn't setup properly for example.

Google App Engine (GAE)

Google App Engine is another one of those fantasic services which Google provides, this one however is meant to give developers the ability to write their own apps to use the Google infrastructure. GAE provides two programming language choices: Java and Python. Python was the first choice available and recently Java became a option.

I knew about the Google App Engine for a while now, but did not get started writing apps until I saw this RevCanonical project by Kellan who provided the source . After I saw Kellan's source, I noticed that it did not check the HTTP Headers for Links, which was a proposed technique which can potentially save a lot of bandwidth. Also, because I was interested in learning Python, GAE, and Git, I decided to created a copy of the Git repository, and run the code on one of my own Google App Engine spaces, and I learned how to do this by reading the Google App Engine Python tutorial. After I got Kellan's code running, I dug into the Python tutorial (which was an excellent read), and started hacking away the code.

Get Short URL

Well after modifying the RevCanonical project's source code I had made Get Short URL. Get Short URL will scan HTTP and HTML header links for a url which is sigalled as an alternative for the given url, this can be signaled a few different ways which I list at http://getshorturl.appspot.com

I must thank Kellan too, because I learned a lot from his source, and it got me started learning Python, and once I figure out Git I will create a patch for his project.

© Erik Vold 2007-2010. Contact Erik Vold. Top ^