@NonNull private List<Video> getItems() { List<Video> items = data.getItems(); if (items == null) items = new ArrayList<>(); return items; }
/** * Given a Youtube videoId, return the relevant Youtube Video object. * @param videoId videoId * @return List of Videos * @throws IOException */ List<Video> getVideoList(String videoId) throws IOException { VideoListResponse videosListResponse = this.youtube.videos().list("snippet,statistics") .setId(videoId) .setKey(config.getApiKey()) .execute(); if (videosListResponse.getItems().size() == 0) { LOGGER.debug("No Youtube videos found for videoId: {}", videoId); return new ArrayList<>(); } return videosListResponse.getItems(); }
/** * @return url of thumbnail if the video is fully processed */ public static boolean checkIfProcessed(String videoId, YouTube youtube) { try { YouTube.Videos.List list = youtube.videos().list("processingDetails"); list.setId(videoId); VideoListResponse listResponse = list.execute(); List<Video> videos = listResponse.getItems(); if (videos.size() == 1) { Video video = videos.get(0); String status = video.getProcessingDetails().getProcessingStatus(); Log.e(TAG, String.format("Processing status of [%s] is [%s]", videoId, status)); if (status.equals(SUCCEEDED)) { return true; } } else { // can't find the video Log.e(TAG, String.format("Can't find video with ID [%s]", videoId)); return false; } } catch (IOException e) { Log.e(TAG, "Error fetching video metadata", e); } return false; } }
return new Pair<>(playlistItemListResponse.getNextPageToken(), videoListResponse.getItems());
.setId(prepareId(url)) .setKey(youtubeApikey); videosList = listVideosRequest.execute().getItems(); } catch (IOException e) { throw new GeneralBusinessException(e);
for (Video video : vlr.getItems()) { if ("public".equals(video.getStatus() .getPrivacyStatus())) {