VideoHelp Forum




+ Reply to Thread
Results 1 to 7 of 7
  1. need video link to get lic url, mpd only isn't enough ...
    Quote Quote  
  2. look for "auth" in the network tab
    On the results, select the URL with the 'GET' Method

    Look at the headers, you sould have something like
    "authorization : Bearer something....."

    That's the header you need to use on cdrm-project

    If you look for 'Lic' in the network tab, you'll get the URL for the license field (that's the one with the ?expiry parameter")
    Quote Quote  
  3. 1448d7d0d17b4b7a83d8ff6aad4a57c8:3061128cbfa553a30 68d7b46cfcf25ab
    678df23e004aff417896b5a20b93931c:3061128cbfa553a30 68d7b46cfcf25ab
    Quote Quote  
  4. Code:
    1448d7d0d17b4b7a83d8ff6aad4a57c8:3061128cbfa553a3068d7b46cfcf25ab
    678df23e004aff417896b5a20b93931c:3061128cbfa553a3068d7b46cfcf25ab
    Quote Quote  
  5. Member
    Join Date
    Feb 2023
    Location
    Morocco
    Search PM
    Please anyone could help how to get license URL from this MPD can't find any I tried all combination lic auth DRM widevine...
    Quote Quote  
  6. Member
    Join Date
    Dec 2021
    Location
    Scotland
    Search Comp PM
    I'm not sure what the problem is. CH5 is one of the easy ones (although shit quality). Play the video. Filter for mpd. Part way through the first advert you get the mpd. Stop the video. Filter for licence (or just lic). The licence is the one beginning with C
    Typical for S01E01 of Aerial Argentina:
    mpd:
    https://akadash0.akamaized.net/cenc/C5447020001/C5447020001A/20221205181445/C5447020001A-tt.mpd

    licence
    https://cassie.channel5.com/api/v2/licences/widevine/332/C5447020001?expiry=1676717731...63323264613963

    Here's my script for CH5 (also good for UKTV). It's designed to be used within WKS-KEYS folder, but you don't need the headers.py
    Code:
    #### version 20230205-1
    
    import os
    import base64
    import requests
    from pywidevine.L3.cdm import deviceconfig
    from base64 import b64encode
    from pywidevine.L3.decrypt.wvdecryptcustom import WvDecrypt
    import shutil
    import glob
    
    ##########useful when used within VS Code to tell it which directory you're in
    abspath = os.path.abspath(__file__)
    dname = os.path.dirname(abspath)
    os.chdir(dname)
    ##########
    
    headers = {
        'Accept': '*/*',
        'Accept-Language': 'en-GB,en;q=0.9',
        'Connection': 'keep-alive',
    }
    
    def cls():
        # posix is os name for Linux or mac
        if(os.name == 'posix'):
            os.system('clear')  # clear is the bash command
        # else screen will be cleared for windows (os name is actually nt for Windows)
        else:
            os.system('cls')  # cls is the batch command
    
    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=None)
        license_b64 = b64encode(widevine_license.content)
        wvdecrypt.update_license(license_b64)
        Correct, keyswvdecrypt = wvdecrypt.start_process()
        if Correct:
            return keyswvdecrypt
    
    def generate_pssh(mpd):
        division = mpd.split("cenc:pssh")
        for i in division:
            if i[1:5] == "AAAA":
                break
    
        pssh = i[1:-2]
        print(f"PSSH is {pssh}")
        return pssh
    
    def filename():
        output_name = input("What do you want to call your final file? (do not include file .extension like .mp4) ")
        output_name = f"{output_name}.mp4"
        path = f"./Completed/{output_name}"
        # look to see if duplicate filename
        if os.path.isfile(path):
            print(f"\nyou already have a file called {output_name}. Choose another name\n")
            return filename()
        #look to see if any illegal characters in filename
        illegals = "@$%\/:*?\"<>|~`#^+=\{\};!"
        any_illegals = (set(output_name) & set(illegals))
        if not any_illegals:
            return output_name
        else:
            list_illegals = ' '.join(any_illegals)
            print(f"\nyou have included the following which are not legal characters:       {list_illegals}\n")
            return filename()
    
    
    cls()
    mpd_url = input("enter mpd URL: ")
    lic_url = input("\nenter licence URL: ")
    
    mpd = requests.get(mpd_url, headers = headers).text
    
    pssh = generate_pssh(mpd)
    
    #get KEY
    keys = WV_Function(pssh, lic_url)
    print("KID:KEY found is " + (keys[0]))
    keys = str(keys[0])
    division = keys.find(":")
    key = (keys[division+1:])
    print(f"   KEY# is {key}")
    
    print("\n\n")
    
    os.system(f'yt-dlp --allow-u -f bestvideo -N 6 "{mpd_url}" -o encryptVid.mp4')
    os.system(f'yt-dlp --allow-u -f bestaudio -N 6 "{mpd_url}" -o encryptAud.m4a')
    
    
    print("==============================\n\n Decrypting\n\n==============================")
    
    os.system(f"mp4decrypt --show-progress --key 1:{key} encryptVid.mp4 video_decrypt.mp4")
    os.system(f"mp4decrypt --show-progress --key 1:{key} encryptAud.m4a audio_decrypt.m4a")
    
    if not os.path.exists("Throwaway"):
        os.makedirs("Throwaway")
    
    if not os.path.exists("Completed"):
        os.makedirs("Completed")
    
    cls()
    print("\n\n\n")
    
    output_name = filename()
    
    os.system(f"ffmpeg -i video_decrypt.mp4  -i audio_decrypt.m4a -c:v copy -c:a copy mux_file.mp4")
    os.rename("mux_file.mp4", f'{output_name}')
    
    shutil.move(f'{output_name}', "./Completed")
    
    for data in glob.glob("*_decrypt*.*"):
        shutil.move(data,"./Throwaway")
    for data in glob.glob("encrypt*.*"):
        shutil.move(data,"./Throwaway")
    shutil.rmtree("./Throwaway")
    
    print(f"All done.\n\n Your final file '{output_name}' is in 'Completed' folder")
    Quote Quote  



Similar Threads

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