gpt4 book ai didi

java - Youtube API V3 - 如何使用 channel 图标字段搜索视频?

转载 作者:行者123 更新时间:2023-12-01 10:09:59 25 4
gpt4 key购买 nike

我想搜索视频列表并将其与 channel 图标一起显示在屏幕上,但我不知道如何在搜索查询中获取channel_id或channel_icon直接链接。

我在youtube的开发者页面(Java)中遵循一个示例,我希望搜索结果包含channel_id或channel_icon,该怎么做?

search.setFields("items(id/videoId,snippet/title,snippet/thumbnails/default/url)");
<小时/>

[已解决]
我已经解决了我的问题,我编辑了我的字段过滤器,完整代码:

search = youtube.search().list("id,snippet");
search.setFields("items(id/videoId,snippet/title,snippet/thumbnails/default/url,snippet/channelId,snippet/channelTitle)");
// or just remove fields filter and then the response will constant all fileds for you

我得到了channelId,我可以得到 channel 图标,只需将url替换为我的channelId:

http://i.ytimg.com/i/[channelId]/1.jpg

最佳答案

您如何创建搜索

设置“snippet”,以便 API 响应包含 channel ID 和其他有用数据:

YouTube.Search.List search = youtube.search().list("id,snippet");

关于java - Youtube API V3 - 如何使用 channel 图标字段搜索视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36185875/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com