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='denied'/>"+
"<yt:accessControl action='rate' permission='denied'/></entry>";
System.out.println("Dsiabling Comments and Rating");
GDataRequest request = service.createPatchRequest(new URL(entry.getEditLink().getHref()));
request.getRequestStream().write(atomXml.getBytes("UTF-8"));
request.execute();
System.out.println("Dsiabling Comments and Rating COMPLETED");
在上面的代码条目中是一个 VideoEntry,它是通过将视频上传到 YouTube 来重新调整的。但是当我尝试代码时,它会抛出一个空指针异常。对此的任何修复。如果有任何其他设置评论和评级的方式也可以禁用它。视频发布后,我会执行以下操作。