Skip to content

Instantly share code, notes, and snippets.

@andrew8088
Created November 25, 2010 21:27
Show Gist options
  • Save andrew8088/715934 to your computer and use it in GitHub Desktop.
Save andrew8088/715934 to your computer and use it in GitHub Desktop.
You can run this script on tumblr.com/following and you'll get an OPML file for tumblogs on that page print out to the console, ready for you to copy+paste into a file and import into Google Reader.
clear();
var feeds = Array.prototype.slice.call(document.querySelectorAll("div.name a")),
i = 0, p, f, doc = "";
while (feeds[i]) {
f = feeds[i];
feeds[i++] = {
htmlUrl : f.href,
xmlUrl : f.href + 'rss',
title : f.innerHTML,
text : f.innerHTML
};
}
doc = '<?xml version="1.0" encoding="UTF-8" ?><opml version="1.0"><head><title>' +
prompt("What should the folder be called?") +
'(Tumblr)</title></head><doc><outline title="tumblr feeds">';
i = 0;
while (feeds[i]) {
f = feeds[i++];
doc += "<outline ";
for (p in f) {
if (f.hasOwnProperty(p)) { doc += p + '="' + f[p] + '" '; }
}
doc += " />";
}
doc += '</outline></doc></opml>';
console.log(doc);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment