Hi Colleagues!
I use Twitter REST API to make tweets with text and video programmatically.
I do it from Node.js using ‘twitter’ module, but it’s not principal. The final web requests to make it done are much more interesting for me.
Previously I made it such a way:
- uploaded the video to Twitter asynchronously using
/media/upload method with {file_path: 'path_to_uploaded_file'} parameter and got media_id;
- created a tweet using
/statuses/update method with parameters:
{status: 'Tweet text', media_ids: ['received_media_id']}
It worked perfectly but now we need to make tweets with longer video (with maximum length not 30 but 140 seconds). So now I try to do following steps:
-
upload video the same way as before but with parameters
{file_path: 'path_to_uploaded_file', media_category: 'tweet_video'} (the last one is necessary to upload longer video as discussed here);
-
use the received media_id as a parameter for /statuses/update the same way as above.
The first step works well. But the second gives me the following message:
sharing to twitter failed : { [Error: Not valid video]
cause:
{ [Error: Not valid video]
message: ‘Not valid video’,
code: 324,
allErrors: [ { code: 324, message: ‘Not valid video’ } ],
twitterReply: { errors: [ { code: 324, message: ‘Not valid video’ } ] },
statusCode: 400 },
isOperational: true,
code: 324,
allErrors: [ { code: 324, message: ‘Not valid video’ } ],
twitterReply: { errors: [ { code: 324, message: ‘Not valid video’ } ] },
statusCode: 400 }
It’s interesting that even short videos (<30 sec) uploaded with media_category parameter can’t be posted standard way via /statuses/update and return the same error message.
What am I doing wrong? And is there a way to make tweet with long video programmatically?