Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Downloading captions always returns a 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

I call captions.list with:

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

This is response:

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="
  }
 ]
}

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

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

This is response:

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?

like image 919
Lars Avatar asked Jun 04 '15 20:06

Lars


2 Answers

Instead caption download API that sometimes returns 403 (if video not have enabled third-party contributions for this caption) you can use youtube.com/api/timedtext

like image 66
alexfv Avatar answered Oct 30 '22 11:10

alexfv


From the YouTube API docs:

403 Forbidden: The permissions associated with the request are not sufficient to download the caption track. The request might not be properly authorized, or the video order might not have enabled third-party contributions for this caption.

like image 4
theduck Avatar answered Oct 30 '22 10:10

theduck