-
Notifications
You must be signed in to change notification settings - Fork 78
How to add custom license scheme yourself
-
Basic level of network skill
-
Basic level of Python skill (Especially about Pywidevine)
1.
Check the contents of the request/response to the license server
2.
Create a python scheme file according to the reference described below.
Scheme files are located in python/schemes
.
The scheme file should only describe the part that handles the license acquisition and will eventually be concatenated and executed likes pre.py + SCHEME.py + after.py
.
3.
Edit popup/main.html
to allow the added scheme file to run.
4.
Edit the Config files as needed.
See Config files for more informations
5.
After you've created new license scheme, consider opening PR to improve this project!
See Contribution for more informations
licUrl: License URL as string that is automatically collected by extension.
licHeaders: Headers as JSON object that is automatically collected by extension. (It is passed as a string from JS, but is automatically read as a dict in pre.py.)
loadBody(loadAs): Loads requestBody into scheme from licBody
variable.
-
PARAMS:
-
loadAs: Specifies the return type in string, accepts
"blob"
,"str"
or"json"
.
-
loadAs: Specifies the return type in string, accepts
- RESPONSE: Returns loaded body as user specified format
getChallenge(getAs, *cert): Gets license challenge as format specified in argument, it can also specify a service certificate optionally.
-
PARAMS:
-
getAs: Specifies the return type in string, accepts
"blob"
,"b64"
or"list"
. - cert(optional): Specifies the service certificate of license server
-
getAs: Specifies the return type in string, accepts
- RESPONSE: Returns generated challenge as user specified format
corsFetch(url, method, headers, body, resType): Use this function for requesting to license server.
-
PARAMS:
- url: Specifies URL to request in string.
-
method: Specifies request method in string,
"POST"
is used in most cases. -
headers: Specifies headers of request in
dict
orstr
, in most cases, specifyinglicHeaders
as is. -
body: Specifies requestBody of request in
bytes
,str
, ordict
, in most cases, either alicBody
with a modified payload or achallenge
is specified as is. -
resType: Specifies the return type in string, accepts
"blob"
,"str"
or"json"
.
-
RESPONSE: Returns fetch response as
bytes
,str
ordict
depending on the argument (Asynchronous)
licence: Set the final acquired license into this variable and it will be automatically parsed by pywidevine.