Skip to content

Instantly share code, notes, and snippets.

@pjmartorell
Last active October 23, 2024 17:25
Show Gist options
  • Save pjmartorell/384aa1d019f919af6b84894038bf29aa to your computer and use it in GitHub Desktop.
Save pjmartorell/384aa1d019f919af6b84894038bf29aa to your computer and use it in GitHub Desktop.
How to download subtitles/text tracks of a On Demand Vimeo video

Download subtitles/text tracks of an On-Demand Vimeo video

It works with on-demand videos that have the subtitles/captions included (CC symbol). You need to be registered in Vimeo in order to retrieve subtitles.

Steps

  1. Open Chrome Developer Tools
  2. Start playing the Vimeo video
  3. Look for any request named segment-XX.m4s (where XX is a number)
  4. Select the request and inspect the request payload, which is something in the form:
{"referrer":"https://vimeo.com/ondemand/followingseas","embed":false,"context":"Vimeo\\Controller\\OnDemandController.main","autoplay":0,"loop":0,"id":242740761,"vodId":128898,"vodSaleId":5911177,"sessionTime":22.604,"videoShape":0,"spatialPlayback":0,"userId":"xxxxxxxx","userAccountType":"basic","userIsMod":0,"ownerId":18500210,"ownerAccountType":"pro","privacy":"ptv","rating":6,"type":"html","videoFileId":"872163031","delivery":"dash","profileId":175,"quality":"sd","duration":5116.501,"seconds":536.483,"isLive":0,"playbackRate":1,"signature":"e8116054b8ca3f524be3091135c93cb5","session":"xxxxxxxxxxxxxxxxxxxxxxxxxxx","time":1535639774,"expires":20468}
  1. Copy the value of the field called id (i.e. "id":242740761)
  2. Go to Vimeo API Playground: https://developer.vimeo.com/api/playground/videos/%7Bvideo_id%7D/texttracks (note that you need to be registered in Vimeo to do some API calls)
  3. In the Playground form, replace {video_id} for your video ID (i.e. 242740761)
  4. Check the checkbox that says Authenticate this call as John Doe
  5. Push the Make call button
  6. If everything works as expected, the successful HTTP request will be outputed. Something like the following:
HTTP/1.1 200
Content-Type: application/vnd.vimeo.video.texttrack+json
Host: api.vimeo.com

{
    "total": 1,
    "data": [
        {
            "uri": "/videos/242740761/texttracks/5795943",
            "active": true,
            "type": "captions",
            "language": "en",
            "link": "https://captions.cloud.vimeo.com/captions/5795943.vtt?expires=1535648880&sig=357c4574e58e805af3b5ef2df4cd075bdc1c1ba8&download=FollowingSeas+CC.srt.vtt",
            "link_expires_time": 1535648880,
            "hls_link": "https://captions.cloud.vimeo.com/captions/5795943.vtt?expires=1535648880&sig=357c4574e58e805af3b5ef2df4cd075bdc1c1ba8&download=FollowingSeas+CC.srt.vtt&hls=1",
            "hls_link_expires_time": 1535648880,
            "name": "FollowingSeas CC.srt"
        }
    ]
}
  1. Copy the value of the link attribute (i.e "https://captions.cloud.vimeo.com/captions/5795943.vtt?expires=1535648880&sig=357c4574e58e805af3b5ef2df4cd075bdc1c1ba8&download=FollowingSeas+CC.srt.vtt")
  2. Paste it in your browser and the subtitles will start downloading :)
@pedrosvk
Copy link

pedrosvk commented Jan 22, 2023

This worked for me as easy solution: https://www.youtube.com/watch?v=Mk6SmkKVZzA
Just copy subtitles fom dev tools -> network -> *.vtt file -> preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment