skillfed

pywidevine

Widevine CDM (Content Decryption Module) implementation in Python.

pywidevine v1.9.0 128.4K downloads/30d#11,709 on PyPI911
Copyleft license GPL-3.0-only AGING released

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 pywidevine

uv

uv add pywidevine

poetry

poetry add pywidevine

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: End Users/DesktopLicense :: OSI Approved :: GNU General Public License v3 (GPLv3)Natural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Multimedia :: VideoTopic :: Security :: CryptographyTopic :: Software Development :: Libraries :: Python Modules

Tags

widevine cdm pythondrm license acquisitioncontent decryption modulewidevine key extractionpssh parsing drmlicense challenge handlingdrm protected video
drmwidevinecryptography

More Python Modules packages