VideoHelp Forum

+ Reply to Thread
Results 1 to 18 of 18
Thread
  1. Member
    Join Date
    Jun 2023
    Location
    Germany
    Search Comp PM
    Hello,

    i was able to learn myself which tools i need to download videos and get the relevant informations to decrypt videos. My first try with success was joyn.de, but i fail with https://dmax.de/. Im trying to get https://dmax.de/sendungen/helden-der-landwirtschaft, the first episode.

    I already have video/audio, the pssh and license url. Im trying to get the keys with cdrm-project, but the license url is special.

    URL: https://discovery-eur.conax.cloud/widevine/license
    PSSH: AAAAYXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAEEIARIQUs BsehxxQoCbpD8dxkKnShoFQ29uYXgiJDAwMDAwM2U5LWM1OTUt MzRiYS0yNTQ1LWVlZDMwZTMxZWI0ZQ==


    But they use a special header request, i dont understand. Without the right request, i get:

    Code:
    Error 500: {"status":"UNGRANTED_REQUEST","code":500,"errorCode":6001,"message":"Internal error"}
    header:
    Code:
    OPTIONS /widevine/license HTTP/2
    Host: discovery-eur.conax.cloud
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0
    Accept: */*
    Accept-Language: de,en-US;q=0.7,en;q=0.3
    Accept-Encoding: gzip, deflate, br
    Access-Control-Request-Method: POST
    Access-Control-Request-Headers: content-type,preauthorization
    Referer: https://dmax.de/
    Origin: https://dmax.de
    DNT: 1
    Connection: keep-alive
    Sec-Fetch-Dest: empty
    Sec-Fetch-Mode: cors
    Sec-Fetch-Site: cross-site
    Sec-GPC: 1
    How to put this correct in cdrm?

    Thanks
    Quote Quote  
  2. from lic url copy auth data and paste on headers

    key
    Code:
    b40681515c11459893a26fc1d6aa1e06:83879c2fb33e05eaf7ce5b3e8d43860f
    cdrm-project does not work because isn't in your country
    so, add proxy or use python and your own cdm
    Last edited by lomero; 4th Jun 2023 at 08:15.
    Quote Quote  
  3. Member
    Join Date
    Dec 2021
    Location
    england
    Search PM
    Code:
    --key 52c06c7a1c7142809ba43f1dc642a74a:555c0929482f40ef16d04db175096a16

    cdrm:


    Last edited by iamghost; 4th Jun 2023 at 08:38.
    Quote Quote  
  4. Member
    Join Date
    Jun 2023
    Location
    Germany
    Search Comp PM
    Thanks both of you, but i do something wrong. I get the same key as iamghost, but my video doesnt play.

    I decrypt and use
    Code:
    ffmpeg.exe -i video_dec.mp4 -i audio_dec.mp4 -c copy final.mp4
    but ffmpeg say
    Code:
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00000254df04ea00] Incorrect number of samples in encryption info
    video_dec.mp4: Invalid data found when processing input
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00000254df26ff00] Incorrect number of samples in encryption info
    audio_dec.mp4: Invalid data found when processing input
    Im wondering, should it possible to play the decrypted files on their own? I can play them, but video without picture and audio without sound.
    Last edited by DLH007; 4th Jun 2023 at 09:25.
    Quote Quote  
  5. For the first Episode, use key found by Lomero

    Code:
    b40681515c11459893a26fc1d6aa1e06:83879c2fb33e05eaf7ce5b3e8d43860f
    Quote Quote  
  6. Member
    Join Date
    Jun 2023
    Location
    Germany
    Search Comp PM
    Oh thanks, i overlooked the key from lomero. But why does @iamghost have a different key?

    Video works now, now i have to learn how to get the keys myself.
    Quote Quote  
  7. I suppose that iamghost had found a key for another episode
    Quote Quote  
  8. Member
    Join Date
    Dec 2021
    Location
    england
    Search PM
    Originally Posted by cedric8528 View Post
    I suppose that iamghost had found a key for another episode
    my key is for Episode 1, other key is for episode 9 i check
    Code:
    ep01 --key 52c06c7a1c7142809ba43f1dc642a74a:555c0929482f40ef16d04db175096a16
    ep02 --key 4cb4da8ed2aa4d23869c126d7c29ebce:5338e3936346f5c9b32ec9626e9e9759
    ep03 --key 5e7d912d7ed54878a2b4c61e55ee74c3:ef89b44fd9adc4ae56e2452f8e81e586
    ep04 --key 227e35f27a1044cfb6a4a421e8881547:c2713feaf89bff34a8edf7ac69c7dbcd
    ep05 --key e194c806923a4d14982aa659e9acd953:f0fa382687ec66db0624d5fb4a40428b
    ep06 --key 0c782f96895744e3b706b293605f3af6:4b007fc878d3ab4825bd30d21350f13b
    ep07 --key a91da3101d394a2ba9e534fb483902d8:40d61263875fd828b35eb4c2ed1fd686
    ep08 --key e4cc1e58ea584a948756659f3f156edc:f056bba203cfbf5b374c0e96ecc7be78
    ep09 --key b40681515c11459893a26fc1d6aa1e06:83879c2fb33e05eaf7ce5b3e8d43860f
    Last edited by iamghost; 4th Jun 2023 at 10:46. Reason: add
    Quote Quote  
  9. Sorry iamghost....wrong PSSH for me (from EP9)

    So this is the good key

    Try with N_m3u8DL-RE

    Code:
    N_m3u8DL-RE --key 52c06c7a1c7142809ba43f1dc642a74a:555c0929482f40ef16d04db175096a16 "https://dplaydk-prod-vod.akamaized.net/f174c974-1d7d-4bda-816c-a9ab77aa8460/dash_widevinePlayready_fmp4/hdntl=exp=1685980655~acl=/f174c974-1d7d-4bda-816c-a9ab77aa8460/dash_widevinePlayready_fmp4/*~data=hdntl~hmac=9cb5bd9f3387338ef95ef30a7f3c4848ac6e4665e8554ae65d2433a3a41fc22e/master.mpd" -M format=mp4
    Put mp4decrypt and ffmpeg in the same folder
    Quote Quote  
  10. Member
    Join Date
    Jun 2023
    Location
    Germany
    Search Comp PM
    I miss the like button for posts .

    Thank you very much.

    @cedric, this information in code box a very useful
    Last edited by DLH007; 4th Jun 2023 at 12:10. Reason: wrong informations
    Quote Quote  
  11. Member
    Join Date
    Jun 2023
    Location
    Germany
    Search Comp PM
    Now i have own CDM, using l3.py and input pssh and lic url, give error

    Code:
    unable to parse license - check protobufs
    Maybe wrong header? Any advice?

    device_client_id_blob and device_private_key are from android studio pixel 6.
    Quote Quote  
  12. Member
    Join Date
    Dec 2021
    Location
    england
    Search PM
    no need all in header.py
    look highlight on the right side,copy this in header.py (left side)
    Quote Quote  
  13. Member
    Join Date
    Jun 2023
    Location
    Germany
    Search Comp PM
    Still the same error .
    Maybe my CDM-Files are blacklisted?
    Quote Quote  
  14. Member
    Join Date
    Jun 2023
    Location
    Germany
    Search Comp PM
    Its working now, have used wrong combination from pssh and preauthorization.

    I like the forum, people are very helpful
    Quote Quote  
  15. all pages available this button "Alle Videos zur Sendung"
    this makes all the video links visible and makes it easier to automate the process

    Image
    [Attachment 71496 - Click to enlarge]


    Code:
    from pywidevine.L3.cdm import cdm, deviceconfig
    from base64 import b64encode
    from pywidevine.L3.decrypt.wvdecryptcustom import WvDecrypt
    
    m3u8DL_RE = 'N_m3u8DL-RE.exe'
    
    from pathlib import Path
    import requests
    import subprocess
    import re
    import os
    
    files_to_delete = ["key.txt"]
    for file_name in files_to_delete:
        if os.path.exists(file_name):
            os.remove(file_name)
            print(f"{file_name} file successfully deleted.")
    
    print(f'\ntest link: https://dmax.de/sendungen/caravaning-cooking-brian-auf-grosser-tour/ein-bisschen-sudpol-in-europa\ntest link: https://dmax.de/sendungen/tattoo-edition-engelhard/episode-1\n')
    
    link = input('link: ')
    link_slug = re.findall(r'sendungen/(.*)/', link)[0].strip()
    ep_id = re.findall(r'.*/(.*)$', link)[0].strip()
    
    import requests
    
    headers00 = {
        'authority': 'eu1-prod.disco-api.com',
        'content-type': 'application/json',
        'origin': 'https://dmax.de',
        'referer': 'https://dmax.de/',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
        'x-device-info': 'STONEJS/1 (Unknown/Unknown; Unknown/Unknown; Unknown)',
        'x-disco-client': 'Alps:HyogaPlayer:0.0.0',
        'x-disco-params': 'realm=dmaxde',
    }
    
    params00 = {
        'realm': 'dmaxde',
    }
    
    response00 = requests.get('https://eu1-prod.disco-api.com/token', params=params00, headers=headers00).json()
    
    bear = 'Bearer '
    auth_tok = bear+response00['data']['attributes']['token']
    
    import requests
    
    headers01 = {
        'authority': 'de-api.loma-cms.com',
        'origin': 'https://dmax.de',
        'referer': 'https://dmax.de/',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
    }
    
    params01 = {
        'filter[show.slug]': link_slug,
        'environment': 'dmax',
        'v': '2',
    }
    
    response01 = requests.get('https://de-api.loma-cms.com/feloma/videos/'+ep_id+'/', params=params01, headers=headers01).json()
    
    videoId = response01['blocks'][0]['videoId']
    
    def format_episode_number(number):
        number_str = str(number)
        if len(number_str) == 1:
            return '0' + number_str
        return number_str
    
    show_title = response01['blocks'][0]['item']['show']['title']
    seasonNumber = response01['blocks'][0]['item']['seasonNumber']
    episodeNumber = response01['blocks'][0]['item']['episodeNumber']
    episodetitle = response01['blocks'][0]['item']['title']
    
    zerofill_seasonNumber = format_episode_number(seasonNumber)
    zerofill_episodeNumber = format_episode_number(episodeNumber)
    
    title = f'{show_title} - S{zerofill_seasonNumber}E{zerofill_episodeNumber} - {episodetitle}'
    
    def replace_illegal_chars(title):
        illegal_chars = r'[<>:"/\\|?*\']'
        return re.sub(illegal_chars, '', title)
    
    a_title = replace_illegal_chars(title)
    print(f'\n{a_title}\n')
    
    import requests
    
    headers02 = {
        'authority': 'eu1-prod.disco-api.com',
        'authorization': auth_tok,
        'content-type': 'application/json',
        'origin': 'https://dmax.de',
        'referer': 'https://dmax.de/',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
    }
    
    json_data02 = {
        'deviceInfo': {
            'adBlocker': False,
            'drmSupported': True,
            'hdrCapabilities': [
                'SDR',
            ],
            'hwDecodingCapabilities': [],
            'soundCapabilities': [
                'STEREO',
            ],
        },
        'wisteriaProperties': {},
        'videoId': f'{videoId}',
    }
    
    response02 = requests.post('https://eu1-prod.disco-api.com/playback/v3/videoPlaybackInfo', headers=headers02, json=json_data02).json()
    
    drmToken = response02['data']['attributes']['streaming'][0]['protection']['drmToken']
    dashUrl = response02['data']['attributes']['streaming'][0]['url']
    
    import requests
    
    headers03 = {
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
        'Connection': 'keep-alive',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36',
    }
    
    response03 = requests.get(dashUrl, headers=headers03).text
    
    pssh = re.findall(r'<cenc:pssh>(.{20,170})</cenc:pssh>', response03)[0].strip()
    print(f'{pssh}\n')
    
    lic_url = 'https://discovery-eur.conax.cloud/widevine/license'
    
    headers = {
        'authority': 'discovery-eur.conax.cloud',
        'content-type': 'application/octet-stream',
        'origin': 'https://dmax.de',
        'preauthorization': drmToken,
        'referer': 'https://dmax.de/',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
    }
    
    def WV_Function(pssh, lic_url, cert_b64=None):
        wvdecrypt = WvDecrypt(init_data_b64=pssh, cert_data_b64=cert_b64, device=deviceconfig.device_android_generic)                   
        widevine_license = requests.post(url=lic_url, data=wvdecrypt.get_challenge(), headers=headers)
        license_b64 = b64encode(widevine_license.content)
        wvdecrypt.update_license(license_b64)
        Correct, keyswvdecrypt = wvdecrypt.start_process()
        if Correct:
            return Correct, keyswvdecrypt
    Correct, keys = WV_Function(pssh, lic_url)
    
    st=''
    for key in keys:
      st+=' --key '+key
    with open("key.txt","a+") as f:
      f.write(st[1:]+'\n')
    
    with open("key.txt", "r") as f2:
        datas = f2.read()
        print(datas)
    
    with open("key.txt", "r") as fs:
     ke_ys = fs.readlines()
     ke_ys = ke_ys[0].strip().split()   
    
    subprocess.run([m3u8DL_RE,
                    '-M', 'format=mkv:muxer=ffmpeg',
                    '--concurrent-download',
                    '--auto-select', 
                    '--del-after-done',
                    '--log-level', 'INFO',
                    '--save-name', 'video',
                    dashUrl, *ke_ys])
    
    try:
        Path('video.mkv').rename(''+a_title+'.mkv')
        print(f'{a_title}.mkv \nall done!\n')
    except FileNotFoundError:
        print("[ERROR] no mkv file")                
    
    for file_name in files_to_delete:
        if os.path.exists(file_name):
            os.remove(file_name)
            print(f"{file_name} file successfully deleted.")
    Quote Quote  
  16. Member
    Join Date
    Jun 2023
    Location
    Germany
    Search Comp PM
    Hello sk8ordi3,

    i dont know how to use this script. I am a complete newbie at python.
    Quote Quote  
  17. Originally Posted by DLH007 View Post
    Hello sk8ordi3,

    i dont know how to use this script. I am a complete newbie at python.
    copy the whole code into a text editor
    save it as e.g.
    something.py

    then put it in the folder where you have the l3.py file

    to run: (double click)
    something.py

    you will also need these exe's in the same folder:
    N_m3u8DL-RE.exe
    ffmpeg.exe
    mp4decrypt.exe
    Quote Quote  
  18. Member
    Join Date
    Jun 2023
    Location
    Germany
    Search Comp PM
    Wow

    what a great script, thats nice and easy

    Thank you very much
    Last edited by DLH007; 9th Jun 2023 at 16:33.
    Quote Quote  



Similar Threads