更新 'iqy.py'

main
Violet 6 months ago
parent 038118e3f0
commit 2f1ca99981
  1. 33
      iqy.py

@ -4,14 +4,14 @@ import time
from urllib import parse from urllib import parse
import requests import requests
from tabulate import tabulate from tabulate import tabulate
from pywidevineb.L3.cdm import deviceconfig from pywidevine.L3.cdm import deviceconfig
from pywidevineb.L3.decrypt.wvdecryptcustom import WvDecrypt from pywidevine.L3.decrypt.wvdecryptcustom import WvDecrypt
from tools import dealck, md5, get_size, get_pssh from tools import dealck, md5, get_size, get_pssh
def get_key(pssh): def get_key(pssh):
LicenseUrl = "https://drml.video.iqiyi.com/drm/widevine?ve=0" LicenseUrl = "https://drml.video.iqiyi.com/drm/widevine?ve=0"
wvdecrypt = WvDecrypt(init_data_b64=pssh, device=deviceconfig.device_android_generic) wvdecrypt = WvDecrypt(init_data_b64=pssh, cert_data_b64="",device=deviceconfig.device_android_generic)
widevine_license = requests.post(url=LicenseUrl, data=wvdecrypt.get_challenge()) widevine_license = requests.post(url=LicenseUrl, data=wvdecrypt.get_challenge())
license_b64 = base64.b64encode(widevine_license.content) license_b64 = base64.b64encode(widevine_license.content)
wvdecrypt.update_license(license_b64) wvdecrypt.update_license(license_b64)
@ -31,10 +31,8 @@ class iqy:
self.dfp = ckjson.get('__dfp', "").split("@")[0] self.dfp = ckjson.get('__dfp', "").split("@")[0]
self.QC005 = ckjson.get('QC005', "") self.QC005 = ckjson.get('QC005', "")
self.requests = requests.Session() self.requests = requests.Session()
self.requests.headers.update({ self.requests.headers.update({
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"Cookie": self.ck,
}) })
self.bop = f"{{\"version\":\"10.0\",\"dfp\":\"{self.dfp}\",\"b_ft1\":8}}" self.bop = f"{{\"version\":\"10.0\",\"dfp\":\"{self.dfp}\",\"b_ft1\":8}}"
@ -136,34 +134,33 @@ class iqy:
authKey = md5("d41d8cd98f00b204e9800998ecf8427e" + tm + str(tvid)) authKey = md5("d41d8cd98f00b204e9800998ecf8427e" + tm + str(tvid))
params = { params = {
"tvid": tvid, "tvid": tvid,
"bid": "600", "bid": "800",
"vid": "",
"src": "01010031010000000000", "src": "01010031010000000000",
"uid": self.P00003,
"k_uid": self.QC005,
"authKey": authKey,
"dfp": self.dfp,
"pck": self.pck,
"vid": "",
"tm": tm,
"vt": "0", "vt": "0",
"rs": "1", "rs": "1",
"uid": self.P00003,
"ori": "pcw", "ori": "pcw",
"ps": "0", "ps": "1",
"k_uid": "dc7c8156286e94182d2843ada4ef6050",
"pt": "0", "pt": "0",
"d": "0", "d": "0",
"s": "", "s": "",
"lid": "0", "lid": "0",
"cf": "0", "cf": "0",
"ct": "0", "ct": "0",
"authKey": authKey,
"k_tag": "1", "k_tag": "1",
"dfp": self.dfp,
"locale": "zh_cn", "locale": "zh_cn",
"pck": self.pck,
"k_err_retries": "0", "k_err_retries": "0",
"up": "", "up": "",
"sr": "1", "sr": "1",
"qd_v": "5", "qd_v": "5",
"tm": tm,
"qdy": "u", "qdy": "u",
"qds": "0", "qds": "0",
"ppt": "0",
"k_ft1": "706436220846084", "k_ft1": "706436220846084",
"k_ft4": "1162321298202628", "k_ft4": "1162321298202628",
"k_ft2": "262335", "k_ft2": "262335",
@ -179,7 +176,7 @@ class iqy:
dash = f'/dash?' dash = f'/dash?'
for a, b in params.items(): for a, b in params.items():
dash += f"{a}={b}&" dash += f"{a}={b}&"
dash = dash[:-1] + "&bop=" + parse.quote(self.bop) + "&ut=14" dash = dash[:-1] + "&bop=" + parse.quote(self.bop) + "&ut=13&ut=4&ut=5&ut=14&ut=57"
vf = md5(dash + "tle8orw4vetejc62int3uewiniecr18i") vf = md5(dash + "tle8orw4vetejc62int3uewiniecr18i")
dash += f"&vf={vf}" dash += f"&vf={vf}"
return dash return dash
@ -278,6 +275,10 @@ class iqy:
pssh = get_pssh(init) pssh = get_pssh(init)
key_string = get_key(pssh) key_string = get_key(pssh)
cmd = f"N_m3u8DL-RE.exe \"{file} \" --tmp-dir ./cache --save-name \"{name}\" --save-dir \"{savepath}\" --thread-count 16 --download-retry-count 30 --auto-select --check-segments-count " + key_string + " --decryption-binary-path ./mp4decrypt.exe -M format=mp4" cmd = f"N_m3u8DL-RE.exe \"{file} \" --tmp-dir ./cache --save-name \"{name}\" --save-dir \"{savepath}\" --thread-count 16 --download-retry-count 30 --auto-select --check-segments-count " + key_string + " --decryption-binary-path ./mp4decrypt.exe -M format=mp4"
if m3u8data.startswith('<?xml'):
pssh = m3u8data.split('<cenc:pssh>')[1].split('</cenc:pssh>')[0]
key_string = get_key(pssh)
cmd = f"N_m3u8DL-RE.exe \"{file} \" --tmp-dir ./cache --save-name \"{name}\" --save-dir \"{savepath}\" --thread-count 16 --download-retry-count 30 --auto-select --check-segments-count " + key_string + " --decryption-binary-path ./mp4decrypt.exe -M format=mp4"
else: else:
cmd = f"N_m3u8DL-RE.exe \"{file} \" --tmp-dir ./cache --save-name \"{name}\" --save-dir \"{savepath}\" --thread-count 16 --download-retry-count 30 --auto-select --check-segments-count " cmd = f"N_m3u8DL-RE.exe \"{file} \" --tmp-dir ./cache --save-name \"{name}\" --save-dir \"{savepath}\" --thread-count 16 --download-retry-count 30 --auto-select --check-segments-count "
with open(f"{ctitle}.bat", 'a', encoding='gbk') as f: with open(f"{ctitle}.bat", 'a', encoding='gbk') as f:

Loading…
Cancel
Save