我正在使用 YouTube API 创建一个应用程序。在这里,我想列出与电子邮件 ID 相关的所有频道,因此我编写了以下代码。这段代码的问题是它只返回一个通道(默认通道),但我想要所有通道的列表。
这是代码:
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());}
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)