Media ID returned by v1.uploadMedia() but media not uploaded #467
-
import { TwitterApi, EUploadMimeType } from 'twitter-api-v2';
import fetch from 'node-fetch';
const twitterClient = new TwitterApi({
appKey: 'nope',
appSecret: 'nope',
accessToken: 'nope',
accessSecret: 'nope',
});
const response = await fetch(
'https://hlslive-wsczoominwestus.med.nhl.com/editor/3552af25-4e72-4022-910a-cbbabeb4be8d.mp4',
);
const buffer = Buffer.from(await response.arrayBuffer());
twitterClient.v1
.uploadMedia(buffer, { mimeType: EUploadMimeType.Mp4, longVideo: true })
.then((val) => {
console.log(val);
console.log('success');
})
.catch((err) => {
console.log(err);
}); As you can tell by the screenshot, this appears to be working fine. However, despite the success message, the video doesn't actually get uploaded to my Twitter account as expected. Does anyone know possible reasons behind this? |
Beta Was this translation helpful? Give feedback.
Answered by
2000JacobHub
Apr 25, 2023
Replies: 1 comment 1 reply
-
I think it might be necessary to also use the method v1.tweet() |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
t1mp4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think it might be necessary to also use the method v1.tweet()
const tweet = await twitterClient.v1.tweet("", {
media_ids: media,
});