Skip to content

Instantly share code, notes, and snippets.

@chromakode chromakode/saved.js
Created Jun 22, 2011

Embed
What would you like to do?
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
You can’t perform that action at this time.