Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segment urls 404 #3

Open
el-timm opened this issue Jan 19, 2021 · 2 comments
Open

Segment urls 404 #3

el-timm opened this issue Jan 19, 2021 · 2 comments

Comments

@el-timm
Copy link

el-timm commented Jan 19, 2021

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]>`
@Chalmes
Copy link

Chalmes commented Jun 28, 2022

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.

@rndazurescript
Copy link

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/')]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants