: New: Follow Twitter in Google Reader Bookmarklet

Update: the version of the bookmarklet described on this page no longer works, sorry. You want the updated version which works instead.

Twitter changed their UI and now I can't find any tweeter's RSS feed. I subscribe to a few hundred Twitter fields in Google Reader and I'd like to subscribe to even more of them. But I can't unless I can get at the RSS feeds. So I wrote a little JS bookmarklet. I dragged it to my browser's bookmark bar. And now when I'm on a Twitter page, I click the bookmarklet and it takes me to the Google Reader page where I can reader-ishly subscribe to the Twitter feed. Uhm, though usually the first time I click the bookmarklet, I get "No feed found". So then I click the Back button, then click the Bookmarklet again and then it works. Why only the second time? Heck if I know. Worse, this script is kind of brittle; if Twitter changes something in their page markup, it'll break this script. Despite this jankiness, I bet I'll find it pretty useful up until the time it breaks.

If I were clever, I'd make a draggable bookmarklet you could drag to your bookmark bar, here. But now my JS is fighting with my blogging syndication software... Uhm, I'll just leave the source here. Put that on one line with a "javascript:" at the beginning and you're good.

scrid = function() { return document.getElementsByClassName("profile-card-inner")[0].getAttribute("data-user-id"); }; 
feed = function(s) { return "http://twitter.com/statuses/user_timeline/" + s + ".rss"; }; 
document.location = "http://www.google.com/reader/view/#stream/feed%2F" + encodeURIComponent(feed(scrid()))

The scrid function scrapes the page to find the twitter id. The feed function makes a Twitter feed URL from that ID.

Tags: programming feed addiction

blog comments powered by Disqus