关于YouTube Data API是否支持通过@handle查询频道的技术问询
YouTube Data API 是否支持通过@handle 查询频道?
YouTube推出了Handles作为频道的新识别方式,但目前测试发现YouTube Data API暂不支持直接通过@handle查询频道信息。
以@lionsgatemovies为例,尝试以下两种参数查询均无结果:
使用forUsername参数
GET https://www.googleapis.com/youtube/v3/channels?part=id,snippet&forUsername=@lionsgatemovies
返回结果:
{ "kind": "youtube#channelListResponse", "etag": "RuuXzTIr0OoDqI4S0RU6n4FqKEM", "pageInfo": { "totalResults": 0, "resultsPerPage": 5 } }
使用id参数
GET https://www.googleapis.com/youtube/v3/channels?part=id,snippet&id=@lionsgatemovies
返回结果:
{ "kind": "youtube#channelListResponse", "etag": "RuuXzTIr0OoDqI4S0RU6n4FqKEM", "pageInfo": { "totalResults": 0, "resultsPerPage": 5 } }
当前API支持的筛选参数(mySubscribers、forUsername、mine、managedByMe、categoryId、id)中,没有可直接匹配@handle的选项,若尝试无有效筛选参数的请求会返回如下错误:
{ "error": { "code": 400, "message": "No filter selected. Expected one of: mySubscribers, forUsername, mine, managedByMe, categoryId, id", "errors": [ { "message": "No filter selected. Expected one of: mySubscribers, forUsername, mine, managedByMe, categoryId, id", "domain": "youtube.parameter", "reason": "missingRequiredParameter", "location": "parameters.", "locationType": "other" } ] } }
内容的提问来源于stack exchange,提问作者Anthony Battaglia
相关产品推荐
相关产品推荐

