reddit-user-dump
v0.0.6
Published
dumps a redditor's history in json
Downloads
16
Readme
reddit-user-dump
scrapes a reddit user's complete post history
(thanks to max ogden for inspiration https://github.com/maxogden/subreddit-youtubes)
NEW: you can also pass in a second argument that will stop parsing if the comment is older than a given 'created' value
install
npm install reddit-user-dump
example
var lastParsed = 0;
function wrapper(username, callback) {
var test = require('../index.js')
console.log(test);
var submissionCount = 0;
var commentCount = 0;
var total = 0;
test(username, lastParsed)
.on('user', function(userObj) {
console.log(userObj);
})
.on('submission', function(submission) {
submissionCount += 1;
})
.on('comment', function(comment) {
//console.log('comment found!');
commentCount += 1;
})
.on('page', function(after, count) {
total += count;
console.log('page complete found',
'submission: ', submissionCount, 'comment', commentCount, 'total', total);
})
.on('data', function(obj) { //this is a comment or submission that is pushed
if (obj.data.created > lastParsed) lastParsed = obj.data.created;
})
.on('end', function() {
console.log('end')
console.log('parse complete found',
'submission: ', submissionCount, 'comment', commentCount, 'total', total);
callback();
})
.on('error', function(err) {
console.log('err', err)
});
}
wrapper('hortinstein', function(e, r) {
wrapper('hortinstein', function() {
});
})
license
BSD