YouTube 数据 API 未使用 relevanceLanguage=en 返回正确的语言查询视频
YouTube Data API not returning correct videos for language query using relevanceLanguage=en
我在查询 YouTube 数据时遇到问题 API,我要求提供英文视频,但 API 响应中也返回了其他语言的视频。
响应中的非英语视频示例:
{
"kind": "youtube#searchResult",
"etag": "w8XrPbjZTYYjwhjqjl4HLLlFg5o",
"id": {
"kind": "youtube#video",
"videoId": "p8dzJSJZ7EE"
},
"snippet": {
"publishedAt": "2013-12-02T19:44:07Z",
"channelId": "UCFOSg71CRAJ58IPuV_-jMbw",
"title": "¿Qué es Bitcoin? Y las monedas virtuales (en Español)",
"description": "Todo sobre Bitcoin (funcionamiento, minería, ventajas, desventajas...) y las monedas digitales como Litecoin, Freicoin y Ripple. ¡SUSCRIBETE y apoya nuestro ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/p8dzJSJZ7EE/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/p8dzJSJZ7EE/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/p8dzJSJZ7EE/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Tecnonauta",
"liveBroadcastContent": "none",
"publishTime": "2013-12-02T19:44:07Z"
}
},
如有任何提示,我们将不胜感激!谢谢
根据官方文档,参数 relevanceLanguage
of the Search.list
API 端点具有以下规范(下面的重点是我的):
relevanceLanguage (string)
The relevanceLanguage
parameter instructs the API to return search results that are most relevant to the specified language. The parameter value is typically an ISO 639-1 two-letter language code. However, you should use the values zh-Hans
for simplified Chinese and zh-Hant
for traditional Chinese. Please note that results in other languages will still be returned if they are highly relevant to the search query term.
因此,当使用 relevanceLanguage=en
调用时,Search.list
端点 不需要 return 仅使用英语的视频 。
我在查询 YouTube 数据时遇到问题 API,我要求提供英文视频,但 API 响应中也返回了其他语言的视频。
响应中的非英语视频示例:
{
"kind": "youtube#searchResult",
"etag": "w8XrPbjZTYYjwhjqjl4HLLlFg5o",
"id": {
"kind": "youtube#video",
"videoId": "p8dzJSJZ7EE"
},
"snippet": {
"publishedAt": "2013-12-02T19:44:07Z",
"channelId": "UCFOSg71CRAJ58IPuV_-jMbw",
"title": "¿Qué es Bitcoin? Y las monedas virtuales (en Español)",
"description": "Todo sobre Bitcoin (funcionamiento, minería, ventajas, desventajas...) y las monedas digitales como Litecoin, Freicoin y Ripple. ¡SUSCRIBETE y apoya nuestro ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/p8dzJSJZ7EE/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/p8dzJSJZ7EE/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/p8dzJSJZ7EE/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Tecnonauta",
"liveBroadcastContent": "none",
"publishTime": "2013-12-02T19:44:07Z"
}
},
如有任何提示,我们将不胜感激!谢谢
根据官方文档,参数 relevanceLanguage
of the Search.list
API 端点具有以下规范(下面的重点是我的):
relevanceLanguage (string)
The
relevanceLanguage
parameter instructs the API to return search results that are most relevant to the specified language. The parameter value is typically an ISO 639-1 two-letter language code. However, you should use the valueszh-Hans
for simplified Chinese andzh-Hant
for traditional Chinese. Please note that results in other languages will still be returned if they are highly relevant to the search query term.
因此,当使用 relevanceLanguage=en
调用时,Search.list
端点 不需要 return 仅使用英语的视频 。