2012-01-20 5 views

答えて

3

速いGoogleの後、thisが見つかりました。

アクションの属性が「コメント」で許可の属性が「モデレート」のyt:accessControl要素をビデオエントリに追加します。 Javaクライアントライブラリにネイティブサポートやyt:accessControl要素があるとは思わないので、これは "手作業"で行う必要があります。そのビデオのための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

私は今それを試してみましょう。ここ は、あなただけの新しい動画を作成したと仮定し、その後、YTを設定する部分更新を行い、いくつかのサンプルコードです。おかげで – user584397

+0

はい、それは動作します、ありがとうございます。 – user584397

+0

答えに答えを含めてください。私のために – Alexandru