import React, { useEffect, useState } from "react"; const { protocol, hostname, port } = window.location; let fullHost = `${protocol}//${hostname}`; if ( (protocol === "http:" && port !== "80") || (protocol === "https:" && port !== "443" && port !== "") ) { fullHost += `:${port}`; } function API() { const [deviceInfo, setDeviceInfo] = useState({ device_type: "", system_id: "", security_level: "", host: "", secret: "", device_name: "", }); const [prDeviceInfo, setPrDeviceInfo] = useState({ security_level: "", host: "", secret: "", device_name: "", }); useEffect(() => { // Fetch Widevine info fetch("/remotecdm/widevine/deviceinfo") .then((response) => response.json()) .then((data) => { setDeviceInfo({ device_type: data.device_type, system_id: data.system_id, security_level: data.security_level, host: data.host, secret: data.secret, device_name: data.device_name, }); }) .catch((error) => console.error("Error fetching Widevine info:", error)); // Fetch PlayReady info fetch("/remotecdm/playready/deviceinfo") .then((response) => response.json()) .then((data) => { setPrDeviceInfo({ security_level: data.security_level, host: data.host, secret: data.secret, device_name: data.device_name, }); }) .catch((error) => console.error("Error fetching PlayReady info:", error)); }, []); useEffect(() => { document.title = "API | CDRM-Project"; }, []); return (
{`import requests print(requests.post( url='${fullHost}/api/decrypt', headers={ 'Content-Type': 'application/json', }, json={ 'pssh': 'AAAAW3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADsIARIQ62dqu8s0Xpa7z2FmMPGj2hoNd2lkZXZpbmVfdGVzdCIQZmtqM2xqYVNkZmFsa3IzaioCSEQyAA==', 'licurl': 'https://cwip-shaka-proxy.appspot.com/no_auth', 'headers': str({ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0', 'Accept': '*/*', 'Accept-Language': 'en-US,en;q=0.5', }) } ).json()['message'])`}
{`import requests print(requests.post( url='${fullHost}/api/cache/search', json={ 'input': 'AAAAW3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADsIARIQ62dqu8s0Xpa7z2FmMPGj2hoNd2lkZXZpbmVfdGVzdCIQZmtqM2xqYVNkZmFsa3IzaioCSEQyAA==' } ).json())`}
Device Type: '{deviceInfo.device_type}'
System ID: {deviceInfo.system_id}
Security Level: {deviceInfo.security_level}
Host: {fullHost}/remotecdm/widevine
Secret: '{deviceInfo.secret}'
Device Name: {deviceInfo.device_name}
Security Level: {prDeviceInfo.security_level}
Host: {fullHost}/remotecdm/playready
Secret: '{prDeviceInfo.secret}'
Device Name: {prDeviceInfo.device_name}