我正在尝试从特定频道获取视频,而我的应用却没有响应

时间:2016-10-06 08:26:36

标签: youtube-api android-youtube-api

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)?

中的步骤进行操作

任何帮助将不胜感激

0 个答案:

没有答案