{"library":"pywidevine","title":"PyWidevine","description":"A Python implementation of the Widevine Content Decryption Module (CDM) for decrypting DRM-protected content. Version 1.9.0 supports Python 3.9–3.14. Regular releases, roughly quarterly.","language":"python","status":"active","last_verified":"Sat May 09","install":{"commands":["pip install pywidevine","pip install pywidevine[serve]"],"cli":null},"imports":["from pywidevine import Cdm","from pywidevine import PSSH","from pywidevine import Device"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pywidevine import Cdm, Device, PSSH\n\n# Load a Widevine device (WVD file)\ndevice = Device.load('path/to/device.wvd')\n\n# Create a CDM session\ncdm = Cdm()\nsession = cdm.open(device)\n\n# Set a service certificate (optional, for privacy mode)\ncert_data = b'...'  # your service certificate bytes\ncdm.set_service_certificate(session, cert_data)\n\n# Obtain a license challenge from a PSSH box\npssh = PSSH(pssh='AAAAWnBzc2gAAAAA...')\nchallenge = cdm.get_license_challenge(session, pssh)\n\n# Send the challenge to your license server, get license response\nlicense_response = b'...'  # bytes from server\ncdm.parse_license(session, license_response)\n\n# Extract content keys\nfor key in cdm.get_keys(session):\n    print(f'{key.type}: {key.kid.hex} -> {key.key.hex()}')\n\ncdm.close(session)\n","lang":"python","description":"Basic usage: load a device, open session, get license challenge, parse response, print keys.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}