2011-12-21 2 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('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 업로드 양식의 드롭 다운 메뉴에서 게임이라는 단어를 복사하여 붙여 넣으려고했지만 아무런 소용이 없었습니다 (필사적이 아님).

누군가 이런 일이 발생하는 이유를 알고 있습니까?

답변

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');