如何通过gdata.youtube API直接方法插入大于1MB的视频
我正在使用gdata.youtube服务来插入一个视频,但出现了一个错误,提示说文件太大了。其实这个视频并不大,只有1.7MB。在理想情况下,我希望能自然地把文件分成小块,然后逐步上传。请问有没有现成的接口可以做到这一点?
这是我根据谷歌API教程写的代码:
my_media_group = gdata.media.Group(
title=gdata.media.Title(text='My Test Movie'),
description=gdata.media.Description(description_type='plain',
text='My description'),
keywords=gdata.media.Keywords(text='cars, funny'),
category=[gdata.media.Category(text='Autos', scheme='http://gdata.youtube.com/schemas/2007/categories.cat', label='Autos')],
player=None
)
where = gdata.geo.Where()
where.set_location((37.0,-122.0))
# create the gdata.youtube.YouTubeVideoEntry to be uploaded
video_entry = gdata.youtube.YouTubeVideoEntry(media=my_media_group,
geo=where)
new_entry = self.client.InsertVideoEntry(video_entry, 'movie.mov')
这是我遇到的错误:
RequestTooLargeError: The request to API call urlfetch.Fetch() was too large.