Skip to content

Instantly share code, notes, and snippets.

@nathanleclaire
Created October 9, 2012 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanleclaire/3859251 to your computer and use it in GitHub Desktop.
Save nathanleclaire/3859251 to your computer and use it in GitHub Desktop.
Node Reddit api login and comment
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