devine-dl / pywidevine

Python implementation of Google's Widevine DRM CDM (Content Decryption Module)
GNU General Public License v3.0
534 stars 118 forks source link

Could not parse license message #50

Open captaindooley opened 5 months ago

captaindooley commented 5 months ago

I fully admit, I'm out of my depth here, but I have my CDM and wvd file, I know where to find PSSH and the licensing URL, and I was successfully able to pull keys from bitmovin and tg4.ie as tests... but when I went to pull from a live site I wanted the video from I got a "Could not parse license_message as a SignedMessage, Error parsing message" response.

I also noticed that the PSSH value was MUCH longer than both of my test sites...

What am I doing wrong?

Full response here:

INFO:root:pywidevine version 1.8.0 Copyright (c) 2022-2024 rlaphoenix
INFO:root:https://github.com/devine-dl/pywidevine
INFO:license:[+] Loaded Device (7283 L3)
INFO:license:[+] Loaded CDM
INFO:license:[+] Opened CDM Session: 2438e9eb69e80503839dbad22c8e3282
INFO:license:[+] Created License Request Message (Challenge)
INFO:license:[+] Got License Message
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pywidevine/cdm.py", line 407, 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 "/Library/Frameworks/Python.framework/Versions/3.12/bin/pywidevine", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pywidevine/main.py", line 116, in license_
    cdm.parse_license(session_id, licence)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pywidevine/cdm.py", line 411, 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
ApeDevOne commented 3 months ago

Common wv won't work on crunchyroll. Crunchyroll uses DRMtoday. Wks-keys had code for DRMtoday. Try finding it.