From 8306e092e82f7d6038f6c0635ea9e9187ec02710 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 10 Sep 2022 20:43:59 +0100 Subject: [PATCH] Serve: Add privacy_mode flag for get_license_challenge --- pywidevine/remotecdm.py | 3 ++- pywidevine/serve.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pywidevine/remotecdm.py b/pywidevine/remotecdm.py index 15955d1..27fe971 100644 --- a/pywidevine/remotecdm.py +++ b/pywidevine/remotecdm.py @@ -167,7 +167,8 @@ class RemoteCdm(Cdm): url=f"{self.host}/{self.device_name}/get_license_challenge/{type_}", json={ "session_id": session_id.hex(), - "init_data": pssh.dumps() + "init_data": pssh.dumps(), + "privacy_mode": privacy_mode } ).json() if r["status"] != 200: diff --git a/pywidevine/serve.py b/pywidevine/serve.py index 1f49386..90ed00b 100644 --- a/pywidevine/serve.py +++ b/pywidevine/serve.py @@ -194,6 +194,9 @@ async def get_license_challenge(request: web.Request) -> web.Response: # get session id session_id = bytes.fromhex(body["session_id"]) + # get privacy mode flag + privacy_mode = body.get("privacy_mode", True) + # get cdm cdm: Optional[Cdm] = request.app["cdms"].get((secret_key, device_name)) if not cdm: @@ -219,7 +222,7 @@ async def get_license_challenge(request: web.Request) -> web.Response: session_id=session_id, pssh=init_data, type_=license_type, - privacy_mode=True + privacy_mode=privacy_mode ) except InvalidSession: return web.json_response({