Created
June 22, 2011 03:40
-
-
Save chromakode/1039468 to your computer and use it in GitHub Desktop.
Fetch saved links from reddit. Paste into a web browser's JavaScript console to run. Make sure you enable popups.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(cb, after, saved) { | |
var next = arguments.callee | |
console.log("Requesting after", after) | |
$.getJSON('http://www.reddit.com/saved/.json', {after:after}, function(data) { | |
saved = (saved || []).concat(data.data.children) | |
if (data.data.after) { | |
console.log('Fetched:', saved.length) | |
next(cb, data.data.after, saved) | |
} else { | |
cb(saved) | |
} | |
}) | |
})(function(saved) { | |
var out = [] | |
saved.forEach(function(r) { | |
out.push('<p><a href="' + r.data.url + '">' + r.data.title + '</a></p>') | |
}) | |
window.open('data:text/html,'+out.join('')) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment