英文:
Youtube API: Search endpoint with videoCaption not working
问题
以下命令按预期工作:
GET https://youtube.googleapis.com/youtube/v3/search?maxResults=1&q=test&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
以下命令未按预期工作:
GET https://youtube.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=test&videoCaption=closedCaption&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
这是完整的错误信息:
{
"error": {
"code": 400,
"message": "请求包含无效参数。",
"errors": [
{
"message": "请求包含无效参数。",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
根据文档,这应该正常工作:https://developers.google.com/youtube/v3/docs/search/list
请有人帮忙吗?
最好,
Andy
英文:
The following command works as expected:
GET https://youtube.googleapis.com/youtube/v3/search?maxResults=1&q=test&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
The following does not work as expected:
GET https://youtube.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=test&videoCaption=closedCaption&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
This is the full error:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
This should work according to the documentation: https://developers.google.com/youtube/v3/docs/search/list
Could someone please help?
Best,
Andy
答案1
得分: 1
The docs state that for the videoCaption parameter you must set type to 'video' instead of the default 'video,channel,playlist'. This works:
英文:
The docs state that for the videoCaption parameter you must set type to 'video' instead of the default 'video,channel,playlist'. This works:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论