Skip to content

Instantly share code, notes, and snippets.

@chromakode
Created June 22, 2011 03:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chromakode/1039468 to your computer and use it in GitHub Desktop.
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.
(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