hi there,
how to edit old l3.py for WKS-KEYS to work with newest pywidevine, latest python 3.12 and new cdm device.wvd ?
now required downgrade protobuf 3.19.5 or use venv ...
here on attach the old l3.py (but i think you all already have it)
Support our site by donate $5 directly to us Thanks!!!
Try StreamFab Downloader and download streaming video from Netflix, Amazon!
Try StreamFab Downloader and download streaming video from Netflix, Amazon!
		
			+ Reply to Thread
			
		
		
		
			
	
	
				Results 1 to 13 of 13
			
		- 
	
- 
	Use a script like this one : 
 Source : https://forum.videohelp.com/threads/404994-Decryption-and-the-Temple-of-Doom#post2650297HTML Code:import logging from pywidevine.cdm import Cdm from pywidevine.device import Device from pywidevine.pssh import PSSH import httpx logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) WVD_PATH = "/home/angela/Programming/WKS-KEYS/device.wvd" from headers import headers def get_key(pssh, license_url): logger.debug("Loading device...") device = Device.load(WVD_PATH) cdm = Cdm.from_device(device) session_id = cdm.open() logger.debug("Session opened...") challenge = cdm.get_license_challenge(session_id, PSSH(pssh)) response = httpx.post(license_url, data=challenge, headers=headers) cdm.parse_license(session_id, response.content) keys = [] logger.debug("Retrieving keys...") for key in cdm.get_keys(session_id): logger.debug(f"Key found: {key.kid.hex}:{key.key.hex()}, Type: {key.type}") if key.type == 'CONTENT': keys.append(f"--key {key.kid.hex}:{key.key.hex()}") cdm.close(session_id) logger.debug("Session closed...") return "\n".join(keys) if __name__ == "__main__": pssh_str = input("PSSH? ") lic_url = input("License URL? ") result = get_key(pssh_str, lic_url) logger.debug("Result:") print(result)
- 
	And https://forum.videohelp.com/threads/411862-Beyond-WKS-KEYS has more information about making the transition together with an updated L3.py. But plain old L3 is now replaced by allhell3.py see my signature. Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
 https://files.videohelp.com/u/301890/hellyes6.zip
- 
	thanks aqzs for your edited script version. i can try soon 
 
 @Angela
 yes i know allhell3.py your script work fine. but need copy from lic url as curl bash value, so need to play video on browser
 the old l3.py only is more convenient when someone share data only like pssh and lic url
 i know your thread, and i also posted some comments (now all work fine!)
 
 now i can test the new edited l3.py
- 
	oh yes aqzs, your edited version work fine! wonderful 
 
 this only: how to hide (not print) debug information ? but key only, like old l3.py
- 
	ok guys now i need to take a step forward 
 from some link like that https://mediasetinfinity.mediaset.it/movie/benvenutialsud/benvenuti-al-sud_F301623001000101
 the pssh is inside the mpd from <cenc>. so, instead of manually searching pssh from mpd is there a way to have the script search for it ?
 
 my goal is have an l3_edited.py script v2 to add lic url only for those sites (like the link above) that have a pssh contained on mpd
- 
	Sure. In my old script I have these two functions: 
 Code:def filter_pssh(pssh_list: list, systemid: PSSH.SystemId): for item in pssh_list: pssh = PSSH(item) if pssh.system_id == systemid: return pssh return None def get_pssh(mpd_url, headers): r = requests.get(url=mpd_url, headers=headers) r.raise_for_status() pssh_list = re.findall( r'<cenc:pssh\b[^>]*>(.*?)</cenc:pssh>', r.text) return filter_pssh(pssh_list, PSSH.SystemId.Widevine)
- 
	Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
 https://files.videohelp.com/u/301890/hellyes6.zip
- 
	thanks Obo for your tip. i can try soon 
 
 @Angela
 i don't you understand ... from script above (with DEBUG infos) the pssh is required at script start ... i think need to be add lines as suggested by Obo in the script
- 
	You are trying to do something which has been done already by people before you. Look at their work. Find an all in one downloader and load the script into a text editor and read it. See how others capture a pssh. 
 
 What's not to to understand? Or use Obo's method if you wish - without doing any thinking.
 
 But what will you next be asking for help capturing? The license?
 
 Strive to be an independent learner by using what is already around you. You'll have no need to use VH as a live AI engine to question, if you look through published solutions instead. Use your head is the message!Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
 https://files.videohelp.com/u/301890/hellyes6.zip
- 
	Use a script like this one :Originally Posted by whs912km
 
 HTML Code:from pywidevine.cdm import Cdm from pywidevine.device import Device from pywidevine.pssh import PSSH import requests import xml.etree.ElementTree as ET def getpssh(url_mpd): psshs = [] response = requests.get(url_mpd) root = ET.fromstring(response.content) for i in range(20): for j in range(20): for k in range(20): for l in range(20): try: if root[i][j][k][l].text not in psshs and len(root[i][j][k][l].text) > 70 and len(root[i][j][k][l].text) < 190: psshs.append(root[i][j][k][l].text) except: pass for pssh in psshs: return pssh # # enter special header values here in the form 'token': ' value', each on one line - remember the quotes and the comma! headers = { 'Accept': '*/*', } # prepare pssh mpd_url = input("MPD URL? ") pssh = getpssh(mpd_url) pssh = PSSH(pssh) lic_url = input("License URL? ") # load device # for example #device = Device.load(r"/home/angela/Programming/WKS-KEYS/pywidevine/L3/cdm/devices/emulator_1/WVD/google_aosp_on_ia_emulator_14.0.0_xxxxxc_4464_l3.wvd") device = Device.load(r"<enter your path to the wvd file you have created, here>") # 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, headers = headers, 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): if key.type=='CONTENT': print(f"\n--key {key.kid.hex}:{key.key.hex()}") # close session, disposes of session data cdm.close(session_id)
- 
	thanks a lot aqzs, i can test now your script 
 
 edit: wonderful, your script work fine. thanks again for your help aqzsLast edited by whs912km; 28th Jul 2024 at 13:27. 
Similar Threads
- 
  pywidevine keyBy aletaladro in forum Video Streaming DownloadingReplies: 6Last Post: 16th Jul 2024, 17:44
- 
  pywidevine wks-keyBy aletaladro in forum Video Streaming DownloadingReplies: 1Last Post: 11th Jul 2024, 15:32
- 
  My Pywidevine API ServerBy ninjajiraiya in forum Video Streaming DownloadingReplies: 24Last Post: 27th Mar 2024, 03:53
- 
  help with pywidevineBy killua in forum Video Streaming DownloadingReplies: 1Last Post: 12th Jul 2023, 02:56
- 
  No Module Named pywidevine.l3By myemailjobayer in forum Video Streaming DownloadingReplies: 3Last Post: 23rd Jun 2023, 17:09


 
		
		 View Profile
				View Profile
			 View Forum Posts
				View Forum Posts
			 Private Message
				Private Message
			 
 
			
			
 Quote
 Quote 
			
 
			