Mitul Dabhi
answered Nov 30 '-1 00:00
1. download Google API Client Library for Java
2. Append jar to your project
in Eclipse, set the "Source attachment" for each class jar file to its corresponding "-sources" jar file.
so extract zip and attach following jar to Application environment
data-client-1.0.jar
gdata-youtube-2.0.jar
gdata-core-1.0.jar
gdata-media-1.0.jar
3. write some code
suppose following code is for list of video uploaded by user
List<String> scopes = Lists.newArrayList("https://www.googleapis.com/auth/youtube.readonly");
try {
Credential credential = Auth.authorize(scopes, "myuploads");
youtube = new YouTube.Builder(Auth.HTTP_TRANSPORT, Auth.JSON_FACTORY, credential).setApplicationName(
"youtube-cmdline-myuploads-sample").build();
YouTube.Channels.List channelRequest = youtube.channels().list("contentDetails");
channelRequest.setMine(true);
channelRequest.setFields("items/contentDetails,nextPageToken,pageInfo");
ChannelListResponse channelResult = channelRequest.execute();\
List<Channel> channelsList = channelResult.getItems();
} catch (Throwable t) {
t.printStackTrace();
}
more sample @
Github , @google-developer-doc