Add files via upload

cdrm api added
Sasuke-Duck UwU 2023-11-17 14:46:51 -05:00 committed by GitHub
parent ef83af4806
commit 8bd91534f8
No known key found for this signature in database
2 changed files with 67 additions and 0 deletions

View File

@ -829,3 +829,14 @@ def extract_pssh_m3u8(content):
# If the regex match fails, return None or raise an exception as needed
return None
def get_keys_cdrm_api(headers_license, license_url, pssh_value):
api_url = ""
r =, headers=headers_license, json={"license": license_url, "pssh": pssh_value})
data = r.json()
# Extract keys from the response
keys = [key["key"] for key in data.get("keys", [])]
return keys

56 Normal file
View File

@ -0,0 +1,56 @@
import requests
from cdm.wks import PsshExtractor, get_keys_cdrm_api
def parse_command_line_arguments():
"""Parse command line arguments."""
parser = __import__('argparse').ArgumentParser(description="Decrypt Widevine content using MPD URL and License URL")
parser.add_argument("-mpd", required=True, help="URL of the MPD manifest")
parser.add_argument("-lic", required=True, help="URL of the license server")
return parser.parse_args()
def get_mpd_response(mpd_url):
"""Get MPD manifest response."""
mpd_headers = {
'origin': '',
'referer': '',
return requests.get(mpd_url, headers=mpd_headers)
def get_license_headers(token):
"""Get headers for the license server request."""
return {
'accept': "*/*", # no delet
'content-length': "316", # no delet
'Connection': 'keep-alive', # no delet
'authorization': f'Bearer {token}',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (Ktesttemp, like Gecko) Chrome/90.0.4430.85 Safari/537.36'
def main():
# Parse command line arguments
args = parse_command_line_arguments()
mpd_url, license_url = args.mpd, args.lic
# Get MPD response
mpd_response = get_mpd_response(mpd_url)
# Extract PSSH value from MPD response
pssh_extractor = PsshExtractor(mpd_response.text)
pssh_value = pssh_extractor.extract_pssh()
print("PSSH value:", pssh_value)
# Get headers for the license server request
token = ""
# Update with your actual token
license_headers = get_license_headers(token)
# Call the function in to get the keys
keys = get_keys_cdrm_api(license_headers, license_url, pssh_value)
# Process each key
for key in keys:
print(f'KEY: {key}')
if __name__ == "__main__":