vimeo-audio-video
vimeo-audio-video copied to clipboard
Segment urls 404
Looks like vimeo may have changed it's URL format a bit. Here's an example master.json URL:
https://64vod-adaptive.akamaized.net/exp=1611093556~acl=%2F1067c142-d328-4648-9f98-cd17b940bd5f%2F%2A~hmac=dbe84d80b267aaf41180a01f8c7a90cf19f2e690e84d413995cb87cd76a1ef58/1067c142-d328-4648-9f98-cd17b940bd5f/sep/video/c0539fd6,0bc94fd1,2b5b55b0,e76f545f,c018328e/audio/3e2c571b,d0179731/master.json?base64_init=1
Notice, there are now multiple video segments separated by commas. The Vimeo player looks to be fetching a URL that looks like this:
https://64vod-adaptive.akamaized.net/exp=1611095880~acl=%2F1067c142-d328-4648-9f98-cd17b940bd5f%2F%2A~hmac=0b4e80ea6e3cfc519280d0d8e104f2ddbf7b0909d26412bb9d45561023a93563/1067c142-d328-4648-9f98-cd17b940bd5f/sep/video/0bc94fd1/chop/segment-1.m4s
However, in the python script the 'segment_url' being extracted is not the same as above, and results in a 404:
https://64vod-adaptive.akamaized.net/exp=1611093556~acl=%2F1067c142-d328-4648-9f98-cd17b940bd5f%2F%2A~hmac=dbe84d80b267aaf41180a01f8c7a90cf19f2e690e84d413995cb87cd76a1ef58/1067c142-d328-4648-9f98-cd17b940bd5f/sep/video/c0539fd6,0bc94fd1,2b5b55b0,e76f545f,c018328e/audio/e76f545f/chop/segment-1.m4s
Base url: https://64vod-adaptive.akamaized.net/exp=1611093556~acl=%2F1067c142-d328-4648-9f98-cd17b940bd5f%2F%2A~hmac=dbe84d80b267aaf41180a01f8c7a90cf19f2e690e84d413995cb87cd76a1ef58/1067c142-d328-4648-9f98-cd17b940bd5f/sep/video/c0539fd6,0bc94fd1,2b5b55b0,e76f545f,c018328e/audio/e76f545f/chop/
Saving VIDEO to video_e76f545f.mp4
0%| | 0/1221 [00:00<?, ?it/s]not 200!
<Response [404]>`
Try installing and adding this to the imports:
import urllib.parse
And then add this chunk before # Video download here :
# Fix the base url
base_url = urllib.parse.urljoin(base_url, content['base_url'])
This uses the multiple parent directory pieces in the base_url field to get to the correct absolute path.
It might also need to be done for the audio section.
For me the following fixed the 404 error and the base_url fixed the audio as well (the fragments had ../
paths):
# Extract some stuff
base_url = master_json_url[:master_json_url.rfind('video/', 0, -26) + len('video/')]