diff --git a/cdm/wks.py b/cdm/wks.py index 60d7a44..ccc69b9 100644 --- a/cdm/wks.py +++ b/cdm/wks.py @@ -873,6 +873,11 @@ def get_keys_license_cdrm_project(license_url, headers_license, pssh_value): response = requests.post('https://cdrm-project.com/wv', json=json_data) return response +def get_keys_cache_cdrm_project(pssh_value): + data = pssh_value + response = requests.post('https://cdrm-project.com/findpssh', data=data) + print_keys_cdrm_project(response) + def print_keys_cdrm_project(response): if response.status_code == 200: soup = BeautifulSoup(response.text, 'html.parser') diff --git a/cdrm_cache.py b/cdrm_cache.py new file mode 100644 index 0000000..669b611 --- /dev/null +++ b/cdrm_cache.py @@ -0,0 +1,35 @@ +import argparse +import requests +from cdm.wks import PsshExtractor, get_keys_cache_cdrm_project + +def extract_pssh_value(mpd_url): + headers_mpd = { + 'origin': 'https://play.hbomax.com', + 'referer': 'https://play.hbomax.com/', + } + + response = requests.get(mpd_url, headers=headers_mpd) + + if response.status_code == 200: + pssh_extractor = PsshExtractor(response.text) + pssh_value = pssh_extractor.extract_pssh() + return pssh_value + else: + raise ValueError(f"Error: Unable to fetch MPD manifest, Status Code: {response.status_code}") + +def main(): + parser = argparse.ArgumentParser(description="Decrypt Widevine content using MPD URL and License URL") + parser.add_argument("-mpd", required=True, help="URL of the MPD manifest") + args = parser.parse_args() + + mpd_url = args.mpd + + try: + pssh_value = extract_pssh_value(mpd_url) + print("PSSH value:", pssh_value) + get_keys_cache_cdrm_project(pssh_value) + except Exception as e: + print(f"An error occurred: {e}") + +if __name__ == "__main__": + main()