Discover more from ErikSoderstrom.com
Use Yahoo Pipes to Shorten Any RSS Feed's URLs with Yourls
Note: If you don't actually care how this is done, I've published a pipe here that will allow you to drop in your Yourls endpoint, secret (found on the tools page), and feed URL. The pipe will output a new feed with the links replaced by ones shortened with your URL shortener. However, I don't recommend this method as it may expose your Yourls secret to the internet allowing anyone to use your shortener's API. Instead, you should clone this pipe and follow the instructions below to hard code your secret.
This project started because IFTTT, one of my other favorite internet tools, doesn't offer native support for any URL shortener other than bitly. Bitly is a great product, and I've been using Bitly Pro to shorten URLS with my own domain since I was approved for the beta, but the service has a major downside. It's popularity means the URLs it generates have become progressively longer, and most of the good keywords have already been taken. Further, its analytics (at least on non-enterprise accounts) really aren't any better than what Yourls offers and its bookmarklet and browser addons have become unnecessarily complex.
Bitly's one remaining advantage is built-in, out-of-the-box third party support. At IFTTT, using your Bitly account to shorten links takes a few clicks. Using Yourls required slightly more creativity. To solve this problem, I turned to Yahoo Pipes, a visual programming tool designed to let you grab and process data from the internet.
This pipe first grabs your RSS feed (or feeds), filters any duplicate items, and arranges them in reverse chronological order. Now comes the fun part: using the URL Builder module, the pipe builds a Yourls API call. We then use xpath to fetch the call and extract the shortened URL. Once that's been done, the pipe rebuilds the feed, substituting the original long URL for the shortened replacement. After saving and running the pipe, you'll be able to get the results as a new RSS feed that will update itself anytime new content is added to the original feed.
To use this with your own Yourls instance, you'll first need to clone this pipe. Then edit the source of your clone. Add your RSS feed URL(s) to the fetch feed module. Enter your yourls endpoint in the base box of the URL builder (Note: be sure to leave off the trailing slash, e.g. Use http://sho.rt instead of http://sho.rt/). Finally, enter your Yourls secret into the private text input's default field. Save the pipe and run it to generate your new RSS feed.
If you like the idea of using your own short domain, but you'd rather have someone else set up the server, send me a note on twitter, and I'll be happy to help you out.