Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Header for Binary Request (Twitter Media Download) #352

Open
rogers-dwiputra opened this issue Apr 8, 2020 · 0 comments
Open

Custom Header for Binary Request (Twitter Media Download) #352

rogers-dwiputra opened this issue Apr 8, 2020 · 0 comments

Comments

@rogers-dwiputra
Copy link

Hi, I don't know is this feature already exist or not because I can't find clear documentation about this, I need to make request that respond binary file (twitter media/image) so I can download it, here is my sample code :

`async function getTwitterUserProfileWithOAuth1 (username = 'youritguy4') {
var oauth = new OAuth.OAuth(
'https://api.twitter.com/oauth/request_token',
'https://api.twitter.com/oauth/access_token',
consumer_key,
consumer_secret,
'1.0A', null, 'HMAC-SHA1'
)
const get = promisify(oauth.get.bind(oauth))

var file = fs.createWriteStream('./img/'+moment().unix()+'.jpg');

//this get request should return binary based
get(
https://ton.twitter.com/1.1/ton/data/dm/1247396998774280197/1247396972383764481/9pT24oPh.jpg,
access_token_key,
access_token_secret
).then((img) => {
console.log(img);
})

return 'ok'
}`

@rogers-dwiputra rogers-dwiputra changed the title Customer Header for Binary Request (Twitter Media Download) Custom Header for Binary Request (Twitter Media Download) Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant