Skip to main content

pywidevine

Features

  • 🚀 Seamless Installation via pip
  • 🛡️ Robust Security with message signature verification
  • 🙈 Privacy Mode with Service Certificates
  • 🌐 Servable CDM API Server and Client with Authentication
  • 📦 Custom provision serialization format (WVD v2)
  • 🧰 Create, parse, or convert PSSH headers with ease
  • 🗃️ User-friendly YAML configuration
  • ❤️ Forever FOSS!

Installation

$ pip install pywidevine

Note If pip gives you a warning about a path not being in your PATH environment variable then promptly add that path then close all open command prompt/terminal windows, or pywidevine CLI won't work as it will not be found.

Voilà 🎉 — You now have the pywidevine package installed!
You can now import pywidevine in scripts (see below).
A command-line interface is also available, try pywidevine --help.

Usage

The following is a minimal example of using pywidevine in a script to get a License for Bitmovin's Art of Motion Demo.

from pywidevine.cdm import Cdm
from pywidevine.device import Device
from pywidevine.pssh import PSSH

import requests

# prepare pssh
pssh = PSSH("AAAAW3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADsIARIQ62dqu8s0Xpa7z2FmMPGj2hoNd2lkZXZpbmVfdGVzdCIQZmtqM2xqYVNkZmFsa3IzaioCSEQyAA==")

# load device
device = Device.load("C:/Path/To/A/Provision.wvd")

# load cdm
cdm = Cdm.from_device(device)

# open cdm session
session_id = cdm.open()

# get license challenge
challenge = cdm.get_license_challenge(session_id, pssh)

# send license challenge (assuming a generic license server SDK with no API front)
licence = requests.post("https://...", data=challenge)
licence.raise_for_status()

# parse license challenge
cdm.parse_license(session_id, licence.content)

# print keys
for key in cdm.get_keys(session_id):
    print(f"[{key.type}] {key.kid.hex}:{key.key.hex()}")

# close session, disposes of session data
cdm.close(session_id)

Note There are various features not shown in this specific example like:

  • Privacy Mode
  • Setting Service Certificates
  • Remote CDMs and Serving
  • Choosing a License Type to request
  • Creating WVD files
  • and much more!

Take a look at the methods available in the Cdm class and their doc-strings for further information. For more examples see the CLI functions which uses a lot of previously mentioned features.

Disclaimer

  1. This project requires a valid Google-provisioned Private Key and Client Identification blob which are not provided by this project.
  2. Public test provisions are available and provided by Google to use for testing projects such as this one.
  3. License Servers have the ability to block requests from any provision, and are likely already blocking test provisions on production endpoints.
  4. This project does not condone piracy or any action against the terms of the DRM systems.
  5. All efforts in this project have been the result of Reverse-Engineering, Publicly available research, and Trial & Error.

Licensing

This software is licensed under the terms of GNU General Public License, Version 3.0.
You can find a copy of the license in the LICENSE file in the root folder.

  • Widevine Icon © Google.
  • Props to the awesome community for their shared research and insight into the Widevine Protocol and Key Derivation.

© rlaphoenix 2022-2023 DevLARLEY 2025-2025

Metadata

Release files for pywidevinex 1.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywidevinex 1.8.3
File Size Uploaded
pywidevinex-1.8.3.tar.gz 63.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pywidevinex 1.8.3
File Interpreter ABI Platform
pywidevinex-1.8.3-py3-none-any.whl Python 3 none any Details

Total release size: 133.2 kB

Release files / pywidevinex-1.8.3.tar.gz

Download URL pywidevinex-1.8.3.tar.gz
Size 63.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7e299873b2197c6ffb6c65ea35cd3087e7c3d71d65bbf14040ec2e2166d4bcda
BLAKE2b-256 checksum
How to use checksums
d867a23bf01770f0d392e4dbe8624543234cebef6c794042085f92e9ef5a56c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / pywidevinex-1.8.3-py3-none-any.whl

Download URL pywidevinex-1.8.3-py3-none-any.whl
Size 70.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed559a24ce6ed92bb0d8be7c64354ad7cc031240ed4007710cbd324a4a5e9a91
BLAKE2b-256 checksum
How to use checksums
162dc3b1867e173a7464498168058d3530d584858d91e1b21c887bbb0f5c4d5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

1.8.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page