用于与netflix msl api交互的python库

pymsl的Python项目详细描述


Pymsl

Build StatusLicense: GPL v3

用于与Netflix MSL API交互的Python库

用法

基本用法

>>>importpymsl>>>user_auth_data={...'scheme':'EMAIL_PASSWORD',...'authdata':{...'email':email,...'password':password...}...}>>>client=pymsl.MslClient(user_auth_data)>>>client.load_manifest(80092521){'version':2,...

所有用户身份验证方案都在msl wiki中定义:https://github.com/Netflix/msl/wiki/User-Authentication-(Configuration)

自定义Kwargs

pymsl.MslClient()需要额外的kwarg来覆盖默认值;初始化所需的唯一参数是用户身份验证数据:

>>>pymsl.MslClient(...user_auth_data,...esn=CUSTOM_ESN,# default is NFCDCH-02-[random device ID]...drm_system=CUSTOM_DRM_SYSTEM,# default is 'widevine', you can use 'playready', 'fps', etc....profiles=LIST_OF_PROFILES,# default is ['playready-h264mpl30-dash', 'playready-h264mpl31-dash', 'playready-h264mpl40-dash', 'heaac-2-dash', 'simplesdh', 'nflx-cmisc', 'BIF240', 'BIF320']...keypair=CUSTOM_CRYPTODOME_RSA_KEYPAIR,# default is a random 2048-bit keypair...message_id=CUSTOM_MESSAGE_ID,# default is a random integer between 0 and 2^52...languages=LIST_OF_LANGUAGES,# default is ['en_US']...proxies=PROXIES,# default is None...key_request_data=CUSTOM_KEY_REQUEST_DATA,# default is ASYMMETRIC_WRAPPED...extra_manifest_params=EXTRA_MANIFEST_PARAMS# default is a blank dict...)
  • esn是用于与msl通信的标识。不同的esn有不同的特权。
  • drm_system将确定您将在清单中接收哪种初始化数据。
  • profiles是一个配置文件列表,用于告诉msl您希望在清单中接收什么。
  • keypair是在初始密钥交换中使用的rsa密钥对。
  • message_id是用于标识msl客户端会话的随机整数。
  • languages是用于确定所接收清单的语言的列表。
  • proxies是传递给requests库的代理dict。
  • key_request_data是一个dict,通过它来覆盖普通的ASYMMETRIC_WRAPPED密钥请求dict,以便启用其他密钥交换机制。请注意,您可能需要对parse_handshake函数进行monkey补丁,以便它与指定的密钥交换机制一起工作。
  • extra_manifest_params是额外清单参数的dict。以下是在清单请求中发送的默认清单参数:
'params':{'type':'standard','viewableId':viewable_id,'profiles':self.msl_session['profiles'],'flavor':'STANDARD','drmType':self.msl_session['drm_system'],'drmVersion':25,'usePsshBox':True,'isBranching':False,'useHttpsStreams':True,'imageSubtitleHeight':720,'uiVersion':'shakti-v4bf615c3','clientVersion':'6.0011.511.011','supportsPreReleasePin':True,'supportsWatermark':True,'showAllSubDubTracks':False,'videoOutputInfo':[{'type':'DigitalVideoOutputDescriptor','outputType':'unknown','supportedHdcpVersions':[],'isHdcpEngaged':False}],'preferAssistiveAudio':False,'isNonMember':False}

通过使用这个Kwarg,您可以向这个参数dict添加任何您想要的值。例如,如果您想要showAllSubDubTracks为真,您可以将extra_manifest_params设置为{'showAllSubDubTracks': True}。manifest param dict只是用extra_manifest_params.update(),因此您可以覆盖默认值或添加新值。

方法

load_manifest(viewable_id)

@param viewable_ids: Int of viewable ID
                     to obtain manifest for

@return: manifest (dict)

This function performs a manifest request based on
the parameters supplied when initalizing the client
object. If there are no errors, it will return the
manifest as a dict. If there are errors, it will
raise a ManifestError exception with the response
from the MSL API as the body.

get_license(challenge, session_id)

@param challenge:  EME license request as a byte string
                   that will be used to obtain a license

@param session_id: DRM specific session ID passed as a string

@return: license (dict)

This function performs a license request based on
the parameters supplied when initalizing the client
object. If there are no errors, it will return the
licenses as a list of dicts. If there are errors, it will
raise a LicenseError exception with the response
from the MSL API as the body.

安装

要安装,您可以克隆存储库并运行python setup.py install,也可以运行pip install pymsl

待办事项

  • [X]实施许可证获取
  • []清除分块负载分析

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用唯一的按钮标签单击按钮   代码生成如何使用Java codeModel为数组的特定索引赋值   java如何批量执行Camel SQL插入   java iText 7将ltv添加到现有签名   内存管理Java应用程序突然停止几天后(810)   带MySQL的java注册表单JavaFX在intellij中失败   如何使用eclipse为windows azure java项目启用远程调试   一种通用的java输入输出设计模式   java Android XML(RSS)忽略引号(“”)   java帮助:安卓中的8 X 10 2维按钮数组   java启动Android项目   JWrapper构建java应用程序   java如何在Android应用程序中设置基于日期/时间的默认页面加载?   java循环程序在完成后返回到起点   java Hibernate:更好的整体类还是多类映射?   回溯数独解算器的递归问题[Java]   java查找类用法   java如何在SpringWebFlow中将多个模型绑定到一个视图?