use of com.google.api.services.youtube.model.Thumbnail in project api-samples by youtube.
the class GeolocationSearch method prettyPrint.
/*
* Prints out all results in the Iterator. For each result, print the
* title, video ID, location, and thumbnail.
*
* @param iteratorVideoResults Iterator of Videos to print
*
* @param query Search query (String)
*/
private static void prettyPrint(Iterator<Video> iteratorVideoResults, String query) {
System.out.println("\n=============================================================");
System.out.println(" First " + NUMBER_OF_VIDEOS_RETURNED + " videos for search on \"" + query + "\".");
System.out.println("=============================================================\n");
if (!iteratorVideoResults.hasNext()) {
System.out.println(" There aren't any results for your query.");
}
while (iteratorVideoResults.hasNext()) {
Video singleVideo = iteratorVideoResults.next();
Thumbnail thumbnail = singleVideo.getSnippet().getThumbnails().getDefault();
GeoPoint location = singleVideo.getRecordingDetails().getLocation();
System.out.println(" Video Id" + singleVideo.getId());
System.out.println(" Title: " + singleVideo.getSnippet().getTitle());
System.out.println(" Location: " + location.getLatitude() + ", " + location.getLongitude());
System.out.println(" Thumbnail: " + thumbnail.getUrl());
System.out.println("\n-------------------------------------------------------------\n");
}
}
use of com.google.api.services.youtube.model.Thumbnail in project api-samples by youtube.
the class Search method prettyPrint.
/*
* Prints out all results in the Iterator. For each result, print the
* title, video ID, and thumbnail.
*
* @param iteratorSearchResults Iterator of SearchResults to print
*
* @param query Search query (String)
*/
private static void prettyPrint(Iterator<SearchResult> iteratorSearchResults, String query) {
System.out.println("\n=============================================================");
System.out.println(" First " + NUMBER_OF_VIDEOS_RETURNED + " videos for search on \"" + query + "\".");
System.out.println("=============================================================\n");
if (!iteratorSearchResults.hasNext()) {
System.out.println(" There aren't any results for your query.");
}
while (iteratorSearchResults.hasNext()) {
SearchResult singleVideo = iteratorSearchResults.next();
ResourceId rId = singleVideo.getId();
// item will not contain a video ID.
if (rId.getKind().equals("youtube#video")) {
Thumbnail thumbnail = singleVideo.getSnippet().getThumbnails().getDefault();
System.out.println(" Video Id" + rId.getVideoId());
System.out.println(" Title: " + singleVideo.getSnippet().getTitle());
System.out.println(" Thumbnail: " + thumbnail.getUrl());
System.out.println("\n-------------------------------------------------------------\n");
}
}
}
Aggregations