Skip to content

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

@rogers-dwiputra

Description

@rogers-dwiputra

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'
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions