Upload video using Twitter API


#1

Is it possible to upload video clip using Twitter API? I have the media upload working with photos, but I’d also like to upload a video blob.

Thanks,
Don


#2

It’s not possible using Twitters native media upload, only images are currently supported. If you want to upload videos, you have to use a 3rd party service.


#3

Are there is a 3rd party service that will upload videos to Twitter? Or are you talking uploading to YouTube, etc. and tweeting just the link to the video?


#4

Currently we only support image formats of PNG, JPG and GIF.

As mentioned earlier in the thread, you could use another service such as YouTube etc. More details @ https://developers.google.com/youtube/v3/docs/videos/insert

You could then post the link in a tweet, which should render a video to users.


#5

After finilize the video , i want to post that video with tweet
how can i make the post with video after upload
i used https://api.twitter.com/1.1/statuses/update.json
with status=Posted by App, and media_id=
701681696484134912
it posting only status not the video which is upload.


#6

You have to use the media_ids parameter.


#7

i used media_ids parameter
string url = “https://api.twitter.com/1.1/statuses/update.json”;
string response = string.Empty;
string quary = “posted from MyApp”;

        MultipartFormDataContent form = new MultipartFormDataContent();        
        form.Add(new StringContent(Media_id), "media_ids");
      
        form.Add(new StringContent(quary, Encoding.Unicode), "status");
        HttpClient _client1 = new HttpClient();
        string header = DriveUtilities.GenerateSignatureforTwitterVideo(url, "", Twitter_AccessToken, Twitter_AccessTokenSecret);

        _client1.DefaultRequestHeaders.Add("Authorization", header);
     
        var _Response = await _client1.PostAsync(new Uri(url), form);

        HttpContent responseContent = _Response.Content;

but it posting only status not video
can you provode me any sample code for this.
is any other solution for posting with video?


#8

Do not use MultipartFormDataContent but instead you have to use application/x-www-form-urlencoded