VideoHelp Forum


Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!


Try StreamFab Downloader and download streaming video from Youtube, Netflix, Amazon! Download free trial.


+ Reply to Thread
Page 1 of 3
1 2 3 LastLast
Results 1 to 30 of 74
Thread
  1. Dear all - my first post, I have been reading and educating myself but not having luck obtaining decryption keys for a Eurovision Sport video. I tried obtaining it using a couple of web-based keys tools but am receiving errors.

    If anyone can help with this I'd appreciate it (trying to learn the process better so I don't need to ask, please bear with me).

    Thank you.


    Video link:
    Code:
    https://eurovisionsport.com/mediacard/EVS_OBE_240308_M_24-10262

    MPD:
    Code:
    https://evs-ltcu-dash-secure2.akamaized.net/out/v1/fd9c31e9005744fd8855048e22123129/a44b11c8e63146eda52561238d4f2551/547a9906db0d477e9db4ba67ce28f69c/manifest.mpd

    License:
    Code:
    https://evsp4wab.anycast.nagra.com/EVSP4WAB/wvls/contentlicenseservice/v1/licenses

    KID (from MPD):
    Code:
    12202D3D-DFD1-476B-A788-2065EFBA1F51

    PSSH (I think! generated using https://emarsden.github.io/pssh-box-wasm/generate/ from the KID, did not change any of the default settings):
    Code:
    AAAAMnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABISEBIgLT3f0Udrp4ggZe+6H1E=

    Headers:
    Code:
    Connection: keep-alive
    Content-Length: 3946
    content-type: application/octet-stream
    Host: evsp4wab.anycast.nagra.com
    nv-authorizations: eyJraWQiOiIyODAwMTQiLCJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXIiOiIxLjAiLCJleHAiOjE3MDk5MTIzODEsImNvbnRlbnRSaWdodHMiOlt7ImR1cmF0aW9uIjo4NjQwMCwic2Vzc2lvbkNvbnRyb2wiOnsiZ3JvdXBzIjpbeyJtYXhTZXNzaW9ucyI6MTAwMDAwMDAwMCwiZ3JvdXBJZCI6IjY1ZTczYWUwMTIzODllNjIwOTQ1YjMzNSJ9XSwic2Vzc2lvbkNvbnRyb2xFbmFibGVkIjpmYWxzZSwibWF4U2Vzc2lvbnMiOjEwMDAwMDAwMDB9LCJzdG9yYWJsZSI6ZmFsc2UsImNvbnRlbnRJZCI6IjIwMjNfRVZTX0lCVV8yX0RBU0giLCJzdGFydCI6IjIwMjQtMDMtMDhUMTU6MzQ6NDFaIiwiZW5kIjoiMjAyNC0wMy0wOVQxNTozNDo0MVoifV0sImp0aSI6IjQwNjUxMzY1LThmYzMtNGNjMC04ODNjLWRlM2E0OTA1ZGEwYSIsImRldmljZSI6eyJ3YXRlcm1hcmtpbmciOmZhbHNlLCJhY2NvdW50SWQiOiI2NWU3M2FlMDEyMzg5ZTYyMDk0NWIzMzUifSwidHlwIjoiQ29udGVudEF1dGhaIn0.UGk0Zd3xXNa3hSstQKMA_ETvLozvfFlnftP5-I7oEXY
    Origin: https://eurovisionsport.com
    Referer: https://eurovisionsport.com/
    User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
    Quote Quote  
  2. 1. Your PSSH is incorrect. You can find the correct one inside the MPD file or with Eme logger.
    2. You need to block the license request URL, reload the page, the video won't play, but the license url will show up in red and in headers you will find the nv-authorizations one. That's the only header you need.

    You can't get keys because the nv-authorizations header is a one time use.
    By doing what I explained, makes the header unused, and you can use it in a script to get the keys.
    Quote Quote  
  3. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    I think someone could automate this, their API is kinda neat from a first glance.

    Edit: This should be the key @OP
    Code:
    12202d3ddfd1476ba7882065efba1f51:5cc933a718d2ebc7477634d693879be2
    I'm gonna try and see if I can automate the login as well.
    Last edited by 2nHxWW6GkN1l916N3ayz8HQoi; 8th Mar 2024 at 12:24.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  4. Excellent! Thanks both, that worked. I didn't know the nv-authorizations was a single-use header. Appreciate it.
    Quote Quote  
  5. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by jjcantab View Post
    Excellent! Thanks both, that worked. I didn't know the nv-authorizations was a single-use header. Appreciate it.
    Here is the final script if you wanna use it for other videos. You need a CDM in WVD format and you also need to fill in your email and password:

    Code:
    import json
    import re
    
    import requests
    from pywidevine.cdm import Cdm
    from pywidevine.device import Device
    from pywidevine.pssh import PSSH
    
    EMAIL = "YOUR_EMAIL"
    PASSWORD = "YOUR_PASSWORD"
    
    LICENSE_URL = "https://evsp4wab.anycast.nagra.com/EVSP4WAB/wvls/contentlicenseservice/v1/licenses"
    WVD_FILE = "./device_wvd_file.wvd"
    
    LOGIN_API = "https://api.evsports.opentv.com/ias/v2/token?grant_type=password&username={email}&password={password}"
    EDITORIALS_API = 'https://api.evsports.opentv.com/metadata/delivery/GLOBAL/vod/editorials?filter=%7B%22editorial.id%22:%7B%22$in%22:%20%5B%22{video_id}%22%5D%7D,%22locale%22:%22en_US%22,%22isValid%22:true,%22isVisible%22:true%7D&limit=9999&sort=%5B%5B%22Title%22,%201%5D%5D'
    CONTENT_API = 'https://api.evsports.opentv.com/ias/v2/content_token'
    
    
    def get_token():
        return json.loads(requests.post(
            LOGIN_API.format(email=EMAIL, password=PASSWORD), json={}, headers={
                'host': 'api.evsports.opentv.com',
                'tenantid': 'nagra'
            }
        ).content.decode())["access_token"]
    
    
    ACCOUNT_TOKEN = get_token()
    
    
    def get_video_data(source_url):
        video_id = re.search(r"/mediacard/([^/]+)/?", source_url).group(1)
        response = json.loads(requests.get(EDITORIALS_API.format(video_id=video_id), headers={
            'Authorization': 'Bearer {token}'.format(token=ACCOUNT_TOKEN),
        }).content.decode())
    
        video_data = []
        for e in response["editorials"]:
            if e["id"] != video_id:
                continue
            for t in e["technicals"]:
                av = t["media"]["AV_PlaylistName"]
                video_data += [(av["uri"], av["drmId"])]
        manifest, drm_id = [v for v in video_data if ".mpd" in v[0]][0]
    
        response = requests.get(manifest).content.decode()
        try:
            pssh_value = re.search(r'<cenc:pssh\b[^>]*>(.*?)</cenc:pssh>', response).group(1)
        except:
            return manifest, None, None
    
        response = json.loads(requests.post(
            CONTENT_API, params={
                'content_id': drm_id,
                'type': 'device',
            }, headers={
                'Nv-Tenant-Id': 'nagra',
                'Authorization': 'Bearer {token}'.format(token=ACCOUNT_TOKEN)
            }
        ).content.decode())
        content_token = response["content_token"]
        return manifest, pssh_value, content_token
    
    
    def get_keys(pssh_value, content_token):
        if pssh_value is None or content_token is None:
            return []
    
        pssh = PSSH(pssh_value)
        device = Device.load(WVD_FILE)
        cdm = Cdm.from_device(device)
        session_id = cdm.open()
    
        challenge = cdm.get_license_challenge(session_id, pssh)
        licence = requests.post(LICENSE_URL, data=challenge, headers={
            'nv-authorizations': content_token
        })
        licence.raise_for_status()
        cdm.parse_license(session_id, licence.content)
    
        keys = []
        for key in cdm.get_keys(session_id):
            if "CONTENT" in key.type:
                keys += [f"{key.kid.hex}:{key.key.hex()}"]
        cdm.close(session_id)
        return keys
    
    
    def get_download_command(source_url):
        manifest, pssh_value, content_token = get_video_data(source_url)
        keys = get_keys(pssh_value, content_token)
    
        if len(keys) == 0:
            return f"N_m3u8DL-RE.exe {manifest} -M format=mkv"
        return f"N_m3u8DL-RE.exe {manifest} {' '.join([f'--key {k}' for k in keys])} -M format=mkv"
    
    
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_OBE_240308_M_24-10262"))
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_XEJ_240217_MX_24-3261A"))
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_2023-10-08_FEED_FIG_1_DEF_F_TIME_12_50_ID_23-7614"))
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_240204_EDD_25128_"))
    Output:
    Code:
    N_m3u8DL-RE.exe https://evs-ltcu-dash-secure2.akamaized.net/out/v1/fd9c31e9005744fd8855048e22123129/a44b11c8e63146eda52561238d4f2551/547a9906db0d477e9db4ba67ce28f69c/manifest.mpd --key 12202d3ddfd1476ba7882065efba1f51:5cc933a718d2ebc7477634d693879be2 -M format=mkv
    N_m3u8DL-RE.exe https://d9e3795b4d13e5700fc6b7b92345cee0.egress.mediapackage-vod.eu-west-1.amazonaws.com/out/v1/740de75e27c64493bbbe8e8d25d6f42c/a44b11c8e63146eda52561238d4f2551/547a9906db0d477e9db4ba67ce28f69c/manifest.mpd --key ded50c78cc0d47e19cf944e5dbc56cc6:e1075fba590e616ddde64edb708466fa -M format=mkv
    N_m3u8DL-RE.exe https://d9e3795b4d13e5700fc6b7b92345cee0.egress.mediapackage-vod.eu-west-1.amazonaws.com/out/v1/4355df2ac4a442259a7079d110cfdcc4/a44b11c8e63146eda52561238d4f2551/547a9906db0d477e9db4ba67ce28f69c/manifest.mpd --key b0bfeb538deb410885a0e38b66c0f77d:044115b5331a5dfd618ef22b14e3883f -M format=mkv
    N_m3u8DL-RE.exe https://evs-vod-secure2.akamaized.net/MediaConvert-CDN/E1_S01R01_JEDDAH_26MIN_HIGHLIGHTS_7fd52aa5-9834-46b0-b1d3-e685cfd886ab-proxy_Trim/E1_S01R01_JEDDAH_26MIN_HIGHLIGHTS_7fd52aa5-9834-46b0-b1d3-e685cfd886ab-proxy.mpd -M format=mkv
    I only tested it for 4 videos and seems to be working fine. Fun fact, they send the password in plaintext through the use of query parameters. Nice security there. Also, I don't know if I'm the only one but I can't directly access a video link unless I access it from the category page. Weird.

    Edit: I won't maintain this script since their site is bugged as hell when it comes to manifests. But I'll leave the script in case someone wants to improve it.

    Edit2: Fixed it somehow by ignoring the failed fragments. The service has been added to widefrog so it won't be maintained here.
    Last edited by 2nHxWW6GkN1l916N3ayz8HQoi; 22nd May 2024 at 07:17.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  6. Excellent job Pepe!
    Perhaps in the future, when you find the time and willingness, try to write a detailed guide on how you go about automating stuff
    It's Python knowledge and looking at the network tab mostly, but still.
    Quote Quote  
  7. Originally Posted by [ss]vegeta View Post
    1. Your PSSH is incorrect. You can find the correct one inside the MPD file or with Eme logger.
    2. You need to block the license request URL, reload the page, the video won't play, but the license url will show up in red and in headers you will find the nv-authorizations one. That's the only header you need.

    You can't get keys because the nv-authorizations header is a one time use.
    By doing what I explained, makes the header unused, and you can use it in a script to get the keys.
    Wow, that cream really did the trick! Thanks for the information, buddy!
    Quote Quote  
  8. Originally Posted by SUKA View Post
    Thanks for the information, buddy!
    np, DRM is cancer
    Quote Quote  
  9. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by [ss]vegeta View Post
    Excellent job Pepe!
    Perhaps in the future, when you find the time and willingness, try to write a detailed guide on how you go about automating stuff
    It's Python knowledge and looking at the network tab mostly, but still.
    Thanks @vegeta If you're talking specifically about the scripts used to download DRM content, they're basically glorified data scrapers on top of a pywidevine script. Everyone knows the basics of pywidevine scripts and what they need:
    - license
    - pssh
    - headers
    - mpd (if you want to download stuff)

    So how do you get those? You build a data scraper that gets all those components. There isn't one magic trick that solves everything but rather a set of steps that you hope may help you. As a matter of fact, I already described what you wish as a guide here
    https://forum.videohelp.com/threads/413705-ffmpeg-other-stuff!-[be-gentle]#post2726989

    I guess if you want it more detailed than that, I would have to make a post where I apply this methodology on a specific website and describe the results step by step. But I doubt people are interested in this since it's just programming and most people come to this forum to download stuff. People who can write scripts can simply follow the guideline I posted (it's not something groundbreaking though ¯\_(ツ)_/¯ ).

    Edit: I made a guide here
    https://forum.videohelp.com/threads/415366-the-slacker-s-guide-to-mass-downloading-(mo...on#post2743977
    Last edited by 2nHxWW6GkN1l916N3ayz8HQoi; 23rd Jul 2024 at 03:47.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  10. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post

    Here is the final script if you wanna use it for other videos. You need a CDM in WVD format and you also need to fill in your email and password:
    Hi,

    When testing your script, out of curiosity, there is an error with this video
    Sports -> Electric Racing -> Highlights - E1 Jeddah GP
    Code:
    https://eurovisionsport.com/mediacard/EVS_240204_EDD_25128_
    Code:
    line 45, in get_video_data
        manifest, drm_id = [v for v in video_data if "manifest.mpd" in v[0]][0]
    IndexError: list index out of range
    I'm interested to learn more about how did you find the API URL and login/password parameters?
    Quote Quote  
  11. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by IceM View Post
    Hi,

    When testing your script, out of curiosity, there is an error with this video
    Sports -> Electric Racing -> Highlights - E1 Jeddah GP
    Code:
    https://eurovisionsport.com/mediacard/EVS_240204_EDD_25128_
    Greetings @ice! Wow. Nice find. I expected all their videos to have DRM. Apparently not. If you try to download manually that one, you won't even find a pssh from the eme logger or in the special mpd named proxy.mpd (not manifest.mpd). So even if you replace "manifest.mpd" with ".mpd" to be more general in the script, it still fails because there is no PSSH. I checked N_m3u8 on that proxy.mpd and it downloads directly with no encryption.

    I am lazy so I won't even modify the script for this case. If someone wants to modify it or incorporate it into other tools etc., feel free to do it, I don't mind one bit.

    Originally Posted by IceM View Post
    I'm interested to learn more about how did you find the API URL and login/password parameters?
    Well, that request was needed to get the token. The token was one of those special components that aren't even related to the source page. So you need to think outside the box for a bit and investigate other related pages from the website itself. So I thought, ok, there are 2 types of tokens: content token and bearer token. You already got the content token from another request and that is tied to the video page itself.

    So then the other bearer token is definitely tied to the account itself (maybe?). I then tested the login request to investigate it a bit but of course, it ain't easy. Most websites simply redirect you to another page, and I wanna see the request clearly. So out of laziness to fix this issue in the browser, I hooked up an interceptor (postman). You can see it in action here:
    https://forum.videohelp.com/threads/413561-How-to-download-video-from-this-website-i-c...ng#post2725571

    Then you capture the login requests and surprise, surprise. The bearer token I captured manually from the previous video page requests looks like the one from the login request. And the problem was solved. There are other tools that can be used instead of postman. I am just mentioning this one to make it more known
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  12. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Greetings @ice! Wow. Nice find. I expected all their videos to have DRM. Apparently not. If you try to download manually that one, you won't even find a pssh from the eme logger or in the special mpd named proxy.mpd (not manifest.mpd). So even if you replace "manifest.mpd" with ".mpd" to be more general in the script, it still fails because there is no PSSH. I checked N_m3u8 on that proxy.mpd and it downloads directly with no encryption.

    I am lazy so I won't even modify the script for this case. If someone wants to modify it or incorporate it into other tools etc., feel free to do it, I don't mind one bit.
    thanks for the precision

    Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Well, that request was needed to get the token. The token was one of those special components that aren't even related to the source page. So you need to think outside the box for a bit and investigate other related pages from the website itself. So I thought, ok, there are 2 types of tokens: content token and bearer token. You already got the content token from another request and that is tied to the video page itself.

    So then the other bearer token is definitely tied to the account itself (maybe?). I then tested the login request to investigate it a bit but of course, it ain't easy. Most websites simply redirect you to another page, and I wanna see the request clearly. So out of laziness to fix this issue in the browser, I hooked up an interceptor (postman). You can see it in action here:
    https://forum.videohelp.com/threads/413561-How-to-download-video-from-this-website-i-c...ng#post2725571

    Then you capture the login requests and surprise, surprise. The bearer token I captured manually from the previous video page requests looks like the one from the login request. And the problem was solved. There are other tools that can be used instead of postman. I am just mentioning this one to make it more known
    ok, I understand the concept, but I'm not at the same skill level as you.
    Quote Quote  
  13. Search, Learn, Download! Karoolus's Avatar
    Join Date
    Oct 2022
    Location
    Belgium
    Search Comp PM
    Originally Posted by IceM View Post
    ok, I understand the concept, but I'm not at the same skill level as you.
    Trial and error until you succeed!
    Quote Quote  
  14. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by IceM View Post
    thanks for the precision
    You're welcome. I modified the script to handle non-DRM videos as well. I also used your found video as an example. I guess you could skip entirely the cdm part if you call the API provided by cdrm-project (https://cdrm-project.com/api) since the eurovision license call doesn't even require a custom script. But I don't like calling external APIs when you can do the job yourself so I'm gonna leave it like that (less critical points where stuff could break unexpectedly).

    Originally Posted by IceM View Post
    ok, I understand the concept, but I'm not at the same skill level as you.
    I don't think this is a skill issue. Rather it is about experience. Skill becomes a problem when you start writing the Python code. But if you already know basic Python, it all comes down to experience when you inspect sites. As @karoolus said, trial and error. Just play around a few sites even if you don't figure it out. You could also see solved sites and try to reach the same solution (or a better one) without necessarily copying the code.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  15. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    You're welcome. I modified the script to handle non-DRM videos as well. I also used your found video as an example. I guess you could skip entirely the cdm part if you call the API provided by cdrm-project (https://cdrm-project.com/api) since the eurovision license call doesn't even require a custom script. But I don't like calling external APIs when you can do the job yourself so I'm gonna leave it like that (less critical points where stuff could break unexpectedly)
    Thanks for the fix
    I use my own extracted CDM

    Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    As @karoolus said, trial and error. Just play around a few sites even if you don't figure it out. You could also see solved sites and try to reach the same solution (or a better one) without necessarily copying the code.
    That's what I do, I look in your scripts and at the original site to understand how to retrieve the necessary information.
    Quote Quote  
  16. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Originally Posted by jjcantab View Post
    Excellent! Thanks both, that worked. I didn't know the nv-authorizations was a single-use header. Appreciate it.
    Here is the final script if you wanna use it for other videos. You need a CDM in WVD format and you also need to fill in your email and password:

    Code:
    import json
    import re
    
    import requests
    from pywidevine.cdm import Cdm
    from pywidevine.device import Device
    from pywidevine.pssh import PSSH
    
    EMAIL = "YOUR_EMAIL"
    PASSWORD = "YOUR_PASSWORD"
    
    LICENSE_URL = "https://evsp4wab.anycast.nagra.com/EVSP4WAB/wvls/contentlicenseservice/v1/licenses"
    WVD_FILE = "./device_wvd_file.wvd"
    
    LOGIN_API = "https://api.evsports.opentv.com/ias/v2/token?grant_type=password&username={email}&password={password}"
    EDITORIALS_API = 'https://api.evsports.opentv.com/metadata/delivery/GLOBAL/vod/editorials?filter=%7B%22editorial.id%22:%7B%22$in%22:%20%5B%22{video_id}%22%5D%7D,%22locale%22:%22en_US%22,%22isValid%22:true,%22isVisible%22:true%7D&limit=9999&sort=%5B%5B%22Title%22,%201%5D%5D'
    CONTENT_API = 'https://api.evsports.opentv.com/ias/v2/content_token'
    
    
    def get_token():
        return json.loads(requests.post(
            LOGIN_API.format(email=EMAIL, password=PASSWORD), json={}, headers={
                'host': 'api.evsports.opentv.com',
                'tenantid': 'nagra'
            }
        ).content.decode())["access_token"]
    
    
    ACCOUNT_TOKEN = get_token()
    
    
    def get_video_data(source_url):
        video_id = re.search(r"/mediacard/([^/]+)/?", source_url).group(1)
        response = json.loads(requests.get(EDITORIALS_API.format(video_id=video_id), headers={
            'Authorization': 'Bearer {token}'.format(token=ACCOUNT_TOKEN),
        }).content.decode())
    
        video_data = []
        for e in response["editorials"]:
            if e["id"] != video_id:
                continue
            for t in e["technicals"]:
                av = t["media"]["AV_PlaylistName"]
                video_data += [(av["uri"], av["drmId"])]
        manifest, drm_id = [v for v in video_data if ".mpd" in v[0]][0]
    
        response = requests.get(manifest).content.decode()
        try:
            pssh_value = re.search(r'<cenc:pssh\b[^>]*>(.*?)</cenc:pssh>', response).group(1)
        except:
            return manifest, None, None
    
        response = json.loads(requests.post(
            CONTENT_API, params={
                'content_id': drm_id,
                'type': 'device',
            }, headers={
                'Nv-Tenant-Id': 'nagra',
                'Authorization': 'Bearer {token}'.format(token=ACCOUNT_TOKEN)
            }
        ).content.decode())
        content_token = response["content_token"]
        return manifest, pssh_value, content_token
    
    
    def get_keys(pssh_value, content_token):
        if pssh_value is None or content_token is None:
            return []
    
        pssh = PSSH(pssh_value)
        device = Device.load(WVD_FILE)
        cdm = Cdm.from_device(device)
        session_id = cdm.open()
    
        challenge = cdm.get_license_challenge(session_id, pssh)
        licence = requests.post(LICENSE_URL, data=challenge, headers={
            'nv-authorizations': content_token
        })
        licence.raise_for_status()
        cdm.parse_license(session_id, licence.content)
    
        keys = []
        for key in cdm.get_keys(session_id):
            if "CONTENT" in key.type:
                keys += [f"{key.kid.hex}:{key.key.hex()}"]
        cdm.close(session_id)
        return keys
    
    
    def get_download_command(source_url):
        manifest, pssh_value, content_token = get_video_data(source_url)
        keys = get_keys(pssh_value, content_token)
    
        if len(keys) == 0:
            return f"N_m3u8DL-RE.exe {manifest} -M format=mkv"
        return f"N_m3u8DL-RE.exe {manifest} {' '.join([f'--key {k}' for k in keys])} -M format=mkv"
    
    
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_OBE_240308_M_24-10262"))
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_XEJ_240217_MX_24-3261A"))
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_2023-10-08_FEED_FIG_1_DEF_F_TIME_12_50_ID_23-7614"))
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_240204_EDD_25128_"))
    Output:
    Code:
    N_m3u8DL-RE.exe https://evs-ltcu-dash-secure2.akamaized.net/out/v1/fd9c31e9005744fd8855048e22123129/a44b11c8e63146eda52561238d4f2551/547a9906db0d477e9db4ba67ce28f69c/manifest.mpd --key 12202d3ddfd1476ba7882065efba1f51:5cc933a718d2ebc7477634d693879be2 -M format=mkv
    N_m3u8DL-RE.exe https://d9e3795b4d13e5700fc6b7b92345cee0.egress.mediapackage-vod.eu-west-1.amazonaws.com/out/v1/740de75e27c64493bbbe8e8d25d6f42c/a44b11c8e63146eda52561238d4f2551/547a9906db0d477e9db4ba67ce28f69c/manifest.mpd --key ded50c78cc0d47e19cf944e5dbc56cc6:e1075fba590e616ddde64edb708466fa -M format=mkv
    N_m3u8DL-RE.exe https://d9e3795b4d13e5700fc6b7b92345cee0.egress.mediapackage-vod.eu-west-1.amazonaws.com/out/v1/4355df2ac4a442259a7079d110cfdcc4/a44b11c8e63146eda52561238d4f2551/547a9906db0d477e9db4ba67ce28f69c/manifest.mpd --key b0bfeb538deb410885a0e38b66c0f77d:044115b5331a5dfd618ef22b14e3883f -M format=mkv
    N_m3u8DL-RE.exe https://evs-vod-secure2.akamaized.net/MediaConvert-CDN/E1_S01R01_JEDDAH_26MIN_HIGHLIGHTS_7fd52aa5-9834-46b0-b1d3-e685cfd886ab-proxy_Trim/E1_S01R01_JEDDAH_26MIN_HIGHLIGHTS_7fd52aa5-9834-46b0-b1d3-e685cfd886ab-proxy.mpd -M format=mkv
    I only tested it for 4 videos and seems to be working fine. Fun fact, they send the password in plaintext through the use of query parameters. Nice security there. Also, I don't know if I'm the only one but I can't directly access a video link unless I access it from the category page. Weird.
    Damn, impressive work. Thank you.

    This site definitely has some oddities in it. For example it doesn't seem to work under Linux at all (someone confirm? giving DRM / Shaka error here), and the fact that direct URLs do not work, always need to go through the navigation. Seems like very amateurish work all in all. Your script is a lifesaver.
    Quote Quote  
  17. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Great to see more and more scripts being produced and shared.
    Noob Starter Pack. Just download everything Widevine! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes5.zip
    Quote Quote  
  18. Hi.
    I have been trying to download videos from Eurovision sport, but have failed so far. Earlier, it was easy when they were posting content on Allathletics.tv website.

    I tried following the instructions in this thread.

    In my windows command terminal, I first installed Python.

    Executed : pip install requests pywidevine



    I saved the following script by @fme on my desktop and named the file eurovision_download.py:


    import json
    import re

    import requests
    from pywidevine.cdm import Cdm
    from pywidevine.device import Device
    from pywidevine.pssh import PSSH

    EMAIL = "YOUR_EMAIL"
    PASSWORD = "YOUR_PASSWORD"

    LICENSE_URL = "https://evsp4wab.anycast.nagra.com/EVSP4WAB/wvls/contentlicenseservice/v1/licenses"
    WVD_FILE = "./device_wvd_file.wvd"

    LOGIN_API = "https://api.evsports.opentv.com/ias/v2/token?grant_type=password&username={email}&passwor d={password}"
    EDITORIALS_API = 'https://api.evsports.opentv.com/metadata/delivery/GLOBAL/vod/editorials?filter=%7B%22editorial.id%22:%7B%22$in% 22:%20%5B%22{video_id}%22%5D%7D,%22locale%22:%22en _US%22,%22isValid%22:true,%22isVisible%22:true%7D& limit=9999&sort=%5B%5B%22Title%22,%201%5D%5D'
    CONTENT_API = 'https://api.evsports.opentv.com/ias/v2/content_token'


    def get_token():
    return json.loads(requests.post(
    LOGIN_API.format(email=EMAIL, password=PASSWORD), json={}, headers={
    'host': 'api.evsports.opentv.com',
    'tenantid': 'nagra'
    }
    ).content.decode())["access_token"]


    ACCOUNT_TOKEN = get_token()


    def get_video_data(source_url):
    video_id = re.search(r"/mediacard/([^/]+)/?", source_url).group(1)
    response = json.loads(requests.get(EDITORIALS_API.format(vide o_id=video_id), headers={
    'Authorization': 'Bearer {token}'.format(token=ACCOUNT_TOKEN),
    }).content.decode())

    video_data = []
    for e in response["editorials"]:
    if e["id"] != video_id:
    continue
    for t in e["technicals"]:
    av = t["media"]["AV_PlaylistName"]
    video_data += [(av["uri"], av["drmId"])]
    manifest, drm_id = [v for v in video_data if ".mpd" in v[0]][0]

    response = requests.get(manifest).content.decode()
    try:
    pssh_value = re.search(r'<cencssh\b[^>]*>(.*?)</cencssh>', response).group(1)
    except:
    return manifest, None, None

    response = json.loads(requests.post(
    CONTENT_API, params={
    'content_id': drm_id,
    'type': 'device',
    }, headers={
    'Nv-Tenant-Id': 'nagra',
    'Authorization': 'Bearer {token}'.format(token=ACCOUNT_TOKEN)
    }
    ).content.decode())
    content_token = response["content_token"]
    return manifest, pssh_value, content_token


    def get_keys(pssh_value, content_token):
    if pssh_value is None or content_token is None:
    return []

    pssh = PSSH(pssh_value)
    device = Device.load(WVD_FILE)
    cdm = Cdm.from_device(device)
    session_id = cdm.open()

    challenge = cdm.get_license_challenge(session_id, pssh)
    licence = requests.post(LICENSE_URL, data=challenge, headers={
    'nv-authorizations': content_token
    })
    licence.raise_for_status()
    cdm.parse_license(session_id, licence.content)

    keys = []
    for key in cdm.get_keys(session_id):
    if "CONTENT" in key.type:
    keys += [f"{key.kid.hex}:{key.key.hex()}"]
    cdm.close(session_id)
    return keys


    def get_download_command(source_url):
    manifest, pssh_value, content_token = get_video_data(source_url)
    keys = get_keys(pssh_value, content_token)

    if len(keys) == 0:
    return f"N_m3u8DL-RE.exe {manifest} -M format=mkv"
    return f"N_m3u8DL-RE.exe {manifest} {' '.join([f'--key {k}' for k in keys])} -M format=mkv"


    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_OBE_240308_M_24-10262"))
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_XEJ_240217_MX_24-3261A"))
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_2023-10-08_FEED_FIG_1_DEF_F_TIME_12_50_ID_23-7614"))
    print(get_download_command("https://eurovisionsport.com/mediacard/EVS_240204_EDD_25128_"))



    -----
    In the above script, i replaced:

    EMAIL = "YOUR_EMAIL"
    PASSWORD = "YOUR_PASSWORD"


    WITH

    EMAIL = " my email for eurovision website"
    PASSWORD = "my password for eurovision website"

    AND



    def get_download_command(source_url):
    manifest, pssh_value, content_token = get_video_data(source_url)
    keys = get_keys(pssh_value, content_token)


    source_url ( in both instances)

    with the URL address of page that contains the video:

    https://eurovisionsport.com/mediacard/EVS_240612_F_20240707EARome_64

    -----


    I don't know if so far I am on the right track.

    After this i try to run the script. I had saved eurovision_download.py on desktop. I navigated to the path.

    Now, I run : C:\Users\***\OneDrive\Desktop>python eurovision_download.py

    I get the error : python: can't open file 'C:\\Users\\***\\OneDrive\\Desktop\\eurovision_dow nload.py': [Errno 2] No such file or directory


    I would be grateful if someone could help.

    -----------------------

    *** is my desktop user name.

    I don't know much about Python.
    Last edited by EV Downloads; 17th Jun 2024 at 02:40.
    Quote Quote  
  19. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    Originally Posted by EV Downloads View Post
    Now, I run : C:\Users\***\OneDrive\Desktop>python eurovision_download.py
    I get the error : python: can't open file 'C:\\Users\\***\\OneDrive\\Desktop\\eurovision_dow nload.py': [Errno 2] No such file or directory
    I would be grateful if someone could help.
    The error you get is related to the path of the file and not the script. Open a cdm in the folder 'C:\Users\***\OneDrive\Desktop\' type 'dir' to list file and make sure the download script is in the folder.
    Quote Quote  
  20. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by EV Downloads View Post
    Hi.
    I have been trying to download videos from Eurovision sport, but have failed so far. Earlier, it was easy when they were posting content on Allathletics.tv website.
    If you intend to use my script for eurovision sport I advise you to use the updated version of it which can be found here.
    https://forum.videohelp.com/threads/414548-drm-free-content-downloader-widefrog#post2735651
    This site is currently supported.

    If Python or l3 cdm is too complicated for you and you don't trust the exe, just drop a txt file with all your videos from that site that you want downloaded and I can generate the download commands for you.

    Edit: Here is the download command for your video https://eurovisionsport.com/mediacard/EVS_240612_F_20240707EARome_64

    Code:
    N_m3u8DL-RE "https://evs-ltcu-dash-secure2.akamaized.net/out/v1/6244d2cd22eb4747b82521d44c4e282d/a44b11c8e63146eda52561238d4f2551/547a9906db0d477e9db4ba67ce28f69c/manifest.mpd" --key 2abdaacb56d249839e7650415c5c1423:d93ebeb8c85b889f14aa1a0725e55812 --save-dir "media\eurovisionsport_com" --save-name "EXCLUSIVE_-_Long_Jump_Women_Final" -M format=mkv --check-segments-count false
    Last edited by 2nHxWW6GkN1l916N3ayz8HQoi; 17th Jun 2024 at 03:11.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  21. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Originally Posted by EV Downloads View Post
    Hi.
    I have been trying to download videos from Eurovision sport, but have failed so far. Earlier, it was easy when they were posting content on Allathletics.tv website.
    If you intend to use my script for eurovision sport I advise you to use the updated version of it which can be found here.
    https://forum.videohelp.com/threads/414548-drm-free-content-downloader-widefrog#post2735651
    This site is currently supported.

    If Python or l3 cdm is too complicated for you and you don't trust the exe, just drop a txt file with all your videos from that site that you want downloaded and I can generate the download commands for you.

    Edit: Here is the download command for your video https://eurovisionsport.com/mediacard/EVS_240612_F_20240707EARome_64

    Code:
    N_m3u8DL-RE "https://evs-ltcu-dash-secure2.akamaized.net/out/v1/6244d2cd22eb4747b82521d44c4e282d/a44b11c8e63146eda52561238d4f2551/547a9906db0d477e9db4ba67ce28f69c/manifest.mpd" --key 2abdaacb56d249839e7650415c5c1423:d93ebeb8c85b889f14aa1a0725e55812 --save-dir "media\eurovisionsport_com" --save-name "EXCLUSIVE_-_Long_Jump_Women_Final" -M format=mkv --check-segments-count false

    Thanks for your reply.

    This is something that I would need to learn because I am going to keep needing it.

    I downloaded your widefrog application but it keeps crashing.

    With download command link you provided, I assume I am gonna need this : https://www.videohelp.com/software/N-m3u8DL-RE

    But even that application does not run; it crashes.
    Quote Quote  
  22. Originally Posted by aqzs View Post
    Originally Posted by EV Downloads View Post
    Now, I run : C:\Users\***\OneDrive\Desktop>python eurovision_download.py
    I get the error : python: can't open file 'C:\\Users\\***\\OneDrive\\Desktop\\eurovision_dow nload.py': [Errno 2] No such file or directory
    I would be grateful if someone could help.
    The error you get is related to the path of the file and not the script. Open a cdm in the folder 'C:\Users\***\OneDrive\Desktop\' type 'dir' to list file and make sure the download script is in the folder.
    I changed the location of the file, made sure file exists at the location using dir command, and it is there.

    I am not sure why it keeps saying the no such file or directory.
    Quote Quote  
  23. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by EV Downloads View Post
    But even that application does not run; it crashes.
    That's not really my issue. If you can't get N_m3u8DL-RE for a basic command to work, then you're stuck. You need to install N_m3u8DL-RE and all its dependencies (ffmpeg, mp4decrypt, etc). It was detailed in the post or you can search the forum.

    It's been explained lots of times. All you have to do is read. If for some reason N_m3u8DL-RE doesn't work on its own (either you have a dubious OS or 32 bit architecture), someone can download the videos and upload them somewhere for you.

    Edit: on second thought if you do have 32 bit architecture, yt-dlp+mp4decrypt might be better since you have the mpd and the keys.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  24. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Originally Posted by EV Downloads View Post
    But even that application does not run; it crashes.
    That's not really my issue. If you can't get N_m3u8DL-RE for a basic command to work, then you're stuck. You need to install N_m3u8DL-RE and all its dependencies (ffmpeg, mp4decrypt, etc). It was detailed in the post or you can search the forum.

    It's been explained lots of times. All you have to do is read. If for some reason N_m3u8DL-RE doesn't work on its own (either you have a dubious OS or 32 bit architecture), someone can download the videos and upload them somewhere for you.

    Edit: on second thought if you do have 32 bit architecture, yt-dlp+mp4decrypt might be better since you have the mpd and the keys.
    I definitely have a 64 bit OS. That is not the problem. Not just one computer, I downloaded N_m3u8DL-RE on another computer, and the result was the same. A cmd window pops up but disappears instantly.
    I later downloaded ffmpeg and put them all together in the same folder ( don't know if that helps), clicked N_m3u8DL-RE, but again it was the same result.
    Maybe I am not doing it correctly. I didn't think downloading and running a CLI application would be my biggest challenge trying to do this.
    Quote Quote  
  25. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    Originally Posted by EV Downloads View Post
    I definitely have a 64 bit OS. That is not the problem. Not just one computer, I downloaded N_m3u8DL-RE on another computer, and the result was the same. A cmd window pops up but disappears instantly.
    I later downloaded ffmpeg and put them all together in the same folder ( don't know if that helps), clicked N_m3u8DL-RE, but again it was the same result.
    Maybe I am not doing it correctly. I didn't think downloading and running a CLI application would be my biggest challenge trying to do this.
    As you said it's a CLI, also know as "Command-line interface". Open a command prompt in the same folder as N_m3u8DL-RE and run the command by copy pasting 'N_m3u8DL-RE.exe ...' then typing enter key.
    Quote Quote  
  26. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by EV Downloads View Post
    Maybe I am not doing it correctly. I didn't think downloading and running a CLI application would be my biggest challenge trying to do this.
    Programs like N_m3u8, mkvmerge, ffmpeg, mp4decrypt, none of them come with GUI. When you double click it, it opens the CMD, it runs your command, then since it doesnt have "pause" it automatically closes the terminal. Those are programs meant to be executed with parameters from the command line. By double clicking it you arent even passing any parameters. Open cmd, go to your folder and use the tool with the command you want to download.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  27. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Originally Posted by EV Downloads View Post
    Maybe I am not doing it correctly. I didn't think downloading and running a CLI application would be my biggest challenge trying to do this.
    Programs like N_m3u8, mkvmerge, ffmpeg, mp4decrypt, none of them come with GUI. When you double click it, it opens the CMD, it runs your command, then since it doesnt have "pause" it automatically closes the terminal. Those are programs meant to be executed with parameters from the command line. By double clicking it you arent even passing any parameters. Open cmd, go to your folder and use the tool with the command you want to download.

    Ok. I think I know what to do now. I was assuming clicking the app would open a terminal where i would need to enter the command. I will download all other the applications and try this tomorrow. Thanks.
    Quote Quote  
  28. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by EV Downloads View Post
    Ok. I think I know what to do now. I was assuming clicking the app would open a terminal where i would need to enter the command. I will download all other the applications and try this tomorrow. Thanks.
    No problem. Pretty much all command line programs behave like this.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  29. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Originally Posted by EV Downloads View Post
    Ok. I think I know what to do now. I was assuming clicking the app would open a terminal where i would need to enter the command. I will download all other the applications and try this tomorrow. Thanks.
    No problem. Pretty much all command line programs behave like this.

    So, I have the video now, but there is no AUDIO. I thought the audio will start downloading after the video but the screen has been stagnant for sometime. I don't know if something is happening in the background. I have attached a pic of the screen:
    Image
    [Attachment 79974 - Click to enlarge]


    EDIT : Okay...I figured it out. Just needed to hit enter for the audio to start downloading.
    Last edited by EV Downloads; 18th Jun 2024 at 02:42.
    Quote Quote  
  30. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Originally Posted by EV Downloads View Post
    Ok. I think I know what to do now. I was assuming clicking the app would open a terminal where i would need to enter the command. I will download all other the applications and try this tomorrow. Thanks.
    No problem. Pretty much all command line programs behave like this.

    Trying to download this video :

    https://eurovisionsport.com/mediacard/EVS_240609_F_20240707EARome_34


    I used the following command :


    N_m3u8DL-RE "https://evs-ltcu-dash-secure2.akamaized.net/out/v1/9929bb36f9824ba093a01a2c3ef0cd3d/a44b11c8e63146eda52561238d4f2551/547a9906db0d477e9db4ba67ce28f69c/manifest.mpd" --key 2abdaacb56d249839e7650415c5c1423:d93ebeb8c85b889f1 4aa1a0725e55812 --save-dir "HighJump\eurovisionsport_com" --save-name "EXCLUSIVE_-_High_Jump_Women_Final" -M format=mkv --check-segments-count false


    I get an option of 5 streams like the Long Jump video I downloaded. I download this video the same way.

    But the final output is this:

    Image
    [Attachment 79986 - Click to enlarge]

    Image
    [Attachment 79987 - Click to enlarge]


    Something goes wrong after the video has been downloaded as evident in the messages given in the terminal. Not just this one, I downloaded a Pole Vault video before this and it had the same result.

    Am I giving the wrong command? I downloaded ffmpeg yesterday, i believe it is the latest. The long jump video downloaded fine.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!