YouTube.Channels.List channelLists = this.youTube.channels().list(CONTENT).setId(this.userInfo.getUserId()).setKey(this.youtubeConfig.getApiKey()); boolean tryAgain = false; do { try { List<Channel> channels = channelLists.execute().getItems(); last_count = channels.size(); for (Channel channel : channels) { item_count++; if (StringUtils.isEmpty(channelLists.getPageToken())) { channelLists = null; } else { channelLists = this.youTube.channels().list(CONTENT).setId(this.userInfo.getUserId()).setOauthToken(this.youtubeConfig.getApiKey()) .setPageToken(channelLists.getPageToken());
/** * Returns a collection of zero or more channel resources that match the request criteria. * * Create a request for the method "channels.list". * * This request holds the parameters needed by the youtube server. After setting any optional * parameters, call the {@link List#execute()} method to invoke the remote operation. * * @param part The part parameter specifies a comma-separated list of one or more channel resource properties that * the API response will include. If the parameter identifies a property that contains child * properties, the child properties will be included in the response. For example, in a * channel resource, the contentDetails property contains other properties, such as the * uploads properties. As such, if you set part=contentDetails, the API response will also * contain all of those nested properties. * @return the request */ public List list(java.lang.String part) throws java.io.IOException { List result = new List(part); initialize(result); return result; }