问题描述
我向https://www.googleapis.com/batch/youtube/v3发送了一个请求,但是无论如何我得到了404。也许我发送的请求不正确,但是很可能端点无法正常工作。
同样,我使用Postman测试下一个条件:
1。对https://www.googleapis.com/batch/youtube/v3的POST请求。
2。。将“ Content-type”标头设置为多部分/混合。
3。。将原始文本正文添加为HTTP:
start /affinity 1 test.exe
对NodeJS有什么建议吗?
解决方法
YouTube Data API版本3仅支持以下形式的batch processing:
Batch processing – v3 API支持v2 API支持的一种批处理用例。 v3 API的
channels.list
,channelSections.list
,guideCategories.list
,playlistItems.list
,playlists.list
,subscriptions.list
,videoCategories.list
和{{3} }方法均支持id参数,该参数可用于指定以逗号分隔的ID列表(视频ID,频道ID等)。使用这些方法,您可以通过一个请求检索多个资源的列表。
根据文档,在videos.list
API端点的情况下,您可以批处理多个调用,因为id
属性可以一次性接受多个通道ID:
Channels.list
(字符串)id
参数指定要检索的资源的YouTube频道ID的逗号分隔列表。在channel
资源中,id
属性指定频道的YouTube频道ID。
请注意,当要求id端点一次生成64个视频的信息时,API向我提供了以下响应(即使只有51个产生了相同的响应):
ERROR 400: Bad Request
{
"error": {
"code": 400,"message": "The request specifies an invalid filter parameter.","errors": [
{
"message": "The request specifies an invalid filter parameter.","domain": "youtube.parameter","reason": "invalidFilters","location": "parameters.","locationType": "other"
}
]
}
}
因此,此API端点不接受超过50个ID 。很有可能其他的功能也一样。