The body of the PUT request is an Atom
XML entry that contains information
about the video. You can include any
of the following elements and their
subtags in your request. Required
elements are marked with an asterisk
(*).
^{pr2}$
Note that excluding an element will
delete the information that already
exists for that video.
您可以使用扩展元素,请检查here和上一个答案here
评分、评论、列表都是yt:accessControl的一部分
我相信您需要使用YouTube API的2.0版本,各种特定语言的API,包括Python,目前只提供1.0版本。但是,更新一个视频以使用裸机2.0操作来更改访问控制并不难,即使您正在通过特定于语言的API执行其他所有操作。The docs(对于2.0 API)解释:
^{pr2}$…因此,您必须重复上载时提供的一些信息(以避免删除该信息),以便能够添加
yt:accessControl
元素。在上传的文档有一个complete example标题、
multipart-related
格式和您将要发送的XML(根据文档的this part添加访问控制标记),但示例是POST
,而不是PUT
,因为它上载的是视频,而不是更改其信息(和访问控制)。要通过Python的标准库发送GET和POST以外的HTTP方法,请使用httplib:生成一个HTTPConnection
,然后调用其request方法,其中PUT
作为第一个参数,然后是URL(主机之后的部分,请参阅Python联机文档本节末尾的示例),正文(Youtube 2.0API文档中的示例部分最后是标题)。在
是的,它绝对没有gdataapi那么方便,但是,在gdataapi更新为支持2.0api功能之前,我怀疑这是最好的方法。主要的替代方法是调整PythonAPI源代码(找到here),以添加您需要的2.0位功能,但是,我觉得这项工作要做得更多。在
相关问题 更多 >
编程相关推荐