VideoHelp Forum
+ Reply to Thread
Results 1 to 11 of 11
Thread
  1. Member
    Join Date
    Dec 2020
    Location
    Croatia
    Search PM
    Link:

    Code:
    https://mubi.com/en/es/films/the-national-shotgun
    I can't seem to get a key for this, I don't know what I'm missing.

    Is this the right PSSH:
    Code:
    AAAAMnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABISEBGr2TtlgUfZnETAg3Gy4Gw=
    And is this the right license:
    Code:
    https://lic.drmtoday.com/license-proxy-widevine/cenc/
    Maybe it's the custom data but I'm using the same one that passes in Chrome (and I have reloaded the video 10 times and it's always been the same one so I don't think it has an expiration?)

    Anyway, if someone can get me the key I'd be grateful.
    Quote Quote  
  2. You need to use custom data as only header, and append a missing section to the license:

    Code:
    headers = {
        "Dt-Custom-Data": "TOKEN",
    }
    License:
    Code:
    https://lic.drmtoday.com/license-proxy-widevine/cenc/?SpecConform=True
    Quote Quote  
  3. Member
    Join Date
    Dec 2020
    Location
    Croatia
    Search PM
    Originally Posted by stabbedbybrick View Post
    You need to use custom data as only header, and append a missing section to the license:

    Code:
    headers = {
        "Dt-Custom-Data": "TOKEN",
    }
    License:
    Code:
    https://lic.drmtoday.com/license-proxy-widevine/cenc/?SpecConform=True
    no dice, still getting an error. a different one, though:

    Code:
    Traceback (most recent call last):
      File "D:\Utilities\WEB-DL-Tools\Skidatelj\.venv\lib\site-packages\pywidevine\cdm.py", line 388, in parse_license
        signed_message.ParseFromString(license_message)
    google.protobuf.message.DecodeError: Error parsing message
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "D:\Utilities\WEB-DL-Tools\Skidatelj\keys.py", line 11, in <module>
        keys = get_keys(
      File "D:\Utilities\WEB-DL-Tools\Skidatelj\helpers\cdm.py", line 29, in get_keys
        cdm.parse_license(session_id, licence.content)
      File "D:\Utilities\WEB-DL-Tools\Skidatelj\.venv\lib\site-packages\pywidevine\cdm.py", line 392, in parse_license
        raise InvalidLicenseMessage(f"Could not parse license_message as a SignedMessage, {e}")
    pywidevine.exceptions.InvalidLicenseMessage: Could not parse license_message as a SignedMessage, Error parsing message
    Quote Quote  
  4. Invalid LicenseMessage is probably caused by the response being in something other than bytes or b64, most likely JSON. I don't have access to Mubi so I can't check, but if you print out the response.content, you'll see what the response looks like and be able to handle it properly.
    Quote Quote  
  5. your key

    Code:
    11abd93b658147d99c44c08371b2e06c:eca26cc41a7d5f8176c8645bb0d105d4
    my headers

    Image
    [Attachment 77100 - Click to enlarge]
    Quote Quote  
  6. Member
    Join Date
    Dec 2020
    Location
    Croatia
    Search PM
    thanks cedric

    Originally Posted by stabbedbybrick View Post
    Invalid LicenseMessage is probably caused by the response being in something other than bytes or b64, most likely JSON. I don't have access to Mubi so I can't check, but if you print out the response.content, you'll see what the response looks like and be able to handle it properly.
    Here's the content:
    Code:
    {
       "service_version_info":{
          "license_sdk_version":"18.1.2",
          "license_service_version":"DRMtoday"
       },
       "supported_tracks":[
          {
             "type":"HD",
             "key_id":"DBEA9NrSQWaslDO3MffFQg=="
          }
       ],
       "message_type":"LICENSE_REQUEST",
       "status":"OK",
       "license":"CAIShAMKTgogMDNFOUQ2NzgwMDAwMDAwMDAxMDAwMDAwMDAwMDAwMDASJgoQLNAfLnfgQfCTPyh02lvy5BABMhA6VmJ0Nfyg/h/6+aO8TxPwIAEoABInCAEQARgAIICangEogMYKMIDgqAE4AEIASABQAFgAYAFwAHgBgAEAGmYSEJ6w287A9zPZtBCMCCnKG/waUFAUgmcJUe1BgaexDIPds8I36AyZGsG+M3CrzW+x4Df4lDiU2Q2dUkXaMHoXv/W7SBi6ib9wXu9S5nySmdERZN5NsrsbBkzSE1Dh94lJm9Z/IAEamAEKEAwRAPTa0kFmrJQztzH3xUISEOsNoOde3QVCDZGGnh7XsmsaINRJICODDZFwk6OFI5otUD+pFdTu7GxfuXcW/vYEHes/IAIoATIICAAQKhgAIAA6CAgAECoYACAAQjQKIF1xhtjiWYz830cgyfoYp94jOSMsmxM1KopvAPWfRXapEhDZeVe9bNEZ2j5I8L5skWrrYgJIRCDYwMeuBjgAGiBc3icKH3zqRo6eccaTX5dgfSsfwOHRWJVRyaFfaXu+/CKAAh+Wn6S67qyorWbG5ryV+OuHfsOm/cKgttCTiFDs/NjS/SrI9/ske5EKp+ZlQ3ravPfyIcg7I9DOi23JI4DUpUIwX7vNWQAyLzKOZaH6oVwodZgTmCErFEdllvcsa1NlVP5UZ4CdQpNZn/pqEgVARBD+E4Qia2u4l3/1CZ0EDQ7yA5MnAZsXLf8Fi9ploGlGP/B0xqxmSK2zPpmVidmSicW/ygiUzenYV1ITKmVyZCoDIuarfj+xRYikvsZ6pA78jKqCRLUHCv7hArec4hBzC7/kmnEkGVGp51ohYmFIMFnKgG4hBj+IcjmGIZH53xZEnoHvUuOuhDjZFJzhSThPccw6CAoGMTguMS4yQAFYAA==",
       "platform":"android"
    }
    yeah, it's json (in a bytestring). am I supposed to extract the "license" property and put it in licence.content?


    EDIT: I think that's it.
    For whoever might also be having problems:
    when dealing with mubi and using pywidevine licence.content is a bytestring containing a JSON string. First you need to decode it to a string, then serialize it into an object or a dictionary, and finally take the "license" property which contains a string and send that string into the parse_license method instead of licence_content.
    Last edited by ampersand; 18th Feb 2024 at 05:16.
    Quote Quote  
  7. The "license" is the message you need to parse with cdm.parse_license:

    Code:
    cdm.parse_license(session_id, licence.json()["license"])
    Quote Quote  
  8. Originally Posted by cedric8528 View Post
    your key

    Code:
    11abd93b658147d99c44c08371b2e06c:eca26cc41a7d5f8176c8645bb0d105d4
    my headers

    Image
    [Attachment 77100 - Click to enlarge]

    How do you do that? I am even unable to find PSSH there.

    There is KID in the MPD, nothing more. There's no tool left to calculate PSSH from KID. And without PSSH, I end up with nothing.
    Quote Quote  
  9. Code:
    import base64
    
    def get_pssh(keyId):
        array_of_bytes = bytearray( b'\x00\x00\x002pssh\x00\x00\x00\x00')
        array_of_bytes.extend(bytes.fromhex("edef8ba979d64acea3c827dcd51d21ed"))
        array_of_bytes.extend(b'\x00\x00\x00\x12\x12\x10')
        array_of_bytes.extend(bytes.fromhex( keyId.replace("-", "")))
        return base64.b64encode(bytes.fromhex(array_of_bytes.hex()))
    
    kid = input("Please input KID in hex string: ")
    kid = kid.replace('-', '')
    assert len(kid) == 32 and not isinstance(kid, bytes), "wrong KID length"
    print("PSSH {}".format(get_pssh(kid).decode('utf-8')))
    Quote Quote  
  10. Originally Posted by ridibunda View Post
    There is KID in the MPD, nothing more. There's no tool left to calculate PSSH from KID. And without PSSH, I end up with nothing.
    A browser-based tool to generate a Widevine PSSH from a KID:

    https://emarsden.github.io/pssh-box-wasm/generate/
    Quote Quote  
  11. OK, it was an EME Logger error on my side.

    EME Logger didn't give me any init data at first.

    After fixing EME Logger, I got a long init data and found PSSH.
    Quote Quote  



Similar Threads

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