本文介绍了下载字幕总是返回 403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用从 captions.list 端点检索到的 ID 调用 captions.download 端点时,它总是返回 403.例如:

When I call the captions.download endpoint with an ID that we retrieve from the captions.list endpoint, it always returns a 403. For example:

https://www.youtube.com/watch?v=1HRwpwOj4aA

我调用 captions.list 为:

GET https://www.googleapis.com/youtube/v3/captions?part=id&videoId=1HRwpwOj4aA&key={YOUR_API_KEY}

这是回复:

cache-control:  private, max-age=0, must-revalidate, no-transform
content-encoding:  gzip
content-length:  236
content-type:  application/json; charset=UTF-8
date:  Sat, 23 May 2015 17:55:57 GMT
etag:  "dhbhlDw5j8dK10GxeV_UG6RSReM/Rztb3ln4Zb6O07vb7_KSZi2y1NM"
expires:  Sat, 23 May 2015 17:55:57 GMT
server:  GSE
vary:  Origin, X-Origin

{
 "kind": "youtube#captionListResponse",
 "etag": "\"dhbhlDw5j8dK10GxeV_UG6RSReM/Rztb3ln4Zb6O07vb7_KSZi2y1NM\"",
 "items": [
  {
   "kind": "youtube#caption",
   "etag": "\"dhbhlDw5j8dK10GxeV_UG6RSReM/pwH-4wtyQJz0U3l57fA8uKm4e1I\"",
   "id": "kHlUsiuNS4TjB25loauZNXGrjK91I1tEdNyOpTRNA78="
  }
 ]
}

当我使用上面的id调用captions.download时:

When I use the above id to call captions.download:

获取 https://www.googleapis.com/youtube/v3/captions/kHlUsiuNS4TjB25loauZNXGrjK91I1tEdNyOpTRNA78%3D?key={YOUR_API_KEY}

这是回复:

403 Forbidden
cache-control:  private, max-age=0
content-encoding:  gzip
content-length:  29
content-type:  text/html; charset=UTF-8
date:  Sat, 23 May 2015 17:59:05 GMT
expires:  Sat, 23 May 2015 17:59:05 GMT
server:  GSE
vary:  Origin, X-Origin

Forbidden

知道这里会发生什么吗?

Any ideas what could be happening here?

推荐答案

来自 YouTube API 文档:

403 Forbidden:与请求关联的权限不是足以下载字幕轨道.该请求可能不是正确授权,或者视频顺序可能未启用此字幕的第三方贡献.

这篇关于下载字幕总是返回 403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 17:56