This is a modified version of TPD-Keys that automatically downloads, decrypts, verifies, and merges the mp4 file after grabbing the keys. This version is designed for streams that only use one key for audio and video.
- requests
- frida
- frida-tools
- protobuf
- pycryptodome
- pywidevine
- httpx
- Acquire a CDM file.wvd file (see below for guide to obtain CDM using an Android Studio emulator)
- Install the Tampermonkey browser extension
- Install the EME Logger script in Tampermonkey
- Open the Developer Tools with CTRL+SHIFT+I
- In the Console tab of the developer window add this to the filter box: MediaKeySession::generateRequest
- This makes the PSSH pop up in the Console tab when the video loads.
- In the Network tab of the developer window add this to the filter box: index.mpd
- This makes the index.mpd pop up in the Network tab when the video loads. Could also be manifest.mpd
- (Mode 7 only) In the Network tab of the developer window add this to the filter box: method:POST
- Find the second ?specConform=true that pops up, click it, and scroll down in the request headers and
- find
X-Dt-Custom-Data
and copy the value as your -xdtcd value
- You can just run the script with no arguments, and you will be prompted for the required inputs.
- You can also run the script without the input prompt by passing arguments
drmdl.py -out "OUTPUT FILE PATH" -pssh "PSSH_HERE" -url "index.mpd URL HERE" -xdtcd "X-Dt-Custom-Data value here"
- -out "path/to/outputfile.mp4"
- -wvd "PATH to WVD file"
-
- Optional. Defaults to "./file.wvd"
- -url "URL for index.mpd"
- -pssh "PSSH value"
- -cc "COUNTRYCODE"
-
- Set the two letter country code for the desired proxy country.
- Use the -selection option to select a mode. The default mode is 7.
- -lic "License server url here"
- -lic "License server url here"
- Set your desired custom headers in DRMHeaders.py
- Set your desired custom headers in DRMHeaders.py
- -lic "License server url here"
- -pid "PID here"
- -channel "EpgId here"
- -live_token "Live token here"
- -lic "License server url here"
- -xdtcd "Custom X-Dt-Custom-Data value here"
- -lic "License server url here"
- Optional. Default value can be changed in the script. Defaults to https://lic.drmtoday.com/license-proxy-widevine/cenc/?specConform=true
Make sure you have the dependencies installed and in your PATH
Here I extract it from android studio emulator using this guide https://forum.videohelp.com/threads/408031-Dumping-Your-own-L3-CDM-with-Android-Studio/
- First make sure to check if your PC supports Intel HAXM. If not you may need to use an android phone
- Enable VT-x and VT-d in BIOS
- Disable hypervisor on windows
- Install android studio
- Install intel HAXM when android studio asks
- Create a device
- Pixel 6
- Pie 28 / android 9.0
- Run the new android device
pip install frida
pip install frida-tools
pip install protobuf
pip install pycryptodome
pip install requests
pip install httpx
pip install pywidevine
- Download frida-server-x.x.x-android-x86.xz https://github.com/frida/frida/releases
- Make sure it is the same version as the one you installed from pip
- Extract it (I used peazip) and rename the file to "frida"
- Move the file you renamed to frida to
C:\Users\yourname\AppData\Local\Android\Sdk\platform-tools
- Open CMD and navigate to the same directory
cd C:\Users\yourname\AppData\Local\Android\Sdk\platform-tools
- Check if the android VM is running by running
adb devices
- Now execute these commands to start the frida server on the android device
adb push frida /sdcard/
adb shell
su
cp /sdcard/frida /data/local/tmp
chmod +x /data/local/tmp/frida
/data/local/tmp/frida
https://github.com/wvdumper/dumper
python dump_keys.py
- Open Chrome on the android VM and go to any DRM protected video
Your CDM key files will be generated in the key_dumps folder:
client_id.bin
and private_key.pem
The guide recommends renaming them to
device_client_id_blob
and device_private_key
- Make a new folder
- Inside it add the device_client_id_blob and device_private_key files
- And create a new folder called output
- Then run this command to create the wvd file in the output folder
pywidevine create-device -k device_private_key -c device_client_id_blob -t "ANDROID" -l 3 -o output
Rename the file in the output folder to file.wvd and move it to the same folder as drmdl.py
Or rename to whatever you like and add -wvd "pathtofile.wvd"
to the command
python drmdl.py -out "file.mp4" -pssh "" -url "" -xdtcd "" -wvd "pathtofile.wvd"