devine-dl/pywidevine

The license request succeeds with 200, but an exception of 'InvalidLicenseMessage' is thrown

Closed this issue · 2 comments

I am using a CDM dumped from my Xiaomi device, which works fine for various services. However, for a certain service, I am experiencing the issue mentioned in the title.

I am using disposable bearer tokens for this service, which I can generate on my own and which work properly, so I don't think there is an issue with the headers.

What should I do in this case?
.
.
The following is the response for the license:

'{"service_version_info":{"license_sdk_version":"17.0.1","license_service_version":"DRMtoday"},"supported_tracks":[{"type":"HD","key_id":"Q8eOvWDlSx+MIAvU8K44CQ=="}],"message_type":"LICENSE_REQUEST","status":"OK","license":"CAISiQMKXAogRkI3MTcxNzMwMDAwMDAwMDAxMDAwMDAwMDAwMDAwMDASJgoQPLpOHP3/S2q450lWhjqM/hABMhA6VmJ0Nfyg/h/6+aO8TxPwIAEoADjl/UhA5f1ISNG1rKEGEiIIARABGAAg5f1IKOX9SDDl/Ug4AEIASABQAFgAYAFwAHgAGmYSEAjdFgyJTJzU4FFEUqqU7nIaUG3PpL20gH8pXs5xKXEgFHAHUdNw+G8PHZBrHk9VI4SaPO0nCE2dvs+s72kQ1DlIjM3lEiB2xO8ppwXRYA6lf5CUOiwQptzlxz8+kPG739E7IAEalAEKEEPHjr1g5UsfjCAL1PCuOAkSEKNPXhmgNWGwksn2VEwboZUaIPBguUWx1+7/ys4zHNoI6LcFTecpab8hUvJXrK0i+z5GIAIoATIICAAQKhgAIAA6CAgAECoYACAAQjQKIIwlBSr23yYYmBxNtbfatK3uXtZ82m9ER5Tryl7JnEUxEhD+EYrd5QlDNzh8qhDJrWFIING1rKEGOAAaIA5YaN4hEbbkvgVbzcl+v5hvGMZ63X2eenSLJDoH6sJLIoACpY8LxEV2FRwtalxAnHHBru0zcTG06ZTKKt60bHonCw4LJl/RpNNuepQfdP4Kx7pYY1pobhj45/dPGP8/Zm6IAfnJT3aW0e+nC/e+dKsbE3aDg2NhclpNF7SlAtt+v+vkLpeualRb8AoXyAc5+iiGv1PAMtYxU2vduqg0jpx6nUyCFNllJ8H8BatBMvuvUqgLsfjo43hjuEeq3iscptm4ziJJ4e5Uta5p3ZHvUBVBJBJKZ/divJl22J/VFt5NG/ZSh8jZzw/SA963QS9Hogg3LK94pEn5pJNGTT4TXrNa1NTBRLjSVbkKaHJ4V+QQp3vjSRDnKwpyvPWssE6RkEPH+zoICgYxNy4wLjFAAVgA","platform":"android"}'

The following are the details of the exception:

Could not parse license_message as a SignedMessage, Error parsing message
google.protobuf.message.DecodeError: Error parsing message

During handling of the above exception, another exception occurred:

File "F:\getkeys.py", line 38, in
cdm.parse_license(session_id, licence.content)
pywidevine.exceptions.InvalidLicenseMessage: Could not parse license_message as a SignedMessage, Error parsing message
.
.
Lastly, thank you very much for developing such an amazing program!

You are providing the raw API response as the license, which woulde be that JSON data with all the other information. You need to parse the response as json licence.json() then provide the CDM the license key content, so licence.json()['license'] not licence.content.

Thank you for providing a clear answer! Thanks to you, I was able to parse the key! 😊