Yourls URL Shortener for Turpial

Maybe you know Yourls, a pretty cool URL shortener which you can set up on your own server very easily. Link shorteners are nice to have because

  1. you can share long links with short urls and
  2. you can view and organise all links you ever shared (incl. statistics and so on).

There are many alternatives like bit.ly, ur1.ca and so on, but Yourls belongs to YOU and you don’t have to pay attention to ToS changes or the provider’s financial status. AND you can use whichever domain you own, for example in my case it’s s.mehl.mx/blabla.

And maybe you also know Turpial, a Twitter client for GNU/Linux systems (I don’t like Twitter’s web page). Until lately I used Choqok, a KDE optimised client, but there were many things which annoyed me: No image previews, slow development, unconvenient reply behaviour and so on. And hey, why not trying something new? So I started to use Turpial which seems to solve all these critic points. Well, like always I missed some preferences to configure. But since it’s Free Software, one is able to look how the software works and to change it – and to share the improvements which I’ll do in the next step!

Turpial already offers some link shorteners but not Yourls. But we can add it manually. To do so, open the file /usr/lib/python2.7/dist-packages/libturpial/lib/services/url/shortypython/shorty.py as root. Now add the following somewhere between the already existing shorteners

Just replace YOUR_DOMAIN and YOUR_SIGNATURE accordingly. The usage of a signature enables you to hide your username and password when sending the shorten requests, like an API key and looks like f51qw35w6 (more about passwordlessAPI). You can retrieve your signature on your Yourls‘ Admin page via „Tools“.

Then add the new service to the list of shorteners. In the same file search for services = { (on the bottom) and add somewhere in the following list:

Well, then just restart Turpial, go to Preferences > Services and choose „yourls-instance“ from the list of Short URL services. Congrats, you should be able to short your URLs with Yourls in Turpial now :)

Any problems or improvements? Drop me a message!

__________
Notes:

  • For me, only hardcoding the signature worked but not the prompt for these data like in some other services stated in the file
  • Another file worth your attention might be /usr/lib/python2.7/dist-packages/turpial/ui/qt/templates/style.css. There you can change colors, fonts and so on. For example, the „Ubuntu“ font wasn’t installed on my system so I just chose Sans Serif instead.

Comment is closed.