A Streamlink plugin for playing Widevine DRM-encrypted MPEG-DASH and HLS streams.
The plugin resolves Widevine PSSH data from the media manifest, obtains the required content keys from a Widevine license server, and passes those keys to third-party dashdrm / hlsdrm Streamlink plugins.
- Streamlink
- A Widevine device (
.wvd) provision - Additional third-party Streamlink plugins:
Clone the repository and use Streamlink's plugin directory option --plugin-dir.
Alternatively, sideload
widevine.py.
The plugin accepts DASH (.mpd) and HLS (.m3u8) manifests prefixed with the
widevine:// scheme.
A license server URL must be provided.
The plugin also requires a Widevine device.
The device can either be specified explicitly with --widevine-device or
placed in Streamlink's default configuration directory.
streamlink \
--plugin-dir /path/to/streamlink-plugin-widevine \
--widevine-device /path/to/device.wvd \
--widevine-license-url "https://license.example.com/..." \
"widevine://https://example.com/manifest.mpd" \
bestThe plugin accepts the following parameters:
Widevine license server URL.
This parameter is required.
--widevine-license-url "https://license.example.com/..."A header to add to the license server HTTP request, in Key=Value format.
Can be repeated to add multiple headers.
--widevine-license-header "Host=license.example.com"The format of the license server response.
Supported values are:
raw(default)json
--widevine-license-format jsonComma-separated path to the license message in a JSON response.
For example, if the license server returns a JSON object like this:
{
"license": {
"message": "BASE64_LICENSE"
}
}--widevine-license-format json \
--widevine-license-path "license,message"Path to the Widevine device (.wvd) file.
--widevine-device /path/to/device.wvdIf this option is not specified, the plugin searches for a device in the following locations:
STREAMLINK_WIDEVINE_DEVICEenvironment variable- Streamlink's default configuration directory for a file named
device.wvd
Widevine PSSH data.
Multiple PSSH strings can be supplied as a comma-separated list.
If omitted, the plugin will attempt to extract Widevine PSSH data automatically from the media manifest and, where applicable, its initialisation segments.
--widevine-pssh "BASE64_PSSH"Multiple PSSH values:
--widevine-pssh "BASE64_PSSH_1,BASE64_PSSH_2"The repository contains compatibility code and a bundled version of
pywidevine.
No changes should be made to widevine.py or pywidevine_bundled.py
directly as these files are generated automatically and any changes to these
will be overwritten.
Instead, make changes elsewhere and run the build script to generate the bundled implementation and the Streamlink plugin:
python tools/build.py
The generated widevine.py can then be tested with Streamlink:
streamlink \
--plugin-dir . \
--loglevel debug \
--widevine-license-url "https://license.example.com/..." \
"widevine://https://example.com/manifest.mpd" \
bestThis project is intended for lawful use with content and services for which you have the necessary authorisation.
Users are responsible for complying with applicable laws, license terms, and the terms of service of the services they access.
This project incorporates and modifies code from:
See LICENSE and THIRD-PARTY-NOTICES.md for licensing and attribution
information.