Hi, i am trying to decrypt video from youku chinese drama. URL: https://www.youku.tv/v/v_show/id_XNjQzNjczODY5Mg==.html
I am using this code to get the key:
Code:import os import json import m3u8 import base64 import urllib import requests from pywidevine.cdm import Cdm from pywidevine.device import Device from pywidevine.pssh import PSSH def cbcs(manifest_url, license_api): manifest = m3u8.load(manifest_url) pssh = None fkeys = "" for key in manifest.keys: if key and 'base64' in key.uri: pssh = PSSH(key.uri.split(',')[-1]) if pssh is None: print('Error getting pssh.') return device = Device.load('device.wvd') cdm = Cdm.from_device(device) session_id = cdm.open() challenge = cdm.get_license_challenge(session_id, pssh) headers = {'content-type': 'application/x-www-form-urlencoded'} license_request_data = license_api.split('?')[1] + '&licenseRequest=' + urllib.parse.quote(base64.b64encode(challenge).decode()) try: license_response = requests.post(license_api.split('?')[0], headers=headers, data=license_request_data) license_response.raise_for_status() except requests.HTTPError as e: print(f"Failed to get license: {e}") return license_info = json.loads(license_response.content)['data'] cdm.parse_license(session_id, license_info) for key in cdm.get_keys(session_id): if key.type != 'SIGNING': fkeys += key.kid.hex + ":" + key.key.hex() cdm.close(session_id) return fkeys.strip() def load_config(config_file): try: with open(config_file, 'r') as file: config = json.load(file) return config except Exception as e: print(f"Error loading config file: {e}") exit(1) config_path = input("Enter the path to the config file: ") config = load_config(config_path) dir_path = os.path.dirname(config_path) filename = os.path.basename(os.path.splitext(config_path)[0]) m3u8_url = config[0] try: manifest = m3u8.load(m3u8_url) if not (manifest.media or manifest.segments): raise Exception('Stream might be expired.') keys = stream_ext = encryptR_server = copyright_key = None if config[1].startswith("http"): stream_ext = config[1] else: encryptR_server = config[1] copyright_key = config[2] if stream_ext: inner_m3u8 = manifest.media[0].uri if manifest.media else None if inner_m3u8: license_data = stream_ext.replace('cbcs', 'widevine') keys = cbcs(inner_m3u8, license_data) print(keys) else: print("Failed to extract inner m3u8 URL.") if not keys: print("Failed to retrieve decryption keys.") except Exception as e: print(e)
You can get the resource from runningin the console.Code:videoPlayer.context.originResource.stream
But when i try to get the key, its returningThen i look at the license server, it is saysCould not parse license_message as a SignedMessage, Error parsing message, instead of{"data":"default error","msg":"create wvpl session error","states":204}
[Attachment 84949 - Click to enlarge]
What is the main reason of this error? How to fix it
+ Reply to Thread
Results 1 to 3 of 3
-
Last edited by Feddryx; 18th Jan 2025 at 05:40.
-
Code:
776364376602168a4981f78f9aa3a5c9:dcd489bdea184d10339d38cb873156b9
--[----->+<]>.++++++++++++.---.--------.
[*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*] -
oh, now i know the problem is. my wvd got revoked bcs i use android studio wvd. i change it into real device and now its work well
Similar Threads
-
Extract Keys from License Server response
By larley in forum Video Streaming DownloadingReplies: 24Last Post: 28th Aug 2024, 12:18 -
Need help with lic.drmtoday.com license server
By TheGreatUnknown90 in forum Video Streaming DownloadingReplies: 51Last Post: 20th May 2024, 15:33 -
How can i make sample Widevine license server?
By treegex in forum Newbie / General discussionsReplies: 0Last Post: 27th Sep 2023, 03:13 -
Onlyfans DRM license server
By dami3n in forum Video Streaming DownloadingReplies: 3Last Post: 4th May 2023, 16:30 -
Am I doing this right? (requesting decryption key from license server)
By rajhlinux in forum Video Streaming DownloadingReplies: 56Last Post: 1st Apr 2022, 18:36