Youtube API - 设置视频缩略图(python)

Youtube API - Set the Thumbnail of Video (python)(Youtube API - 设置视频缩略图(python))

本文介绍了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.

这篇关于Youtube API - 设置视频缩略图(python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Youtube API - 设置视频缩略图(python)

基础教程推荐