2011-12-21 6 views
1

ブラウザベースのアップロード用のサンプルYouTube APIコードをコピーして貼り付けましたが、カテゴリを「ゲーム」に変更すると、エラー。ここで明らかに「ゲーム」は有効なYouTubeカテゴリではありません

サンプルコードです:

$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry(); 

$myVideoEntry->setVideoTitle('My Test Movie'); 
$myVideoEntry->setVideoDescription('My Test Movie'); 
// The category must be a valid YouTube category! 
$myVideoEntry->setVideoCategory('Autos'); 

// Set keywords. Please note that this must be a comma-separated string 
// and that individual keywords cannot contain whitespace 
$myVideoEntry->SetVideoTags('cars, funny'); 

$tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken'; 
$tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl); 
$tokenValue = $tokenArray['token']; 
$postUrl = $tokenArray['url']; 

しかし、私は

$myVideoEntry->setVideoCategory('Gaming'); 

$myVideoEntry->setVideoCategory('Autos'); 

を変更したときに私が得る..

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400 <?xml version='1.0' encoding='UTF-8'?><errors><error><domain>yt:validation</domain><code>invalid_value</code><location type='xpath'>media:group/media:category[@scheme='http://gdata.youtube.com/schemas/2007/categories.cat']/text()</location></error></errors> 

私はこれを唯一のエラーと認識しています。私は実際のYouTubeアップロードフォームのドロップダウンメニューから、ゲームという言葉をコピーして貼り付けようとしましたが、役に立たない(私は必死ではありません)。

これが起こっている理由を知りたい人はいますか?

答えて

5

エラーが表示されましたが、そこにはURL(http://gdata.youtube.com/schemas/2007/categories.cat)がありました。ファイルをダウンロードしたところ、次の行が見つかりました:

<atom:category term='Games' label='Gaming' xml:lang='en-US'><yt:assignable/><yt:browsable regions='AR AU BD BE BG BR CA CO CZ DE DK DZ EE EG ES ET FI FR GB GR HK HR HU ID IE IL IN IR IS IT JO JP KE KR LT LV MA MX MY NG NL NO NZ PH PK PL PT RO RS RU SA SE SG SI SK TH TN TR TW TZ UA UG US VN YE ZA'/></atom:category> 

だから、ゲームの代わりにゲームという言葉を試してみます。

$myVideoEntry->setVideoCategory('Games'); 
関連する問題