3
votes

Im using the PHP example code given in Youtube API v3 : https://developers.google.com/youtube/v3/docs/captions/download , to download captions from 3rd party, publicly available YouTube videos in my webapp i.e. I have NOT uploaded the content on Youtube.

I am able to get access to the list of caption tracks, but unable to download the caption using the caption track ID from the received list.

The error that shows up upon attempting to DOWNLOAD is:

Error calling GET https:// www.googleapis.com/youtube/v3/captions/Lw0e5xDNU17GFafOl8DcyeOtwzWJTf9V?tfmt=srt&alt=media: (404) Not Found

(I have tried removing tfmt (optional parameter), but still gives an error.)

But the error is different for attempting to DELETE captions:

Error calling DELETE https:// www.googleapis.com/youtube/v3/captions?id=Lw0e5xDNU17GFafOl8DcyeOtwzWJTf9V: (403) Forbidden

Therefore it seems that captions.download is NOT forbidden for users other than owner (just like the captions.list is NOT forbidden) and therefore I would like to use this data for my webapp.

Any help is gratefully received.

Thanks,

Nikhil

2
Try using the URL format for the delete call with the ID as a query parameter instead of the one you are using. Their documentation for the URL of getting could be wrong. Also below they mention that ID is a query parameter. - Brian from state farm
Ya good observation that they mention ID as a query parameter in the documentation.. Still tried that Brian & got an error like "Unsupported output format". Will update the exact error message here after sometime. - Nikhil Kulkarni
did you find any resolution over this issue, right now i am fetching same kind of issue, and i could not get over it. - manish1706

2 Answers

1
votes

I just tried the URL you mentioned in a browser and in the API explorer, and in both cases I received a 401 when I had no oAuth token and a 403 when I had an access token (since I'm not the owner), so the endpoints are acting as intended; according to the documentation, downloading captions requires oAuth consent from the owner of the video.

Perhaps, if you're getting 404s instead, there's a problem in the PHP library?

1
votes

I have found another way to access any YouTube video's caption data. The code is written in Ruby.

Read Youtube transcript (captions) from any public Youtube video

Works great, I just need to find a way to integrate this with my webapp.