Skip to content

Instantly share code, notes, and snippets.

@dotcomboom
Forked from andrew8088/tumblr2opml.js
Last active July 31, 2023 04:08
Show Gist options
  • Save dotcomboom/840d11364dcac4521bfecff1593e4b98 to your computer and use it in GitHub Desktop.
Save dotcomboom/840d11364dcac4521bfecff1593e4b98 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. -- Edited, revised to work on current tumblr. tested with quiterss
clear();
var feeds = Array.prototype.slice.call(document.querySelectorAll("div.yElCb a")),
i = 0, p, f, doc = "";
while (feeds[i]) {
f = feeds[i];
feeds[i++] = {
htmlUrl : f.href,
xmlUrl : f.href + 'rss',
title : f.innerText.replace('\n', ' ').split(' ')[0],
text : f.innerText.replace('\n', ' ').split(' ')[0]
};
}
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