YouTube.Channels.List from YouTube API V3 returning only one channel in Android

限于喜欢 提交于 2020-01-04 11:10:14

问题


I am creating an app using YouTube API. Here I want to list all the channel related to an E-mail id so I have written this below code. The problem with this code is that it is returning only one Channel (The default one) but i want a list of all channels.

Here is the code:

        YouTube youTube = new YouTube.Builder(new NetHttpTransport(), new JacksonFactory(), new HttpRequestInitializer() {
            @Override
            public void initialize(HttpRequest request) throws IOException {}
                   }).setApplicationName("YouTube").build();

        try {
            final YouTube.Channels.List list = youTube.channels().list("snippet,id");
            list.setForUsername("USER_NAME");
            list.setKey("API_KEY");
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try{
                        ChannelListResponse response = list.execute();
                        List<Channel> channelList = response.getItems();
                        Log.wtf("totalChannel", channelList.size()+"");
                        for (Channel channel: channelList){
                            Log.wtf("channel", channel.getSnippet().getTitle().toString());
                            Log.wtf("id", channel.getId().toString());
                        }
                    }catch (Exception ex){Log.wtf("exception", ex.toString());}
                }
            }).start();
        }catch (Exception ex){Log.wtf("exception", ex.toString());}

来源:https://stackoverflow.com/questions/46891136/youtube-channels-list-from-youtube-api-v3-returning-only-one-channel-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!