这里有一个推荐的方式,使用pytumblr
外部库:
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)
对于深入了解一下什么PARAMS需要,see the source,特别是data
价值,这是一个本地路径的字符串上传或embed
值,这是将加载您的外部托管视频的HTML代码部分。
有关嵌入标签应该是什么样的信息,你可以看到它在response object of the example api:
{
"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>"
}
为什么你不能使用[视频文章](HTTP:// WWW .tumblr.com/docs/en/api/v2#video-posts)与HTML5视频/ Flash嵌入? – jazzpi