Created
October 9, 2012 14:41
-
-
Save nathanleclaire/3859251 to your computer and use it in GitHub Desktop.
Node Reddit api login and comment
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
request.post({url: 'http://www.reddit.com/api/login', | |
qs: { | |
username: 'nate', | |
passwd: 'meta', | |
api_type: 'json' | |
}}, | |
function(error, response, body) { | |
if (!error && response.statusCode === 200) { | |
// var mod_hash = body.whatever; | |
// etc ... | |
request.post({url: 'http://www.reddit.com/api/comment', | |
qs: { | |
'uh': mod_hash, | |
'text': 'hello, world', | |
}}, | |
function(error, response, body) { | |
if (!error && response.statusCode === 200) { | |
console.log("Success!"); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment