Skip to main content

Using your own URL Shortener in Gwibber

·3 mins
Obsolete Post

After starting to use my own URL shortner service (see (, the next thing I wanted to do was to try and get it integrated into Gwibber (see ( Turns out its really simple to do it. I’ll advice you to do this while Gwibber is not running.


  • This was tested on Ubuntu 11.04 and the instructions are meant to be for Ubuntu (Any Debian based distros should be similar)
  • The version of Gwibber this was tried against was

Step 1 : Create your protocol file #

First of all, choose your URL shortner service. I will continue this example taking my own url shortner as example. To keep it secure I have obfuscated some parameter. If you want to use my service, just drop me an email or tweet. You are always welcome to use the web interface at (I know the name is not creative. Suggestions are most welcome).

What you essentially need is a way of making an API call to your service. Once you know the format of the call, create a file, say, whose content should look like this -

""" interface for Gwibber
 jairamc (Jairam Chandar) - 2011-09-30
import urllib2

  "name": "",
  "version": 0.1,
  "fqdn" : "",

class URLShorter:
  def short(self, text):
    short = urllib2.urlopen("" % urllib2.quote(text)).read()
    return short

The main line to notice is line number 15. Replace the text inside quotes with a suitable API call for the service you want and save this file. For instance, if you wanted to create a service for Gwibber (currently not supported), here is an example (of course there is a little more voodoo involved with the api) -

Step 2 : Place the URL protocol in correct location #

Copy the above protocol file to /usr/share/pyshared/gwibber/microblog/urlshorter/ and then create a symlink to it from /usr/lib/python2.7/dist-packages/gwibber/microblog/urlshorter`. Your version of python installed might be different.

sudo mv /usr/share/pyshared/gwibber/microblog/urlshorter/"

sudo ln -s /usr/share/pyshared/gwibber/microblog/urlshorter/ /usr/lib/python2.7/dist-packages/gwibber/microblog/urlshorter/

Step 3 : Make Gwibber aware of your protocol file #

Edit the file (see location below) and add your new URL shortner service.

sudo vi /usr/lib/python2.7/dist-packages/gwibber/microblog/urlshorter/

The file should look like this -

   import cligs, isgd, tinyurlcom, ur1ca, urljairamme
   #import snipurlcom, zima

     "": cligs,
     "": isgd,
     #"": snipurlcom,
     "": tinyurlcom,
     "": ur1ca,
     "": urljairamme,
     #"": zima,

Notice lines 1 and 10. These are the new/edited lines in the file for the new service.

 Step 4 : Change preferences in Gwibber to the new URL shortner service #

  1. Open Gwibber
  2. Edit -> Preferences -> Messages -> Advanced -> Select the new service

And you are done.