/** * Given a feed and an after and before date, fetch all relevant user videos * and place them into the datumQueue for post-processing. * @param feed ActivityListResponse * @param afterDate DateTime * @param beforeDate DateTime * @throws IOException IOException * @throws InterruptedException InterruptedException */ void processActivityFeed(ActivityListResponse feed, DateTime afterDate, DateTime beforeDate) throws IOException, InterruptedException { for (com.google.api.services.youtube.model.Activity activity : feed.getItems()) { try { List<Video> videos = new ArrayList<>(); if (activity.getContentDetails().getUpload() != null) { videos.addAll(getVideoList(activity.getContentDetails().getUpload().getVideoId())); } if (activity.getContentDetails().getPlaylistItem() != null && activity.getContentDetails().getPlaylistItem().getResourceId() != null) { videos.addAll(getVideoList(activity.getContentDetails().getPlaylistItem().getResourceId().getVideoId())); } processVideos(videos, afterDate, beforeDate, activity, feed); } catch (Exception ex) { LOGGER.error("Error while trying to process activity: {}, {}", activity, ex); } } }