ChannelListResponse channelListResponse = youtube.channels().
list("brandingSettings,localizations").setForUsername("jacksepticeye").execute();
List<Channel> channelList = channelListResponse.getItems();
Channel channel = channelList.get(0);
ChannelContentDetails contentDetails = channel.getContentDetails();
String uploads = contentDetails.getRelatedPlaylists().getUploads();
List<PlaylistItem> playlistItemList = new ArrayList<PlaylistItem>();
YouTube.PlaylistItems.List playlistItemRequest =
youtube.playlistItems().list("id,contentDetails,snippet");
playlistItemRequest.setPlaylistId(uploads);
playlistItemRequest.setFields(
"items(contentDetails/videoId,snippet/title,snippet/publishedAt),nextPageToken,pageInfo");
PlaylistItemListResponse playlistItemResult = playlistItemRequest.execute();
playlistItemList.addAll(playlistItemResult.getItems());
Iterator<PlaylistItem> playlistEntries = playlistItemList.iterator();
List<VideoItem> items = new ArrayList<VideoItem>();
while (playlistEntries.hasNext()) {
VideoItem item = new VideoItem();
PlaylistItem playlistItem = playlistEntries.next();
item.setTitle(playlistItem.getSnippet().getTitle());
item.setDescription(playlistItem.getContentDetails().getVideoId());
items.add(item);
}
return items;
知道我做错了什么吗? 我正在尝试按照此问题How do I get a list of uploaded videos for a certain channel with the new YouTube Data API (V3)?
中的步骤进行操作任何帮助将不胜感激