Hi,
In summary I've generated the client_id.bin and private_key.pem, from which I generated *.wvd file
From the video website https://video.telequebec.tv/player/48496/stream?assetType=episodes&playlist_id=314 I got the pssh and extracted the license server post request to curl bash, which I pass to https://curlconverter.com/ and updated the l3.py file as I think it should
as is the code above receiveCode:from pywidevine.cdm import Cdm from pywidevine.device import Device from pywidevine.pssh import PSSH import requests headers = { 'accept': '*/*', 'accept-language': 'en-US,en;q=0.9,fr;q=0.8', 'content-type': 'text/xml; charset=UTF-8', 'dnt': '1', 'origin': 'https://video.telequebec.tv', 'priority': 'u=1, i', 'referer': 'https://video.telequebec.tv/', 'sec-ch-ua': '...', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'cross-site', 'soapaction': '"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense"', 'user-agent': '...', } params = { 'fastly_token': '...', 'pubid': '...', } pssh = PSSH("...") lic_url = "https://manifest.prod.boltdns.net/license/v1/cenc/playready/..." # load device device = Device.load(r"C:\Users\...") # 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(lic_url, params=params, headers=headers, data=challenge) print(licence.content) #licence.raise_for_status() # parse license challenge cdm.parse_license(session_id, licence.content) # print keys for key in cdm.get_keys(session_id): if key.type=='CONTENT': print(f"\n--key {key.kid.hex}:{key.key.hex()}") # close session, disposes of session data cdm.close(session_id)
when requesting the licenseb'{"error":"retrieving license: 400 "}'
I tried to decrypt the challenge which is returned by "cdm.get_license_challenge(session_id, pssh)" but I wasn't able to decode it with utf-8 or latin-1, it didn't seems to be a base64
So I tried to reuse the same challenge as my browser, which is a soap request body, that worked but it returned a soap response
and the<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlnsoap="http://schemas.xmlsoap.org/soap/envelope/" xmlns
si="http://www.w3.org/2001/XMLSchema-instance" xmlns
sd="http://www.w3.org/2001/XMLSchema"><soap:Body><AcquireLicenseResponse xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols"><AcquireLicenseResult><Response xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/messages"><LicenseResponse xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols"><Version>1</Version><Licenses><License>...</License></Licenses></LicenseResponse></Response></AcquireLicenseResult></AcquireLicenseResponse></soap:Body></soap:Envelope>
failed to parse the license (soap response) so I manually extracted the license node value and tried to feed it to ParseFromString and this time I got this errorCode:signed_message.ParseFromString(license_message)
Any idea how to query the license and parse the license?pywidevine.exceptions.InvalidLicenseMessage: Could not parse license_message as a SignedMessage, Error parsing message
Also I'm a bit uncertain about how to proceed after this step, from my understanding I can download the encrypted video with the following command
yt-dlp --allow-u --downloader aria2c --cookies-from-browser chrome "https:// ..."
Then decrypt with the following command
mp4decrypt --key [IS THIS THE KEY FROM l3.py OUTPUT] --show-progress "INPUT_FILE" "OUTPUT_FILE"
is that right?
Thank you
+ Reply to Thread
Results 1 to 8 of 8
-
-
Code:
N_m3u8DL-RE "https://manifest.prod.boltdns.net/manifest/v1/dash/live-baseurl/bccenc/6150020952001/f038fea3-ad14-405f-b487-5fae9e19ed05/6s/manifest.mpd?fastly_token=Njc2OWYzNmJfMjE3YWIzMDMzYWY2ZDBiMzQ2ZjJjZjY2YWIzZTBjYjBiOTdjMTNlNTg4Y2VjMWU4MjMzMzEzOTQ2ZjM0MDViZA%3D%3D&pubid=6101674910001&platform=Web&os=Windows_NT_10.0&model=133.0&mfgr=Firefox&app_id=video.telequebec.tv" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0" -H "Accept: */*" -H "Referer: https://video.telequebec.tv/" -H "Origin: https://video.telequebec.tv" -H "DNT: 1" -H "Sec-GPC: 1" -H "Proxy-Authorization: Basic ZDJYVXNMNUJ6cWhOTFZldUw2ZmNoNHRDOnk3TnlMdHZuTnloTVVER3FuVnM2ckJrQw==" --key 8e799cb931374e67a9b6c1daf7368d03:1ebeba9ec48f2aa3b67a080699f74574 -M format=mkv
-
Ok, so the good news is that worked, it was a bit complex as it didn't work on chrome or edge, the website timed out but it worked on another browser.
So I got the key and downloaded the encrypted files.
Using mp4decrypt with the WidevineProxy2 key
I was able to decrypt the audio
and the first 21:55 minutes of the 24:55 minutes length of the video after which it failed with "ERROR: failed to process the file (-8)"
Both the decrypted audio and the video part sound and look fine
Any idea what this error is, and how to fix that?
Thank you -
Thank you Silv3r, I just realised that WidevineProxy2 provide the "N_m3u8DL-RE" command out of the box which works
All good
Thank you all -
Ok so it worked well for all this playlist, however I tried another video on the same site https://video.telequebec.tv/player/47740/stream?assetType=episodes&playlist_id=524 and it seems WidevineProxy2 doesn't pickup the stream, I don't see anything in the logs, I tried with both my Widevine Device and Remote CDN, I restarted and cleared cache multiple times
Any idea? -
First video you linked worked with the extension i downloaded the video full length is decrypted properly no issues with that.
Second video is unencrypted (no drm) which means u can just filter for m3u8 in networks tab and download it using N_m3u8DL-RE..........no keys needed.
Similar Threads
-
Download/rip video Prime video (amazon)
By HDstream in forum Video Streaming DownloadingReplies: 3Last Post: 8th Jun 2024, 02:48 -
DOWNLOAD protected DRM video separated video and audio from (learnyst)
By yassin in forum Video Streaming DownloadingReplies: 4Last Post: 8th Jan 2024, 04:36 -
Cannot download encrypted m3u8 video, the video works on the website
By krestek in forum Video Streaming DownloadingReplies: 6Last Post: 21st Feb 2022, 14:27 -
Download HLS video using FFMPEG with separate video and audio URLs?
By oschrndz in forum Video Streaming DownloadingReplies: 2Last Post: 15th Dec 2020, 13:53 -
how to download a portion of video from m3u8 that has separate video audio.
By adi111 in forum Video Streaming DownloadingReplies: 8Last Post: 5th Aug 2020, 14:53