2013-05-17 4 views
0

내 앱에서 YouTube 동영상을 업로드하고 그 동영상을 찾으러 왔습니다. json을 사용하여 youtube에서 비디오 (categoryID) 검색

할 수

그래서 내가 catagotyid를 추가 할

snippet.setTitle("Test Upload via Java on " + cal.getTime()); 
     snippet.setDescription(
      "Video uploaded via YouTube Data API V3); 

     // Set your keywords. 
     List<String> tags = new ArrayList<String>(); 
     tags.add("test"); 
     tags.add("example"); 
     tags.add("java"); 
     tags.add("YouTube Data API V3"); 
     tags.add("erase me"); 
     snippet.setTags(tags); 

그래서 난 그냥 추가, 설명 등을 v3 youtube api

여기

제목을 추가하는 데 사용하는 코드의 일부를 사용하여 비디오를 업로드 :

snippet.setCategoryId("test"); 

이 순간에 업로드 코드가 작동하지 않는 이유는 무엇입니까?

to retrieve all the video that upload by my app i need to fill in part line "snippet" (without Quotes) and in id line add my category id like "test" (without Quotes), and then result catch by json ?

는 UPDATE :

은 어떻게 "try it!"를 작성해야

? catagoryID의 목록을 수신하고 목록이 있다고 가정하면 어떤 카테고리를 선택할 지 어떻게 알 수 있습니까? 나는 무엇인가를 놓치고 있다고 생각하지 않습니다.

답변

1

GET 요청을보십시오 :

https://www.googleapis.com/youtube/v3/videoCategories?part=snippet&regionCode=US&key={YOUR_API_KEY} 

물론 {YOUR_API_KEY}을 키로 바꿉니다. 다음과 같이 반환해야합니다.

{ 
"kind": "youtube#videoCategoryListResponse", 
"etag": "\"Fn7tolrWrLXf7uknBpwCU9OfMA8/jOw8Jx4EQq_udW-0UgiRcCMWqWQ\"", 
"items": [ 
    { 
    "id": "1", 
    "kind": "youtube#videoCategory", 
    "etag": "\"Fn7tolrWrLXf7uknBpwCU9OfMA8/gljmmWdkbtlCrMi74KVYLrbTaIA\"", 
    "snippet": { 
    "channelId": "UCBR8-60-B28hp2BmDPdntcQ", 
    "title": "Film & Animation" 
    } 
    }, 
    { 
    "id": "2", 
    "kind": "youtube#videoCategory", 
    "etag": "\"Fn7tolrWrLXf7uknBpwCU9OfMA8/n1RtRMaPpKgph8MvS9wf742Tm5U\"", 
    "snippet": { 
    "channelId": "UCBR8-60-B28hp2BmDPdntcQ", 
    "title": "Autos & Vehicles" 
    } 
    }, 
    { 
    "id": "10", 
    "kind": "youtube#videoCategory", 
    "etag": "\"Fn7tolrWrLXf7uknBpwCU9OfMA8/1LzYK9Uf9Nt0hzBqNqhuHw0LPI0\"", 
    "snippet": { 
    "channelId": "UCBR8-60-B28hp2BmDPdntcQ", 
    "title": "Music" 
    } 
    }, 
관련 문제