在指定 ChannelID 之外搜索 API 调用 Returns 结果
Search API Call Returns Results Outside The Specified ChannelID
我有一个仅限于特定频道的 YT API 搜索查询,但 returns 结果在该频道之外,这是一个问题。
对此进行全面搜索https://developers.google.com/youtube/v3/docs/search/list 已完成以下请求。
需要说明的是,'q' 参数是印地语,翻译为“तवा”
结果中有些项目不是来自请求中 channelId 指定的频道。这似乎是 YT API.
中的错误
200
显示headers-
{
"kind": "youtube#searchListResponse",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/hJ1ihb5XsXgS7tq9QigswU-SsUg\"",
"regionCode": "US",
"pageInfo": {
"totalResults": 4,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/9R-AWbPk35j_zGJcL7wemicat9g\"",
"id": {
"kind": "youtube#video",
"videoId": "GfNUaVFmxaY"
},
"snippet": {
"publishedAt": "2014-05-26T11:16:17.000Z",
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Introduction to Plumbing Tools (Part-1) (Hindi) (हिन्दी)",
"description": "This video will help you understand plumbing tools. इस पाठ में आप नल साजी (प्ल्म्बींग) में इस्तेमाल होनेवाल...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/GfNUaVFmxaY/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/GfNUaVFmxaY/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/GfNUaVFmxaY/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "SkillTrain",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/kcnTk-acx88HM9_HoWokq8FRONI\"",
"id": {
"kind": "youtube#video",
"videoId": "swmvPyzi_3c"
},
"snippet": {
"publishedAt": "2017-12-23T15:00:06.000Z",
"channelId": "UCH4Bz5Swatl5iHSuCT_Hlxg",
"title": "पैन: जंगली के महान भगवान - (ग्रीक पौराणिक कथाओं में बताया)",
"description": "आज हम कम देवताओं में से एक है और मेरे पसंदीदा में से एक पर एक नज़र डालें, जंगली के परमेश्वर पैन। आप पौराणिक कथाओं और लोक-साहित्य का आनंद लें और अधिक जानने के लिए चाहते हैं।",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/swmvPyzi_3c/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/swmvPyzi_3c/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/swmvPyzi_3c/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Mythology & Fiction Explained",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/qE49UjY2s7xfzQc3lgM2V2089Cs\"",
"id": {
"kind": "youtube#video",
"videoId": "tjW1mKwNUSo"
},
"snippet": {
"publishedAt": "2014-11-25T17:00:03.000Z",
"channelId": "UCjmJDM5pRKbUlVIzDYYWb6g",
"title": "पान - आधिकारिक टीज़र ट्रेलर [HD]",
"description": "ह्यूग जैकमैन, गैरेट Hedlund, रूनी मारा और पैन में लेवी मिलर स्टार, थिएटर में 9 वीं अक्टूबर! http://www.pan-movie.com/ ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/tjW1mKwNUSo/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/tjW1mKwNUSo/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/tjW1mKwNUSo/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Warner Bros. Pictures",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/-zDpouVDxXZOX5hD6tlEcP9BeEM\"",
"id": {
"kind": "youtube#video",
"videoId": "vjGM6eLR5ZE"
},
"snippet": {
"publishedAt": "2017-12-10T05:52:59.000Z",
"channelId": "UCOvw0-6WFFEMr__v4mFonxQ",
"title": "गोकू खो पान | अंग्रेजी डब",
"description": "जबकि गोकू, पिकोलो, और Chichi उसे खोजने की कोशिश पान पुलाव के साथ एक साहसिक है। #ड्रेगन बॉल सुपर।",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/vjGM6eLR5ZE/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/vjGM6eLR5ZE/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/vjGM6eLR5ZE/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "GOT-two",
"liveBroadcastContent": "none"
}
}
]
}
我不能确定它是否是错误,但是,由于 q
参数及其值,您从不同的渠道获得结果 - 这就是预期的功能。
q
参数搜索也在description of the video
.
因此,如果您想在请求中排除来自其他渠道的结果,您可以这样做:
- 如果您确实需要添加搜索词,请添加它并添加您的频道名称。
示例:
q=तवा + SkillTrain
您可以在此 demo at Google API Explorer.
中测试此请求
结果如下:
{
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "GfNUaVFmxaY"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Introduction to Plumbing Tools (Part-1) (Hindi) (हिन्दी)"
}
}
]
}
在这种情况下,有一个结果与您的 channel_id 和提供的印地语字符都匹配。
或
- 如果您不需要添加搜索参数,请在请求中省略它,(因为您添加了
channel_id
值),一旦发出请求,您将得到以下结果:
{
"nextPageToken": "CAUQAA",
"pageInfo": {
"totalResults": 666,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "td3GPjcXPb4"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Basic components of a window AC (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "e611N5gR1z4"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Wheel balancing (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "XCitxJ-jvgQ"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Auto Clave (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "8zHSEv_tziQ"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Understanding the components of a split AC (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "WQ8X3hDIwJM"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Brake pad replacement (Hindi)(हिन्दी)"
}
}
]
}
所有这些结果均来自提供的channel_id
。
您可以在此 demo at Google API Explorer.
中测试此请求
我有一个仅限于特定频道的 YT API 搜索查询,但 returns 结果在该频道之外,这是一个问题。
对此进行全面搜索https://developers.google.com/youtube/v3/docs/search/list 已完成以下请求。
需要说明的是,'q' 参数是印地语,翻译为“तवा”
结果中有些项目不是来自请求中 channelId 指定的频道。这似乎是 YT API.
中的错误200
显示headers-
{ "kind": "youtube#searchListResponse", "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/hJ1ihb5XsXgS7tq9QigswU-SsUg\"", "regionCode": "US", "pageInfo": { "totalResults": 4, "resultsPerPage": 5 }, "items": [ { "kind": "youtube#searchResult", "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/9R-AWbPk35j_zGJcL7wemicat9g\"", "id": { "kind": "youtube#video", "videoId": "GfNUaVFmxaY" }, "snippet": { "publishedAt": "2014-05-26T11:16:17.000Z", "channelId": "UCoMurV7497Rj7kk5i-UXUhg", "title": "Introduction to Plumbing Tools (Part-1) (Hindi) (हिन्दी)", "description": "This video will help you understand plumbing tools. इस पाठ में आप नल साजी (प्ल्म्बींग) में इस्तेमाल होनेवाल...", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/GfNUaVFmxaY/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/GfNUaVFmxaY/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/GfNUaVFmxaY/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "SkillTrain", "liveBroadcastContent": "none" } }, { "kind": "youtube#searchResult", "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/kcnTk-acx88HM9_HoWokq8FRONI\"", "id": { "kind": "youtube#video", "videoId": "swmvPyzi_3c" }, "snippet": { "publishedAt": "2017-12-23T15:00:06.000Z", "channelId": "UCH4Bz5Swatl5iHSuCT_Hlxg", "title": "पैन: जंगली के महान भगवान - (ग्रीक पौराणिक कथाओं में बताया)", "description": "आज हम कम देवताओं में से एक है और मेरे पसंदीदा में से एक पर एक नज़र डालें, जंगली के परमेश्वर पैन। आप पौराणिक कथाओं और लोक-साहित्य का आनंद लें और अधिक जानने के लिए चाहते हैं।", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/swmvPyzi_3c/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/swmvPyzi_3c/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/swmvPyzi_3c/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "Mythology & Fiction Explained", "liveBroadcastContent": "none" } }, { "kind": "youtube#searchResult", "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/qE49UjY2s7xfzQc3lgM2V2089Cs\"", "id": { "kind": "youtube#video", "videoId": "tjW1mKwNUSo" }, "snippet": { "publishedAt": "2014-11-25T17:00:03.000Z", "channelId": "UCjmJDM5pRKbUlVIzDYYWb6g", "title": "पान - आधिकारिक टीज़र ट्रेलर [HD]", "description": "ह्यूग जैकमैन, गैरेट Hedlund, रूनी मारा और पैन में लेवी मिलर स्टार, थिएटर में 9 वीं अक्टूबर! http://www.pan-movie.com/ ...", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/tjW1mKwNUSo/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/tjW1mKwNUSo/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/tjW1mKwNUSo/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "Warner Bros. Pictures", "liveBroadcastContent": "none" } }, { "kind": "youtube#searchResult", "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/-zDpouVDxXZOX5hD6tlEcP9BeEM\"", "id": { "kind": "youtube#video", "videoId": "vjGM6eLR5ZE" }, "snippet": { "publishedAt": "2017-12-10T05:52:59.000Z", "channelId": "UCOvw0-6WFFEMr__v4mFonxQ", "title": "गोकू खो पान | अंग्रेजी डब", "description": "जबकि गोकू, पिकोलो, और Chichi उसे खोजने की कोशिश पान पुलाव के साथ एक साहसिक है। #ड्रेगन बॉल सुपर।", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/vjGM6eLR5ZE/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/vjGM6eLR5ZE/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/vjGM6eLR5ZE/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "GOT-two", "liveBroadcastContent": "none" } } ] }
我不能确定它是否是错误,但是,由于 q
参数及其值,您从不同的渠道获得结果 - 这就是预期的功能。
q
参数搜索也在description of the video
.
因此,如果您想在请求中排除来自其他渠道的结果,您可以这样做:
- 如果您确实需要添加搜索词,请添加它并添加您的频道名称。
示例:
q=तवा + SkillTrain
您可以在此 demo at Google API Explorer.
中测试此请求结果如下:
{
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "GfNUaVFmxaY"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Introduction to Plumbing Tools (Part-1) (Hindi) (हिन्दी)"
}
}
]
}
在这种情况下,有一个结果与您的 channel_id 和提供的印地语字符都匹配。
或
- 如果您不需要添加搜索参数,请在请求中省略它,(因为您添加了
channel_id
值),一旦发出请求,您将得到以下结果:
{
"nextPageToken": "CAUQAA",
"pageInfo": {
"totalResults": 666,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "td3GPjcXPb4"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Basic components of a window AC (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "e611N5gR1z4"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Wheel balancing (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "XCitxJ-jvgQ"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Auto Clave (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "8zHSEv_tziQ"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Understanding the components of a split AC (Hindi) (हिन्दी)"
}
},
{
"kind": "youtube#searchResult",
"id": {
"kind": "youtube#video",
"videoId": "WQ8X3hDIwJM"
},
"snippet": {
"channelId": "UCoMurV7497Rj7kk5i-UXUhg",
"title": "Brake pad replacement (Hindi)(हिन्दी)"
}
}
]
}
所有这些结果均来自提供的channel_id
。
您可以在此 demo at Google API Explorer.
中测试此请求