Files
CDRM-Extension-API/main.py
2024-05-28 12:42:43 -04:00

40 lines
846 B
Python

from decrypt import decrypt_content
import json
from flask import Flask, request
from database_check import database_check
app = Flask(__name__)
database_check()
@app.route('/', methods=['POST'])
def post_endpoint():
# Get the JSON data from the request
data = json.loads(request.data.decode())
print(json.dumps(data, indent=4))
# Get the PSSH
pssh = data['PSSH']
# Get the license URL
lic_url = data['License URL']
# Get the headers
headers = data['Headers']
headers = json.loads(headers)
# Get the MPD url
json_data = data['JSON']
try:
keys = decrypt_content(in_pssh=pssh, license_url=lic_url, headers=headers)
return {'Message': f'{keys}'}
except Exception as error:
return {"Message": [f'{error}']}
if __name__ == '__main__':
app.run(debug=True)