Created
March 20, 2013 09:06
-
-
Save diorahman/5203307 to your computer and use it in GitHub Desktop.
upload image to twitter using request.js
This file contains hidden or 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
| var request = require('request') | |
| var fs = require('fs') | |
| var path = require('path') | |
| var oauth = { | |
| consumer_key: "consumer_key", | |
| consumer_secret: "consumer_secret", | |
| token: "token", | |
| token_secret: "token_secret" | |
| } | |
| var url = "https://upload.twitter.com/1/statuses/update_with_media.json" | |
| var r = request.post({url : url, oauth : oauth}) | |
| var form = r.form() | |
| form.append('status', 'node it is') | |
| form.append('media[]', fs.createReadStream(path.join(__dirname, 'test.png'))) | |
| r.on('data', function(data){ | |
| console.log(data.toString()) | |
| }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to implement in my HTML file?
is juery.min.js is required to implement twitter feed in my html page
Can you suggest me ?