2012-01-20 107 views

回答

3

快速谷歌之后,我发现this

你想要做的是增加一个YT:AccessControl的元素视频条目,与“意见”的一个action属性和“主持”权限属性。我不相信Java客户端库中有本地支持或yt:accessControl元素,所以这需要“手动”完成。下面是 假设你刚刚创建了一个新的视频,然后进行部分更新设置YT一些示例代码:AccessControl的值与用于该视频:

VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry); 

String atomXml = "<?xml version='1.0'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005' gd:fields='yt:accessControl' xmlns:yt='http://gdata.youtube.com/schemas/2007'><yt:accessControl action='comment' permission='moderated'/></entry>"; 

GDataRequest request = service.createPatchRequest(new URL(createdEntry.getEditLink().getHref())); 
request.getRequestStream().write(atomXml.getBytes("UTF-8")); 
request.execute(); 
createdEntry = service.parseResponseData(request, VideoEntry.class); 

// createdEntry now contains the updated VideoEntry, and the access control should be set on it. 
+0

我会尝试它现在。谢谢 – user584397

+0

是的,它非常有用,非常感谢。 – user584397

+0

请在答案中包含解决方案。对我来说 – Alexandru