archive about

tumblr api & video uploads

Yesterday I noticed that, for videos uploaded to tumblr, the API does not expose the original file. However, I also noticed that the official “tumblr backup.app” (see http://www.tumblr.com/goodies ) will download the videos!

After some trial and error, I realized that the embeddable js script returned by the API, included a link to an mp4 version of my original upload.

The embed code returned by the API includes something like this

renderVideo("video_player_16306038797", 'http://api.tumblr.com/video_file/16306038797/tumblr_ly7v92s6tg1r9bmzl', 400, 711, 'poster=http%3A%2F%2Fmedia.tumblr.com%2Ftumblr_ly7v92s6tg1r9bmzl_frame1.jpg, http%3A%2F%2Fmedia.tumblr.com%2Ftumblr_ly7v92s6tg1r9bmzl_frame2.jpg, http%3A%2F%2Fmedia.tumblr.com%2Ftumblr_ly7v92s6tg1r9bmzl_frame3.jpg, http%3A%2F%2Fmedia.tumblr.com%2Ftumblr_ly7v92s6tg1r9bmzl_frame4.jpg, http%3A%2F%2Fmedia.tumblr.com%2Ftumblr_ly7v92s6tg1r9bmzl_frame5.jpg' )

Now:
1. api.tumblr.com/video_file/xxxxx/tumblr_yyyy turns out to redirect to the mp4.
2. the next two numbers are width and height of the video
3. the poster “values” are links to stills from the video.

If you need the code to parse and download the files, check tumblr2html.py at https://github.com/vrypan/tumblr2html (it’s the “render_video_post” method).

It works, but it’s a hack. It would be nice to have a documented and more developer-friendly method of accessing the original video.