Reputation: 19
How do I list videos from a YouTube channel using YouTube API? I've created a project, I have the YouTubePlayerApi
in my project and I have a API
key, but I can't find a tutorial that shows how to use it. The tutorials I've seen have either been inaccuarate or really hard to follow along and understand.
Upvotes: 0
Views: 2241
Reputation: 17613
You can check the Java sample in Videos.list:
// Sample java code for videos.list
public static void main(String[] args) throws IOException {
YouTube youtube = getYouTubeService();
try {
HashMap<String, String> parameters = new HashMap<>();
parameters.put("part", "snippet,contentDetails,statistics");
parameters.put("id", "Ks-_Mh1QhMc");
YouTube.Videos.List videosListByIdRequest = youtube.videos().list(parameters.get("part").toString());
if (parameters.containsKey("id") && parameters.get("id") != "") {
videosListByIdRequest.setId(parameters.get("id").toString());
}
VideoListResponse response = videosListByIdRequest.execute();
System.out.println(response);
}
}
Upvotes: 1