mirror of
				https://github.com/devine-dl/pywidevine.git
				synced 2025-11-04 03:44:50 +00:00 
			
		
		
		
	Remove uses of raw from CLI commands and serve
This commit is contained in:
		
							parent
							
								
									1cedba7e49
								
							
						
					
					
						commit
						7078759cdf
					
				@ -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
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user