Friday, 14 April 2017

Get image url by class name NodeJS regex

I'd like to know how to upload an image to twitter from an URL - so let's say I found a cool image with an URL that I want to upload directly to twitter. Should I convert it to Base64? from what I saw in the examples of the twitter npm you can load one from your own computer yet I didn't see it happen from an URL.

This is what I've tried:

var data = require('fs').readFileSync('https://yt3.ggpht.com/-o-TcMgG50Sw/AAAAAAAAAAI/AAAAAAAAAAA/Pgci_NQl2jM/s88-c-k-no-mo-rj-c0xffffff/photo.jpg');
client.post('media/upload', {media: data}, function(error, media, response) 



via J. Doe

No comments:

Post a Comment