有了这个请求,我得到了很多结果,只有第一个是我想要的(它在视频标题中有搜索词):
Request: https://www.googleapis.com/youtube/v3/search?key={your_key}&channelId=UCsKrylY2g4-XOkVAQWkpv0g&part=snippet&q=yamatai
结果:https://pastebin.com/HR12bt61
但奇怪的是,如果我添加订单参数,那么我只得到一个结果:
Request: https://www.googleapis.com/youtube/v3/search?key={your_key}&channelId=UCsKrylY2g4-XOkVAQWkpv0g&part=snippet&q=yamatai&order=date
结果:https://pastebin.com/2eYbXXSE
如何解释? 另请注意,在这两种情况下,两个结果集中的totalResults = 23。但是,在第二种情况下,请求第二页导致空集。 我还发现order = relevant(这是order的默认值)返回第一组的所有结果。
答案 0 :(得分:0)
在Youtube api中搜索是非常奇怪的,如果内存服务它只搜索标题。其他人来自我不能打电话给你第二个我认为它是一个错误或只是非常奇怪
获取https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCsKrylY2g4-XOkVAQWkpv0g&maxResults=25&order=date&q=yamatai&key= {YOUR_API_KEY}
{
"kind": "youtube#searchListResponse",
"etag": "\"g7k5f8kvn67Bsl8L-Bum53neIr4/l7VBYhzL4sHmVrkUKgQ9UAR-Lgk\"",
"regionCode": "DK",
"pageInfo": {
"totalResults": 23,
"resultsPerPage": 25
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"g7k5f8kvn67Bsl8L-Bum53neIr4/dB7MPu9wutwBJcpbzgegjKHDyko\"",
"id": {
"kind": "youtube#video",
"videoId": "3L_lIjAUnjg"
},
"snippet": {
"publishedAt": "2017-10-03T21:26:28.000Z",
"channelId": "UCsKrylY2g4-XOkVAQWkpv0g",
"title": "Board Game 101 (EP85) Yamatai - Règles et Critique",
"description": "Ce jeu est une gracieuseté d'Univers Ludo.*** Boutique en ligne: https://www.universludo.ca Page Facebook: https://www.facebook.com/universludo 0:36 - Intro 2:12 - Règlements 18:22 -...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/3L_lIjAUnjg/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/3L_lIjAUnjg/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/3L_lIjAUnjg/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Professeur Board Game",
"liveBroadcastContent": "none"
}
}
]
}
它说"totalResults": 23,
但只返回一行。我会将其发布为问题跟踪器here