How to get “transcript” in youtube-api v3

前端 未结 4 854
迷失自我
迷失自我 2020-12-07 18:14

I have started using v3 of the YouTube apis on an android device, using the java client library. Some videos that I am interested in have transcripts that I can access on th

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 18:32

    I may be wrong, but I don't think there is yet a documented way to get the caption track via v3 of the API. If you're authenticating with oAuth2, however, your authentication will also be good for v2 of the API, so you could do a quick call to this feed:

    http://gdata.youtube.com/feeds/api/videos/[VIDEOID]/captiondata/[CAPTION TRACKID]
    

    to get the data you want. To retrieve a list of possible caption track IDs with v2 of the API, you access this feed:

    https://gdata.youtube.com/feeds/api/videos/[VIDEOID]/captions
    

    That feed request also accepts some optional parameters, including language, max-results, etc. For more details, along with a sample that shows the returned format of the caption track list, see the documentation at https://developers.google.com/youtube/2.0/developers_guide_protocol_captions#Retrieve_Caption_Set

提交回复
热议问题