如何通过 python 将许可请求包装到 drmtoday 服务器

how to Wrapping License Requests to drmtoday server via python

我正在尝试模拟在 python 中播放的 DRM 媒体,所以我从 castlab“https://demo.castlabs.com/” 中的这个演示开始,我正在测试的视频在 MPEG-DASH 格式和 drm 系统是通过 cenc 提供的 widevine(如果是怎么说的话),这里是视频 url

https://demo.cf.castlabs.com/media/msspr/Manifest?v=5.1.38

密钥 ID 是:

8bdf77c0-5665-46c5-8ec8-422e571fc000

并且 pssh 是:

AAAAVHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADQIARIQi993wFZlRsWOyEIuVx/AABoIY2FzdGxhYnMiEIvfd8BWZUbFjshCLlcfwAAqAlNE

schemeIdUri (widevine) 是:

edef8ba9-79d6-4ace-a3c8-27dcd51d21ed

和drm服务器url:

https://lic.staging.drmtoday.com/license-proxy-widevine/cenc/

drm 服务器需要自定义 header 是:

dt-custom-data: eyJ1c2VySWQiOiJwdXJjaGFzZSIsInNlc3Npb25JZCI6InAwIiwibWVyY2hhbnQiOiJzaXgifQ==

永远不要更改其编码自 :

的 base64
{"userId":"purchase","sessionId":"p0","merchant":"six"}

它还需要 body 请求或负载请求,这就是我的问题所在 我能够从 chrom 开发人员工具捕获 arraybuffer 中的 body 请求并转换为 base64,这就是我找到的

CAESyR8STApKCjQIARIQi993wFZlRsWOyEIuVx/AABoIY2FzdGxhYnMiEIvfd8BWZUbFjshCLlcfwAAqAlNEEAEaEO9+id0bff5JFPIQdYcCqRoYASDtl+rzBTAVQu4eChJzdGFnaW5nLmdvb2dsZS5jb20SEChwNFTACPY2GK3nRD22xMgasByr1bNXgrfr+XFlzU+UcctZsvWfVXNmF9vKXmkIBD7/Ivlx6fq7KNVx/izq28XI3axu6FPqPgb4NUTURq0SeuJnYzLLPItXccgCeZrgpqBbXoxLy716wO10/mIMTyb4pIMNoPVHdnm08MD+vKIYY0Xm7ZQ4ZYSljcDolY8tePvDD+hsJSZ+BDLJiQ57PQHSsrjAH90F6N3TIK0RgEAXk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Mgeje+ViaU2ghyNANqDttGFc2tLWEatSAWoIy3dTKfuaTuTBrjAvVf6Dbl1ZcK3FVfjxM1LprDT52hTuLhO5hb12sXWfg0nqd/m7OB7giBncDH3B/4qTMP8saCR3p3WKf8M0bEoDYLRnKHULbke7n+B4GzPM4iwqSxT1WJaydKgdQdsD3zmLXwTVTXD+k669JtxP0hxFT9jK+NAOOaUV/3ITCGzO5H2CetI534549s8HY+CYLZdofc4Ozzi8u3C3ix8AA+7oc73+uNhr8Nj7Z6jTsrlvOXoevW7UVVB0CzVufK9gfnzAodK+CO2tWzyIQLn7uNn6/Yd4XwCkDQPR4qCqAAiZNMFcg8nC83o6ZkZC5ofOoVkHs+zwpHS2fQ/dBj8BqJqAxjmnOnKS+vX3rZ8u4C/6VRIa3sqhMjbnQgEVO6NJ4kKKBk/9saU34eBXkEKLH3Trcph9KUxyt7FG0XcPc6QcmSrtPPu17Az7ght5GpAhk02DSq3s6jAKx3C6JlunHEr/HhBclL83n8BNia76ArZ7Hs291kd68sysS5edaw4plPyN9hL9wgBc1D79wFVC9yYlgP7z/XOdSiF4N1z35G5nl6UxBvtdqYTLYCw2+LG3Vhznf7GdCel5keCoM/g5doWyi2FqRyTshYdcfk2jseYJ96tC3BE64UwT20WlSYwwagAKSEYJ37jGNCidW/AJHF4H3gKxhNVWSAqun5aY2ZJum9y6R20zlDr269U496Fplcb1wEWgLWBJVgd1yVpbhPR8JbaIPMenOsPO4h/XlKHq/LxsqFL9J/X5V1kwjerBkFdHneb93HCe1nTdyczNMwPymkm1LxinLMG1eJ7Y8YDlWWlFVXQJN7hIH2TUuozxDZTnC9XFfSRdNIjagWu2fujKrZjV+KjqD7VztIocL5LaYLnxPobQsSNGDqTih6qwU6EhHv90e2e1BT5G0yW7RIMYfe83SfW1lyoXWxq/YZieapVolSTY1rQ6zNVcsG0GmBDzm2ZVVKS5PCOuZiW6t4q+T

我真的不知道这段代码是如何形成的我知道它转换为 arraybuffer "Unit8 and "int8" 并用作对服务器的 body 请求,我处理了这个 base64 代码并尝试在此站点“https://tools.axinom.com/decoders/LicenseRequest”中解码,它为我提供有关许可证请求的信息,例如证书和序列号以及签名以及 pssh 数据和内容 ID、算法 (AES-CTR) 现在,由于存储在该 base64 代码中的大部分信息都在我手中(pssh、kid、系统 id),我想知道如何 create\build\wrapper 以与构建 base64 代码相同的方式使用请求它在 python

通过EME在浏览器中与CDM交互生成请求API:https://w3c.github.io/encrypted-media/. You can learn more by using this: https://chrome.google.com/webstore/detail/eme-call-and-event-logger/cniohcjecdcdhgmlofniddfoeokbpbpb

也许这有助于从 Python 调用 Chromium:Python - how to load Google Chrome or Chromium browser in the gtk.Window like webkit.WebView()?

您还需要注意在 CEF 中启用 Widevine,由于某些签名验证过程,可能存在相关限制。看 https://bitbucket.org/chromiumembedded/cef/src/master/include/cef_web_plugin.h#lines-168 并在此处查找 "VMP":https://github.com/castlabs/electron-releases