功能(iqiyi/main.py): 增加解析__dfp的逻辑

 功能(iqiyi/main.py): 新增获取观看时长的函数
 功能(iqiyi/main.py): 新增领取V7特权的函数
 功能(iqiyi/main.py): 新增刷观看时长的函数,优化抽奖逻辑
 功能(iqiyi/main.py): 增加视频时长和V7特权的信息输出
This commit is contained in:
shitao 2024-01-14 10:50:58 +08:00
parent b7e70dc745
commit d30b34b93b

View File

@ -2,7 +2,9 @@ import json
import os
import re
import time
from random import randint
from urllib.parse import unquote
from uuid import uuid4
import requests
@ -32,7 +34,12 @@ class IQIYI(CheckIn):
if re.findall(r"P00003=(.*?);", cookie)
else ""
)
return p00001, p00002, p00003
__dfp = (
re.findall(r"__dfp=(.*?);", cookie)[0]
if re.findall(r"__dfp=(.*?);", cookie)
else ""
)
return p00001, p00002, p00003, __dfp
@staticmethod
def user_information(p00001):
@ -198,9 +205,134 @@ class IQIYI(CheckIn):
msg = res["errorReason"]
return {"status": False, "msg": msg, "chance": 0}
def get_watch_time(self, p00001):
url = "https://tc.vip.iqiyi.com/growthAgency/watch-film-duration"
data = requests.get(
url=url,
headers={
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0",
"Cookie": f"P00001={p00001}",
"Content-Type": "application/json",
},
).json()
watch_time = data["data"]["viewtime"]["time"]
return watch_time
def level_right(self, p00001):
data = {"code": "k8sj74234c683f", "P00001": p00001}
res = requests.post(
url="https://act.vip.iqiyi.com/level-right/receive", data=data
).json()
msg = res["msg"]
return [
{
"name": "V7 免费升级星钻",
"value": msg,
}
]
def start_watch(self, p00001, p00003, dfp):
total_time = self.get_watch_time(p00001=p00001)
print(f"现在已经刷到了 {total_time}秒, 数据同步有延迟, 仅供参考")
if total_time >= 7200:
return {
"name": "视频时长",
"value": f"已经刷了 {total_time}秒, 数据同步有延迟, 仅供参考",
}
for _ in range(150):
tm = randint(60, 120)
watch_time_url = "https://msg.qy.net/b"
params = {
"u": "f600a23f03c26507f5482e6828cfc6c5",
"pu": p00003,
"p1": "1_10_101",
"v": "5.2.66",
"ce": uuid4().hex,
"de": "1616773143.1639632721.1639653680.29",
"c1": "2",
"ve": uuid4().hex,
"ht": "0",
"pt": randint(1000000000, 9999999999) / 1000000,
"isdm": "0",
"duby": "0",
"ra": "5",
"clt": "",
"ps2": "DIRECT",
"ps3": "",
"ps4": "",
"br": "mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/96.0.4664.110 safari/537.36",
"mod": "cn_s",
"purl": "https://www.iqiyi.com/v_1eldg8u3r08.html?vfrm=pcw_home&vfrmblk=712211_cainizaizhui&vfrmrst=712211_cainizaizhui_image1&r_area=rec_you_like&r_source=62%40128&bkt=MBA_PW_T3_53&e=b3ec4e6c74812510c7719f7ecc8fbb0f&stype=2",
"tmplt": "2",
"ptid": "01010031010000000000",
"os": "window",
"nu": "0",
"vfm": "",
"coop": "",
"ispre": "0",
"videotp": "0",
"drm": "",
"plyrv": "",
"rfr": "https://www.iqiyi.com/",
"fatherid": f"{randint(1000000000000000, 9999999999999999)}",
"stauto": "1",
"algot": "abr_v12-rl",
"vvfrom": "",
"vfrmtp": "1",
"pagev": "playpage_adv_xb",
"engt": "2",
"ldt": "1",
"krv": "1.1.85",
"wtmk": "0",
"duration": f"{randint(1000000, 9999999)}",
"bkt": "",
"e": "",
"stype": "",
"r_area": "",
"r_source": "",
"s4": f"{randint(100000, 999999)}_dianshiju_tbrb_image2",
"abtest": "1707_B,1550_B",
"s3": f"{randint(100000, 999999)}_dianshiju_tbrb",
"vbr": f"{randint(100000, 999999)}",
"mft": "0",
"ra1": "2",
"wint": "3",
"s2": "pcw_home",
"bw": "10",
"ntwk": "18",
"dl": f"{randint(10, 999)}.27999999999997",
"rn": f"0.{randint(1000000000000000, 9999999999999999)}",
"dfp": dfp,
"stime": str(time.time() * 1000),
"r": f"{randint(1000000000000000, 9999999999999999)}",
"hu": "1",
"t": "2",
"tm": str(tm),
"_": str(time.time() * 1000),
}
requests.get(
url=watch_time_url,
headers={
"User-Agent": "mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/96.0.4664.110 safari/537.36",
"Cookie": f"P00001={p00001}",
"Content-Type": "application/json",
},
params=params,
)
total_time += tm
print(f"现在已经刷到了 {total_time}秒, 数据同步有延迟, 仅供参考")
if total_time >= 7600:
break
return {
"name": "视频时长",
"value": f"已经刷了 {total_time}秒, 数据同步有延迟, 仅供参考",
}
def main(self):
p00001, p00002, p00003 = self.parse_cookie(self.check_item.get("cookie"))
p00001, p00002, p00003, dfp = self.parse_cookie(self.check_item.get("cookie"))
sign_msg = self.sign(p00001=p00001)
watch_msg = self.start_watch(p00001=p00001, p00003=p00003, dfp=dfp)
level_right_msg = self.level_right(p00001=p00001)
chance = self.draw(0, p00001=p00001, p00003=p00003)["chance"]
if chance:
draw_msg = ""
@ -210,7 +342,7 @@ class IQIYI(CheckIn):
else:
draw_msg = "抽奖机会不足"
task_msg = ""
for one in range(6):
for _ in range(6):
task_list = self.query_user_task(p00001=p00001)
self.join_task(p00001=p00001, task_list=task_list)
time.sleep(10)
@ -237,6 +369,8 @@ class IQIYI(CheckIn):
task_msg,
{"name": "抽奖奖励", "value": draw_msg},
]
+ [watch_msg]
+ level_right_msg
)
msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg])
return msg