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 :)
@LeeBinder
Copy link

Updated:

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

It works even with rented 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 Google Chrome

  2. Might not be necessary, but it did not hurt, either: go to chrome://extensions/ and disable all Extensions that could interfere with Vimeo, like any Vimeo Extensions and Video Downloaders

  3. Go to the web page of your Vimeo video https://vimeo.com/ondemand/yourRentedVideo, but DO NOT start playing it!

  4. Might not be necessary, but it did not hurt, either: in the bottom right of your video, click onto the grey CC button and choose a subtitle (which one does not seem to matter) so it's blue now

  5. Open Chrome Developer Tools: View, Developer, Developer Tools

  6. Click onto the 'Network' tab

  7. In the Dev Tools side bar, click onto the filename beginning with "player-stats?session-id=.." (in my test I only see 3 filenames, the mentioned file in the middle, but that might differ from vid to vid)

  8. right of the side bar, make sure the 'Headers' tab is active

  9. scroll all the way down until you see "Request Payload"

  10. expand "autoplay", then expand the number beneath it (in my test it was a 0)

  11. look for the line with "clip_id" (in my test line 16). The number following it is your video_id !!

(alternatively you can click onto "view source" right of "Request Payload", copy the entire block, paste it into a text editor and search for "clip_id" to get the clip_id number)

  1. Copy the value of the field called "clip_id". i.e. 123456789 (so far it has always been a 9 digit number)

  2. Log into Vimeo: https://vimeo.com/log_in

  3. Create an App: https://developer.vimeo.com/apps/new?source=topnav

  • App name (example): VidID
  • App description: VidID
  • leave "Will people besides you be able to access your app?" on "No"
  • check the checkbox "I agree that [..]"
  • click onto the blue "Create App" button
  1. Go to the "Vimeo API Reference: Videos" page:
    https://developer.vimeo.com/api/reference/videos#get_text_tracks

(NOTE: ** You MUST be registered in Vimeo to do the following API calls! **)

  1. In the top right, click onto the blue "Try it out" button

  2. In the top right, where it reads "Test your app", choose the VidID app you just created

  3. Under "Path parameters", as video_id *, enter the clip_id into the form

  4. In my test it did not make a difference if the checkbox that says "Authenticate this call as [your Name]" is checked or not

  5. Push the blue "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 subtitle file will start downloading as .srt.vtt

  3. Remove the .vtt so the extension is .srt, because it already is a .srt file

  4. The downloaded .srt file is not structured 100% correctly. To have it's language displayed correctly in VLC, open it in

https://www.nikse.dk/subtitleedit/online#

  • Subtitle, Open:
  • Browse
  • Frame rate: find it out via apps like MediaInfo, Invisor Lite etc. and set it correctly
  • Code Page: if the ISO-8859-1 does not display your language's letters correctly: utf-8 (at the very bottom of the list) worked for me (the Code Page according to my language did NOT work)
  • click onto 'Load subtile'
  • Subtitle, Save/download
  • Save/download
  1. Test in your favorite video player :)

@LeeBinder
Copy link

@pjmartorell : can you add my update to https://webapps.stackexchange.com/questions/85517/how-can-i-download-subtitles-for-a-vimeo-video/?
I must have done something wrong accdg. to stackexchange because they don't let me post (oh well).
Gracias

@fathermocker
Copy link

@LeeBinder Thanks for your update. Things have changed in Vimeo (now the clip_id parameter is not there, it's called id and there's no player-stats either, it can be found in config-player) but your tutorial is very helpful.

@mahdisama
Copy link

@LeeBinder Thanks for the information. But what about a video which has domain level policy? I could successfully extract SRT from lots of public videos but still couldn't find a way for these types of videos.

@jvanderbiest
Copy link

jvanderbiest commented Oct 4, 2019

I might miss the point here but you actually don't need all those steps.

  1. Open Chrome Developer Tools, go to network tab.
  2. Load the page. and select a CC
  3. Select the last request in the network tab. The request is of format [number].vtt?token=[token].
  4. Inspect the response or open the request in another tab by right clicking it to preserve any special characters. If you check the response of the request it displays the complete WEBVTT file.
  5. Copy paste it to a txt file and use an online converter to change it to SRT

@manxbiker
Copy link

Great instruction @jvanderbiest. Thanks for simplifying the process, it makes a lot of sense and easy to do.

@jvanderbiest
Copy link

@manxbiker glad I saved you some time :-)

@LeeBinder
Copy link

@alireza Tarahomi : re. your question if this works on "private" videos: for VODs I purchased on Vimeo I use JDownloader with my Vimeo credentials entered into JDownloader/ Settings/ Account Manager/ Add -> Vimeo

@sripriyesha
Copy link

sripriyesha commented Aug 8, 2020

Using youtube-dl:

Step 1
Login to Vimeo and get the cookies.txt file using this Chrome plugin

Step 2
Use youtube-dl to download all the subtitles of the video. Example:

youtube-dl --all-subs "https://vimeo.com/ondemand/<video>" --cookies cookies.txt --skip-download
(--skip-download to download only the subtitles and not the video itself)

@LeeBinder
Copy link

hey @sripriyesha - does this also download full length subs of a VOD (Video On Demand) I have NOT purchased, or in that case only the trailer subs? Or in other words, does this only work for VODs one has purchased?

@jomigoco
Copy link

@sripriyesha works perfectly, many thanks!

@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