Open Zakichanu opened 2 years ago
Hey @Zakichanu , Can you please share your full code here. I'm not expert in media upload but I know that there are several steps to upload something. Thanks !
Yes of course, here it is : so I'm using curl to save a mp4 video locally and then i tweeted it :
// Linux commande that save my mp4 file from the internet
String commande = "curl " + replayPath + " --output "+fileName;
System.out.println(commande);
ProcessBuilder builder = new ProcessBuilder(commande.split(" "));
builder.directory(new File(getPathToDirOfBoardLive() + "/Replay/"));
builder.start();
// Post with video
File replay = new File(getPathToDirOfBoardLive() + "/Replay/" + fileName);
UploadMediaResponse vidReplay = twitterClient.uploadMedia(replay, MediaCategory.TWEET_VIDEO);
Tweet statusWitVid = twitterClient.postTweet("Replay of it: ", entry.getValue(), vidReplay.getMediaId());
Ok the issue is related to https://github.com/redouane59/twittered/issues/183 The feature is a little bit hard to implement and I never took the time to do that because it's a V1 endpoint which will be soon replaced. If you have some time you can submit a pull request to fix it. See here
Please note that to upload videos or GIFs (tweet_video, amplify_video, and tweet_gif), you need to use the chunked upload end-point.
Otherwise you'll have to wait for Twitter Team to make the V2 available.
Okay, I see, thank you it helps me a lot, and if i have time I will for sure put some work on this bug! Thx 😊
Thanks, as the problem is not solved, please let it opened :)
I have this error when i want to upload a mp4 video... [Timer-1] ERROR io.github.redouane59.twitter.helpers.AbstractRequestHelper - (POST) Error calling https://upload.twitter.com/1.1/media/upload.json?media_category=tweet_video {"request":"\/1.1\/media\/upload.json","error":"media type unrecognized."} - 400 Any advice?