ブラウザベースのアップロード用のサンプル YouTube API コードをコピーして自分の Web サイトに貼り付けましたが、カテゴリを「ゲーム」に変更すると表示され、不正なリクエスト エラーが発生します。
コード例は次のとおりです。
$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('Autos');
に
$myVideoEntry->setVideoCategory('Gaming');
私は得る..
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アップロードフォームのドロップダウンメニューからGamingという単語をコピーして貼り付けようとしましたが、役に立ちませんでした(必死ではありませんか)。
なぜこれが起こっているのか、誰にも手がかりがありますか?