github devine-dl/pywidevine v1.4.0

latest releases: v1.8.0, v1.7.0, v1.6.0...
2 years ago
  • Supported Serve API: v1.4.0 to v1.4.2

Added

  • New PSSH boxes can now be manually crafted with PSSH.new().
    • The box can be crafted from arbitrary init_data and/or key_ids.
    • If only key_ids is supplied a new Widevine CENC Header will be created and the key IDs will be put into it.
    • This allows you to make compliant v0 or v1 boxes with as little data as just a Key ID.
  • PSSH boxes can now be exported as MP4 Box objects using pymp4 with PSSH.dump().
  • PSSH boxes can now also be exported as Base64 strings with PSSH.dumps().
  • License Keys can now be obtained from a Cdm session with a parsed license using Cdm.get_keys().
    • This is the alternative to manually accessing the keys from the Cdm._sessions object.
    • It is also available on the Serve API through the new /get_keys endpoint.

Changed

  • PSSH.get_as_box() has been merged into the PSSH constructor, simplifying usage of the PSSH class.
  • PSSH.from_playready_pssh() is now a class method and returns as a PSSH object.
  • Only PSSH objects are now accepted by Cdm.get_license_challenge().
    • You can no longer provide it anything else, that includes base64 or bytes form.
    • You should first parse or make a new PSSH with the PSSH class, and then pass that object.
    • This is to simplify typing and repetition across the codebase.
  • Serve's /challenge endpoint has been changed to /get_license_challenge, and /keys to /parse_license.
    • This is to be consistent with the method names of the underlying Cdm class.
  • Serve now passes the license type value as-is (as a string) instead of parsing it to an integer.
  • Serve now passes the key type value as-is (as a string) instead of parsing it to an integer.
  • Serve no longer returns license keys in the response of the /parse_license endpoint.
    • Once parsed, the /get_keys endpoint should be used to retrieve keys.
  • Privatized the Cdm._sessions class instance variable even more to Cdm.__sessions.
    • If you still need something from it, while not advised, you can call it via cdm._Cdm__sessions.

Removed

  • PSSH.from_key_ids() has been removed entirely, you should now use PSSH.new(key_ids=...) instead.
  • Unnecessary parsing of the license message received by RemoteCdm is now skipped. Parsing should be done by the Serve
    API as it will be able to actually decrypt and verify the message.
  • All uses of a local Session object has been removed from RemoteCdm. The session is now fully controlled by the
    remote API and de-synchronization by external alteration or unexpected exceptions is no longer a possibility.

Fixed

  • Correct the WidevinePsshData proto field name from key_id to key_ids in the PSSH class.
  • Handle DecodeError and SignatureMismatch exceptions in the Serve /set_service_certificate endpoint.
  • Handle InvalidInitData and InvalidLicenseType exceptions in the Serve /get_license_challenge endpoint.
  • Handle various exceptions in the Serve /parse_license endpoint.
  • Handle various client-side runtime errors in RemoteCdm with improved error handling.

Don't miss a new pywidevine release

NewReleases is sending notifications on new releases.