用户ID http://gdata.youtube.com/feeds/users/Lm-kPkFGRaV0t55q7-VwgQ?alt=json&safeSearch=strict&restriction=MY直接访问频道信息,我可以从媒体$ thumbnail标签获取http://s.ytimg.com/yts/img/silhouette250-vflEqxKg9.png
但是,按渠道API查询http://gdata.youtube.com/feeds/api/channels?alt=json&q=ghghghgh&start-index=1&max-results=1&v=2&safeSearch=strict&restriction=MY,我从媒体$ thumbnail标签获取http://s.ytimg.com/yt/img/no_videos_140.png
使用网络浏览器访问https://www.youtube.com/results?search_query=ghghghgh&filters=channel&lclk=channel,我可以看到http://s.ytimg.com/yts/img/silhouette250-vflEqxKg9.png
我的问题是,如何使用渠道API(http://s.ytimg.com/yts/img/silhouette250-vflEqxKg9.png)而不是http://gdata.youtube.com/feeds/api/channels?alt=json&q=来搜索http://s.ytimg.com/yt/img/no_videos_140.png?
更新:我想知道只有用户拥有yt $ googlePlusUserId,那就没问题,例如用户http://gdata.youtube.com/feeds/api/users/UCBJ7AiDylXmwgUlSQFM2luw?alt=json&safeSearch=strict&restriction=MY&prettyprint=True&fields=yt:googlePlusUserId
由于
答案 0 :(得分:1)
我建议使用YouTube Data API的v3。如果您对搜索资源进行以下调用,它将返回三个不同的缩略图供您选择。如果频道尚未上传缩略图,则它将与您引用的剪影图像相同,但具有该频道的唯一网址。使用此网址作为您的img源的优势在于,如果频道决定上传缩略图,则无需更改图片即可反映该更改。
响应:
{
"kind": "youtube#searchListResponse",
"etag": "\"O7gZuruiUnq-GRpzm3HckV3Vx7o/PaWiOpjYBhvp7UVKUk3QeiagLtw\"",
"pageInfo": {
"totalResults": 33,
"resultsPerPage": 2
},
"nextPageToken": "CAIQAA",
"items": [
{
"id": {
"kind": "youtube#channel",
"channelId": "UCLm-kPkFGRaV0t55q7-VwgQ"
},
"kind": "youtube#searchResult",
"etag": "\"O7gZuruiUnq-GRpzm3HckV3Vx7o/x_NADGr-4b04fqoDn_uRBGj99eQ\"",
"snippet": {
"publishedAt": "2006-03-13T04:10:45.000Z",
"channelId": "UCLm-kPkFGRaV0t55q7-VwgQ",
"title": "barrett90",
"description": "",
"thumbnails": {
"default": {
"url": "http://i.ytimg.com/i/Lm-kPkFGRaV0t55q7-VwgQ/1.jpg"
},
"medium": {
"url": "http://i.ytimg.com/i/Lm-kPkFGRaV0t55q7-VwgQ/mq1.jpg"
},
"high": {
"url": "http://i.ytimg.com/i/Lm-kPkFGRaV0t55q7-VwgQ/hq1.jpg"
}
}
}
}
您可以在此处获取API密钥: https://code.google.com/apis/console