Youtube API - 设置视频缩略图(python)
问题描述
是否可以为通过 YouTube API 上传的视频指定您自己的缩略图?
使用最新版本的 Python 库,我似乎可以在将视频条目插入 YouTube 之前创建和设置媒体组的缩略图 - 但是指定的缩略图不会在视频本身上设置.
Using the most recent version of the Python Library, it appears that I can create and set the thumbnail of my media group before inserting a video entry to YouTube - however the thumbnail specified does NOT get set on the video itself.
我正在使用类似这样的代码:
I'm using code similar to this:
from gdata import media
from gdata.youtube import YouTubeVideoEntry
from gdata.youtube.service import YouTubeService
# Create a thumbnail and pass it to my media group
thumbnail = media.Thumbnail(url='http://valid_image_url.jpg')
media_group = media.Group(thumbnail=thumbnail, title='foo', ...)
# Use the media group to create a video entry
entry = YouTubeVideoEntry(media=media_group)
# Create a service instance and use it to login
service = YouTubeService(...)
service.ClientLogin(...)
# Get video file
file = open('/path_to_video.mp4', 'rb')
# Push the video to YouTube
service.InsertVideoEntry(
entry,
file
)
# Close the file
file.close()
解决方案
否.使用标准的 YouTube API,您无法以编程方式为视频设置缩略图.
No. Using the standard YouTube API, you cannot programatically set a thumbnail for your video.
但是,如果您是 内容合作伙伴并有权访问 YouTube CMS(您的合作伙伴经理可以启用),您显然可以从那里设置您的视频艺术作品.我将在完成此过程时发布详细信息.
However, if you are a content partner and have access the YouTube CMS (which your partner manager can enable), you can apparently set your video artwork from there. I'll post details as I run through this process.
相关文章