pywidevine
Widevine CDM (Content Decryption Module) implementation in Python.
What it is and what it does
pywidevine is a Python implementation of Google's Widevine Content Decryption Module (CDM), a DRM system used to protect streaming video. It handles the cryptographic handshake required to acquire decryption licenses from Widevine-protected services: you provide a PSSH header (Protection System Specific Header), a device provision, and a license server URL, and the library generates a license challenge, parses the server's response, and extracts the content keys. It exposes both a programmatic API (Cdm, Device, PSSH classes) and a command-line interface.
The package depends on protobuf, pymp4, pycryptodome, click, requests, Unidecode, and PyYAML. It is designed for license acquisition only, not for the full CDM lifecycle (downloading, decrypting, and decoding content). The documentation explicitly warns that content keys and decrypted data are not secure in this Python implementation and that the package requires a valid Google-provisioned device provision to operate.
Use it for:
- Acquire Widevine licenses programmatically for testing or research on DRM-protected streaming services.
- Parse and convert PSSH headers to understand or debug DRM protection metadata in video files.
- Build a custom license server or proxy that intercepts and logs Widevine license requests.
- Automate license acquisition in a headless environment where a browser CDM is unavailable.
- Create or manage WVD provision files for testing or device emulation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Implements Widevine Content Decryption Module (CDM) functionality in Python, enabling license acquisition and key retrieval for DRM-protected content.
Yes, if you need Widevine license acquisition in Python and have a valid device provision. The package is stable, actively maintained (despite aging status), has no known vulnerabilities, and low install friction. However, the GPL-3.0 copyleft license is a hard blocker for proprietary projects, and you must obtain a Google-provisioned device provision separately—the package itself does not provide one. Evaluate your legal and licensing obligations before use.
Install
pywidevine on PyPI
pip
pip install pywidevineuv
uv add pywidevinepoetry
poetry add pywidevineInstalling pywidevine
Before you install
Low friction install via pip with a pure Python wheel. Maintenance status is aging—last commit was 291 days ago—but the repository remains active and not archived, with a stable production classifier and support for current Python versions.
License in practice
Licensed under GPL-3.0-only (copyleft). Any derivative work or distribution must also be open-source under GPLv3; proprietary or closed-source projects cannot incorporate this package without legal risk.
Quickstart
pip install pywidevine
from pywidevine.cdm import Cdm
from pywidevine.device import Device
from pywidevine.pssh import PSSH
device = Device.load("path/to/provision.wvd")
cdm = Cdm.from_device(device)
session_id = cdm.open()
pssh = PSSH("encoded_pssh_string")
challenge = cdm.get_license_challenge(session_id, pssh)
Requires a valid Google-provisioned Private Key and Client Identification blob (provision file) to function; public test provisions exist but may be blocked by production license servers.
Verify before relying
- Whether test provisions are reliably available or documented for evaluation without a production device.
- Performance characteristics when handling large-scale license requests or multiple concurrent sessions.
- Compatibility with specific DRM-protected streaming services beyond examples shown.
Package facts
| License | GPL-3.0-only (copyleft) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — protobuf, pymp4, pycryptodome, click, requests, Unidecode, PyYAML |
| Maintenance | aging — 291 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 128,405/month — #11,709 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pywidevine-1.9.0-py3-none-any.whl
Keywords: python, drm, widevine, google
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pyaesPure-Python implementation of AES encryption…
permissive · top 5,000 on PyPI
kasa-cryptProvides fast encryption and decryption…
permissive · top 15,000 on PyPI
python-gnupgProvides Python bindings to GnuPG for key…
permissive · top 5,000 on PyPI
pysequoiaPySequoia provides OpenPGP encryption,…
permissive · top 15,000 on PyPI
gmsslPure-Python implementation of SM2, SM3, and SM4…
permissive · top 15,000 on PyPI
pyAesCryptEncrypts and decrypts files and binary streams…
permissive · top 15,000 on PyPI
PGPy13PGPy13 is a Python library for OpenPGP…
permissive · top 15,000 on PyPI
pyragepyrage provides Python bindings to the Rust…
permissive · top 15,000 on PyPI
xxteaxxtea is a Python extension that implements the…
permissive · top 15,000 on PyPI
twofishProvides Python bindings to the Twofish block…
permissive · top 15,000 on PyPI