Skip to content

Retrieving Media (Direct Messages) #219

Answered by alkihis
thesrs02 asked this question in Q&A
Discussion options

You must be logged in to vote

Yep, no wrapper exists for ton.twitter.com, you're right!

You can download them using the lib, with a little trick it should work.
This isn't optimal, but I welcome it as a feature request!

// login with OAuth1.0a
const client = new TwitterApi({ appKey: '', appSecret: '', accessToken: '', accessSecret: '' })

// Get your dms
// ...

// Download a media protected by OAuth
const imgRaw = await client.get<string>(dm.media_url_https, undefined, { prefix: '' })
const imgAsBuffer = Buffer.from(imgRaw)

// use/save imgAsBuffer

Tell me if it works :)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by thesrs02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants