After the demise of Google Readers sharing function (thanks for that Google), a lot of people in (and out) of the InfoSec community searched about for a suitable replacement, without much joy. As a stop-gap solution I moved over to Tumblr (feed.c22.cc) and starting using it to share interesting things through an RSS feed and have that reposted to Twitter (see my [SuggestedReading] tweets). This seemed to work as well as any solution, but there was one nagging issue that kept bugging me. When you clicked on a [SuggestReading] link posted to Twitter you were redirected to Tumblr, and given the real link to click to see the story. A small issue, but something that bugged me, and bugged people using those links as well…
Feed from Tumblr (example entry):
<item>
<title>
Oatmeal: I tried to watch Game of Thrones and this is what happened
</title>
<description>
<a href="http://theoatmeal.com/comics/game_of_thrones">Oatmeal: I tried to watch Game of Thrones and this is what happened</a>: <p>… and THIS is why people pirate shit!</p>
</description>
<link>http://feed.c22.cc/post/18002558690</link>
<guid>http://feed.c22.cc/post/18002558690</guid>
<pubDate>Tue, 21 Feb 2012 03:19:37 -0500</pubDate>
</item>
As you can see the link tags point to posts on feed.c22.cc (the tumblr blog)… and not direct to the end URL.
So, in a moment of frustration I sat down and wrote some PHP code to rewrite the RSS feed. It’s not well written, and it’s not perfect (infact I struggled a bit with some UTF-8 encoding issues, which I HOPE are now fixed). In the spirit of sharing, I’ve uploaded the source incase anybody with the same issue wants to host their own script to perform rewriting.
Rewritten feed (example entry):
<item>
<title>
Oatmeal: I tried to watch Game of Thrones and this is what happened
</title>
<description>
<a href="http://theoatmeal.com/comics/game_of_thrones">Oatmeal: I tried to watch Game of Thrones and this is what happened</a>: <p>⦠and THIS is why people pirate shit!</p>
</description>
<link>http://theoatmeal.com/comics/game_of_thrones</link>
<guid>http://theoatmeal.com/comics/game_of_thrones</guid>
<pubDate>Tue, 21 Feb 2012 03:19:37 -0500</pubDate>
</item>
The rewriting process is called each time the PHP file is requested, but this can easily be scheduled and output to a file if you need.
Process:
- Feedburner calls rssRwrite.php (self hosted)
- rssRwrite reads in the Tumblr RSS
- Entries are extracted from this RSS
- A new RSS is created (with required changes to the link)
- This new (rewritten) RSS is returned to Feedburner
- Feedburner does it’s thing!
- …
Personally I setup feedburner to access the rewrite PHP link and republish (and share out) the content as required. This step is up to you, but to reduce load on the rewrite script this seemed like the best trade-off, and I use feedburner for sharing things anyway. It’s a bit of a tangled web, but one that seems to work for now!
Hope you enjoy… and please, no laughing at my bad PHP code 😉 comments are, as always, welcomed!
Update:
@mubix pointed me to Yahoo pipes as an easier alternative to achieve the same kind of rewrite… You can cehckout the solution he suggested HERE. I hadn’t really looked much at Yahoo pipes, and TBH, thought it has been discontinued as the Yahoo empire began sinking into the sand from whence it came. Good to see it’s not only still available, but actually one of the few Yahoo resources that is actually useful 😉
Links:
- rssRwrite PHP source –> HERE
Like this:
Like Loading...
Related