From 7078759cdf4274f2a4dad2cbaca92c9976d6324a Mon Sep 17 00:00:00 2001
From: rlaphoenix <rlaphoenix@pm.me>
Date: Sat, 30 Jul 2022 02:29:20 +0100
Subject: [PATCH] Remove uses of raw from CLI commands and serve

---
 pywidevine/main.py  | 11 ++---------
 pywidevine/serve.py |  3 +--
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/pywidevine/main.py b/pywidevine/main.py
index 9bda262..115339f 100644
--- a/pywidevine/main.py
+++ b/pywidevine/main.py
@@ -42,11 +42,9 @@ def main(version: bool, debug: bool) -> None:
 @click.option("-t", "--type", "type_", type=click.Choice(LicenseType.keys(), case_sensitive=False),
               default="STREAMING",
               help="License Type to Request.")
-@click.option("-r", "--raw", is_flag=True, default=False,
-              help="PSSH is Raw.")
 @click.option("-p", "--privacy", is_flag=True, default=False,
               help="Use Privacy Mode, off by default.")
-def license_(device: Path, pssh: str, server: str, type_: str, raw: bool, privacy: bool):
+def license_(device: Path, pssh: str, server: str, type_: str, privacy: bool):
     """
     Make a License Request for PSSH to SERVER using DEVICE.
     It will return a list of all keys within the returned license.
@@ -71,7 +69,7 @@ def license_(device: Path, pssh: str, server: str, type_: str, raw: bool, privac
     log.debug(device)
 
     # load cdm
-    cdm = Cdm(device, pssh, raw)
+    cdm = Cdm(device, pssh)
     log.info(f"[+] Loaded CDM with PSSH: {pssh}")
     log.debug(cdm)
 
@@ -143,10 +141,6 @@ def test(ctx: click.Context, device: Path, privacy: bool):
     # Download feature on Netflix Apps. Otherwise, use STREAMING or AUTOMATIC.
     license_type = LicenseType.STREAMING
 
-    # If the PSSH is not a valid mp4 pssh box, nor a valid CENC Header (init data) then
-    # set this to True, otherwise leave it False.
-    raw = False
-
     # this runs the `cdm license` CLI-command code with the data we set above
     # it will print information as it goes to the terminal
     ctx.invoke(
@@ -155,7 +149,6 @@ def test(ctx: click.Context, device: Path, privacy: bool):
         pssh=pssh,
         server=license_server,
         type_=LicenseType.Name(license_type),
-        raw=raw,
         privacy=privacy
     )
 
diff --git a/pywidevine/serve.py b/pywidevine/serve.py
index b6f936c..783506e 100644
--- a/pywidevine/serve.py
+++ b/pywidevine/serve.py
@@ -71,7 +71,6 @@ async def challenge(request: web.Request) -> web.Response:
 
     # load init data
     init_data = body["init_data"]
-    raw = bool(body.get("raw") or 0)
 
     # load service certificate
     service_certificate = body.get("service_certificate")
@@ -82,7 +81,7 @@ async def challenge(request: web.Request) -> web.Response:
         }, status=403)
 
     # load cdm
-    cdm = Cdm(device, init_data, raw)
+    cdm = Cdm(device, init_data)
     if service_certificate:
         cdm.set_service_certificate(service_certificate)
     request.app["sessions"][session_id] = cdm