Simple way to upload video (Java)

video
twitter4j
media-upload
java

#1

Hi,
I want to upload video on twitter through Java. I have find the code in this link https://github.com/mrisney/twitter-java-ads-sdk/blob/master/src/examples/VideoUploadExample.java but I want to know if there is a possibility to upload the video using twitter4j. If not, is there any other java code example to do that?
Thanks,


#2

It looks like there is an outstanding pull request to add this to Twitter4j. You could try patching your build.


#3

Thanks for your reply. So I must edit my twitter4j-core by downloading the new one. Is that the right way? And how can I use that? For example for the image this is how I procede.

        StatusUpdate statusUpdate = new StatusUpdate(text);
        
        statusUpdate.setMedia("New pic", new URL(photo).openStream());

        twitter.updateStatus(statusUpdate.inReplyToStatusId(tweetId));

        log.info("Successfully updated the status in Twitter (image).");

How can I do it for the video?


#4

We don’t officially support third party libraries like Twitter4j (although we love that the community creates them!) - if you need additional support you might want to check with other Java developers or the library author.


#5

Hello can you show me how to reply with video usimg twitter4j?