How to send embedded video to Tumblr using the Tumblr API?

I want to publish a video in tumblr on behalf of the user using the tumblr api (after receiving its access token). It works great with youtube / vimeo videos, but not when providing a specific video URL (without actually downloading from scratch), like this video . I want my video to play in the tumblr toolbar (and in the user's blog).

I use the following endpoint: https://api.tumblr.com/v2/blog/myblog.tumblr.com/postHere with these parameters:

params = {'type': 'video', 'caption': 'my cool video post!', 'embed': 'https://d22d7v2y1t140g.cloudfront.net/m_8386091_p64lvWa7cCG7.mov.mp4', 'format': "html"} 

How can I do something similar for other types of videos?

+7
python api video embedded-video tumblr
source share
1 answer

It is recommended that you use the pytumblr external library:

 import pytumblr client = pytumblr.TumblrRestClient( '<consumer_key>', '<consumer_secret>', '<oauth_token>', '<oauth_secret>', ) # Now that you're established, look at the client.create_video method. client.create_video(**kwargs) 

For further study of what parameters are required, see the source , especially the data value, which is a local path to the download path or the embed value, which is a section of HTML code that will load your video from the outside.

For information on what the embed tag should look like, you can see it in the object in the api example :

 { "width": 250, "embed_code": "<object width=\"248\" height=\"169\"><param name=\"movie\" value=\"http:\/\/www.youtube.com\/ v\/4Q1aI7xPo0Y&rel=0&egm=0& showinfo=0&fs=1\"><\/param><param name=\"wmode\" value=\"transparent\"><\/param><param name=\" allowFullScreen\" value=\"true\"><\/param><embed src=\"http:\/\/www.youtube.com\/v\/ 4Q1aI7xPo0Y&rel=0&egm=0&showinfo= 0&fs=1\" type=\"application\/x-shockwave-flash\" width=\"248\" height=\"169\" allowFullScreen=\"true\" wmode=\"transparent\"><\/embed><\/object>" 

}

+2
source share

All Articles