Few changes to netflix service
This commit is contained in:
parent
91b146ca5b
commit
18d70442e3
@ -177,7 +177,7 @@ class Netflix(BaseService):
|
||||
license_url = manifest["links"]["license"]["href"]
|
||||
|
||||
|
||||
if self.cdm.device.security_level == 3 and self.cdm.device.type == DeviceTypes.ANDROID:
|
||||
if (self.cdm.device.security_level == 3 and self.cdm.device.type == DeviceTypes.ANDROID if "common_privacy_cert" in dir self.cdm else False):
|
||||
max_quality = max(x.height for x in manifest_tracks.videos)
|
||||
if profile == "MPL" and max_quality >= 720:
|
||||
manifest_sd = self.get_manifest(title, self.config["profiles"]["video"]["H264"]["BPL"])
|
||||
@ -383,7 +383,7 @@ class Netflix(BaseService):
|
||||
self.profiles = self.get_profiles()
|
||||
self.log.info("Initializing a Netflix MSL client")
|
||||
# Grab ESN based on CDM from secrets if no ESN argument provided
|
||||
if self.cdm.device.type == DeviceTypes.CHROME: # ESN GENERATOR FOR CHROME
|
||||
if (self.cdm.device.type == DeviceTypes.CHROME if "common_privacy_cert" in dir self.cdm else if "common_privacy_cert" not in dir self.cdm): # ESN GENERATOR FOR CHROME
|
||||
self.esn = chrome_esn_generator()
|
||||
else:
|
||||
sel.log.info(self.config)
|
||||
@ -393,10 +393,15 @@ class Netflix(BaseService):
|
||||
if not self.esn:
|
||||
raise self.log.exit(" - No ESN specified")
|
||||
self.log.info(f" + ESN: {self.esn}")
|
||||
|
||||
try:
|
||||
scheme = {
|
||||
DeviceTypes.CHROME: KeyExchangeSchemes.AsymmetricWrapped,
|
||||
DeviceTypes.ANDROID: KeyExchangeSchemes.Widevine
|
||||
DeviceTypes.ANDROID: KeyExchangeSchemes.Widevine,
|
||||
|
||||
}[self.cdm.device.type]
|
||||
except:
|
||||
scheme = KeyExchangeSchemes.AsymmetricWrapped
|
||||
self.log.info(f" + Scheme: {scheme}")
|
||||
self.msl = MSL.handshake(
|
||||
scheme=scheme,
|
||||
@ -405,14 +410,14 @@ class Netflix(BaseService):
|
||||
sender=self.esn,
|
||||
cdm=self.cdm,
|
||||
msl_keys_path=self.get_cache("msl_{id}_{esn}_{scheme}.json".format(
|
||||
id=self.cdm.device.system_id,
|
||||
id=self.cdm.device.system_id or self.cdm.get_name(),
|
||||
esn=self.esn,
|
||||
scheme=scheme
|
||||
))
|
||||
)
|
||||
if not self.session.cookies:
|
||||
raise self.log.exit(" - No cookies provided, cannot log in.")
|
||||
if self.cdm.device.type == DeviceTypes.CHROME:
|
||||
if self.cdm.device.type == DeviceTypes.CHROME if "common_privacy_cert" in dir self.cdm else if "common_privacy_cert" not in dir self.cdm:
|
||||
self.userauthdata = UserAuthentication.NetflixIDCookies(
|
||||
netflixid=self.session.cookies.get_dict()["NetflixId"],
|
||||
securenetflixid=self.session.cookies.get_dict()["SecureNetflixId"]
|
||||
@ -634,7 +639,7 @@ class Netflix(BaseService):
|
||||
self.log.debug("Profiles:\n\t" + "\n\t".join(profiles))
|
||||
|
||||
params = {}
|
||||
if self.cdm.device.type == DeviceTypes.CHROME:
|
||||
if self.cdm.device.type == DeviceTypes.CHROME if "common_privacy_cert" in dir self.cdm else if "common_privacy_cert" not in dir self.cdm:
|
||||
params = {
|
||||
"reqAttempt": 1,
|
||||
"reqPriority": 0,
|
||||
@ -723,8 +728,7 @@ class Netflix(BaseService):
|
||||
needs_repack=False,
|
||||
# decryption
|
||||
encrypted=x["isDrm"],
|
||||
pssh=Box.parse(base64.b64decode(manifest["video_tracks"][0]["drmHeader"]["bytes"])) if x[
|
||||
"isDrm"] else None,
|
||||
psshPR=manifest["video_tracks"][0]["drmHeader"]["bytes"] if x["isDrm"] else None,
|
||||
kid=x["drmHeaderId"] if x["isDrm"] else None,
|
||||
) for x in manifest["video_tracks"][0]["streams"]],
|
||||
# AUDIO
|
||||
@ -743,7 +747,7 @@ class Netflix(BaseService):
|
||||
needs_repack=False,
|
||||
# decryption
|
||||
encrypted=x["isDrm"],
|
||||
pssh=Box.parse(base64.b64decode(x["drmHeader"]["bytes"])) if x["isDrm"] else None,
|
||||
psshPR=x["drmHeader"]["bytes"] if x["isDrm"] else None,
|
||||
kid=x.get("drmHeaderId") if x["isDrm"] else None, # TODO: haven't seen enc audio, needs testing
|
||||
) for x in manifest["audio_tracks"]],
|
||||
# SUBTITLE
|
||||
|
||||
@ -10,6 +10,7 @@ cdm:
|
||||
Amazon: 'hisense_smarttv_he55a7000euwts_sl3000'
|
||||
Hotstar: 'xiaomi_mi_a1_15.0.0_60ceee88_8159_l3'
|
||||
DisneyPlus: 'mtc_mtc_atv_atv_sl3000'
|
||||
Sunnxt: 'xiaomi_mi_a1_15.0.0_60ceee88_8159_l3'
|
||||
|
||||
cdm_api:
|
||||
- name: 'playready'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user