YouTube API V3中的YouTube.Channels.List在Android中仅返回一个频道
我正在使用YouTube API创建一个应用程序。这里我想列出所有与电子邮件id相关的频道,所以我写了下面的代码。这段代码的问题是它只返回一个通道(默认通道),但我想要一个所有通道的列表 代码如下:YouTube API V3中的YouTube.Channels.List在Android中仅返回一个频道,android,youtube,youtube-data-api,Android,Youtube,Youtube Data Api,我正在使用YouTube API创建一个应用程序。这里我想列出所有与电子邮件id相关的频道,所以我写了下面的代码。这段代码的问题是它只返回一个通道(默认通道),但我想要一个所有通道的列表 代码如下: YouTube youTube = new YouTube.Builder(new NetHttpTransport(), new JacksonFactory(), new HttpRequestInitializer() { @Override
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());}
YouTube-YouTube=new-YouTube.Builder(new-NetHttpTransport()、new-JacksonFactory()、new-HttpRequestInitializer()){
@凌驾
公共无效初始化(HttpRequest请求)引发IOException{}
}).setApplicationName(“YouTube”).build();
试一试{
final YouTube.Channels.List List=YouTube.Channels().List(“代码段,id”);
list.setForUsername(“用户名”);
列表。设置键(“API_键”);
新线程(newrunnable()){
@凌驾
公开募捐{
试一试{
ChannelListResponse=list.execute();
List channelList=response.getItems();
Log.wtf(“totalChannel”,channelList.size()+”);
用于(频道:频道列表){
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());}