mirror of https://github.com/yuxian158/check.git
张洛
3 years ago
8 changed files with 518 additions and 297 deletions
@ -1,177 +0,0 @@ |
|||||||
# -*- coding: utf-8 -*- |
|
||||||
import base64 |
|
||||||
import hashlib |
|
||||||
import json |
|
||||||
import os |
|
||||||
import random |
|
||||||
|
|
||||||
import requests |
|
||||||
import urllib3 |
|
||||||
from cryptography.hazmat.backends import default_backend |
|
||||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes |
|
||||||
from requests import utils |
|
||||||
from getENV import getENv |
|
||||||
from checksendNotify import send |
|
||||||
|
|
||||||
urllib3.disable_warnings() |
|
||||||
|
|
||||||
|
|
||||||
class Music163CheckIn: |
|
||||||
def __init__(self, check_item): |
|
||||||
self.check_item = check_item |
|
||||||
self.headers = { |
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36", |
|
||||||
"Referer": "http://music.163.com/", |
|
||||||
"Accept-Encoding": "gzip, deflate", |
|
||||||
} |
|
||||||
|
|
||||||
@staticmethod |
|
||||||
def _encrypt(key, text): |
|
||||||
backend = default_backend() |
|
||||||
cipher = Cipher(algorithms.AES(key.encode("utf8")), modes.CBC(b"0102030405060708"), backend=backend) |
|
||||||
encryptor = cipher.encryptor() |
|
||||||
length = 16 |
|
||||||
count = len(text.encode("utf-8")) |
|
||||||
if count % length != 0: |
|
||||||
add = length - (count % length) |
|
||||||
else: |
|
||||||
add = 16 |
|
||||||
pad = chr(add) |
|
||||||
text1 = text + (pad * add) |
|
||||||
ciphertext = encryptor.update(text1.encode("utf-8")) + encryptor.finalize() |
|
||||||
crypted_str = str(base64.b64encode(ciphertext), encoding="utf-8") |
|
||||||
return crypted_str |
|
||||||
|
|
||||||
def encrypt(self, text): |
|
||||||
return { |
|
||||||
"params": self._encrypt("TA3YiYCfY2dDJQgg", self._encrypt("0CoJUm6Qyw8W8jud", text)), |
|
||||||
"encSecKey": "84ca47bca10bad09a6b04c5c927ef077d9b9f1e37098aa3eac6ea70eb59df0aa28b691b7e75e4f1f9831754919ea784c8f74fbfadf2898b0be17849fd656060162857830e241aba44991601f137624094c114ea8d17bce815b0cd4e5b8e2fbaba978c6d1d14dc3d1faf852bdd28818031ccdaaa13a6018e1024e2aae98844210", |
|
||||||
} |
|
||||||
|
|
||||||
def login(self, session, phone, password): |
|
||||||
login_url = "https://music.163.com/weapi/login/cellphone" |
|
||||||
headers = { |
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36", |
|
||||||
"Referer": "http://music.163.com/", |
|
||||||
"Accept-Encoding": "gzip, deflate", |
|
||||||
"Cookie": "os=pc; osver=Microsoft-Windows-10-Professional-build-10586-64bit; appver=2.0.3.131777; channel=netease; __remember_me=true;", |
|
||||||
} |
|
||||||
hl = hashlib.md5() |
|
||||||
hl.update(password.encode(encoding="utf-8")) |
|
||||||
md5_password = str(hl.hexdigest()) |
|
||||||
login_data = self.encrypt( |
|
||||||
json.dumps({"phone": phone, "countrycode": "86", "password": md5_password, "rememberLogin": "true"}) |
|
||||||
) |
|
||||||
res = session.post(url=login_url, data=login_data, headers=headers, verify=False) |
|
||||||
ret = res.json() |
|
||||||
if ret["code"] == 200: |
|
||||||
csrf = requests.utils.dict_from_cookiejar(res.cookies)["__csrf"] |
|
||||||
nickname = ret["profile"]["nickname"] |
|
||||||
level_data = self.get_level(session=session, csrf=csrf, login_data=login_data) |
|
||||||
level = level_data["level"] |
|
||||||
now_play_count = level_data["nowPlayCount"] |
|
||||||
next_play_count = level_data["nextPlayCount"] |
|
||||||
now_login_count = level_data["nowLoginCount"] |
|
||||||
next_login_count = level_data["nextLoginCount"] |
|
||||||
return csrf, nickname, level, now_play_count, next_play_count, now_login_count, next_login_count |
|
||||||
else: |
|
||||||
return False, ret.get("message"), 0, 0, 0 |
|
||||||
|
|
||||||
def sign(self, session): |
|
||||||
sign_url = "https://music.163.com/weapi/point/dailyTask" |
|
||||||
res = session.post(url=sign_url, data=self.encrypt('{"type":0}'), headers=self.headers, verify=False) |
|
||||||
ret = res.json() |
|
||||||
if ret["code"] == 200: |
|
||||||
return "签到成功,经验+ " + str(ret["point"]) |
|
||||||
elif ret["code"] == -2: |
|
||||||
return "今天已经签到过了" |
|
||||||
else: |
|
||||||
return "签到失败: " + ret["message"] |
|
||||||
|
|
||||||
def task(self, session, csrf): |
|
||||||
url = "https://music.163.com/weapi/v6/playlist/detail?csrf_token=" + csrf |
|
||||||
recommend_url = "https://music.163.com/weapi/v1/discovery/recommend/resource" |
|
||||||
music_lists = [] |
|
||||||
res = session.post( |
|
||||||
url=recommend_url, data=self.encrypt('{"csrf_token":"' + csrf + '"}'), headers=self.headers, verify=False |
|
||||||
) |
|
||||||
ret = res.json() |
|
||||||
if ret["code"] != 200: |
|
||||||
print("获取推荐歌曲失败: ", str(ret["code"]), ":", ret["message"]) |
|
||||||
else: |
|
||||||
lists = ret["recommend"] |
|
||||||
music_lists = [(d["id"]) for d in lists] |
|
||||||
music_id = [] |
|
||||||
for m in music_lists: |
|
||||||
res = session.post( |
|
||||||
url=url, |
|
||||||
data=self.encrypt(json.dumps({"id": m, "n": 1000, "csrf_token": csrf})), |
|
||||||
headers=self.headers, |
|
||||||
verify=False, |
|
||||||
) |
|
||||||
ret = json.loads(res.text) |
|
||||||
for i in ret["playlist"]["trackIds"]: |
|
||||||
music_id.append(i["id"]) |
|
||||||
post_data = json.dumps( |
|
||||||
{ |
|
||||||
"logs": json.dumps( |
|
||||||
list( |
|
||||||
map( |
|
||||||
lambda x: { |
|
||||||
"action": "play", |
|
||||||
"json": { |
|
||||||
"download": 0, |
|
||||||
"end": "playend", |
|
||||||
"id": x, |
|
||||||
"sourceId": "", |
|
||||||
"time": 240, |
|
||||||
"type": "song", |
|
||||||
"wifi": 0, |
|
||||||
}, |
|
||||||
}, |
|
||||||
random.sample(music_id, 420 if len(music_id) > 420 else len(music_id)), |
|
||||||
) |
|
||||||
) |
|
||||||
) |
|
||||||
} |
|
||||||
) |
|
||||||
res = session.post(url="http://music.163.com/weapi/feedback/weblog", data=self.encrypt(post_data)) |
|
||||||
ret = res.json() |
|
||||||
if ret["code"] == 200: |
|
||||||
return "刷听歌量成功" |
|
||||||
else: |
|
||||||
return "刷听歌量失败: " + ret["message"] |
|
||||||
|
|
||||||
def get_level(self, session, csrf, login_data): |
|
||||||
url = "https://music.163.com/weapi/user/level?csrf_token=" + csrf |
|
||||||
res = session.post(url=url, data=login_data, headers=self.headers) |
|
||||||
ret = json.loads(res.text) |
|
||||||
return ret["data"] |
|
||||||
|
|
||||||
def main(self): |
|
||||||
phone = self.check_item.get("music163_phone") |
|
||||||
password = self.check_item.get("music163_password") |
|
||||||
session = requests.session() |
|
||||||
csrf, nickname, level, now_play_count, next_play_count, now_login_count, next_login_count = self.login( |
|
||||||
session=session, phone=phone, password=password |
|
||||||
) |
|
||||||
res_sign = "" |
|
||||||
res_task = "" |
|
||||||
if csrf: |
|
||||||
res_sign = self.sign(session=session) |
|
||||||
res_task = self.task(session=session, csrf=csrf) |
|
||||||
msg = ( |
|
||||||
f"帐号信息: {nickname}\n当前等级: {level}\n当前听歌数量: {now_play_count}\n" |
|
||||||
f"升级需听歌数量: {next_play_count - now_play_count}\n升级需签到天数: {next_login_count - now_login_count}\n" |
|
||||||
f"签到状态: {res_sign}\n刷歌状态: {res_task}" |
|
||||||
) |
|
||||||
return msg |
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": |
|
||||||
getENv() |
|
||||||
with open("/ql/config/check.json", "r", encoding="utf-8") as f: |
|
||||||
datas = json.loads(f.read()) |
|
||||||
_check_item = datas.get("MUSIC163_ACCOUNT_LIST", [])[0] |
|
||||||
res=Music163CheckIn(check_item=_check_item).main() |
|
||||||
send("网易云音乐",res) |
|
@ -1,4 +1,5 @@ |
|||||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||||
|
# 20 7 * * * |
||||||
import json |
import json |
||||||
import os |
import os |
||||||
|
|
@ -0,0 +1,155 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
# 21 9 * * * |
||||||
|
import base64 |
||||||
|
import json |
||||||
|
import os |
||||||
|
import re |
||||||
|
import time |
||||||
|
|
||||||
|
import requests |
||||||
|
|
||||||
|
import rsa |
||||||
|
from getENV import getENv |
||||||
|
from checksendNotify import send |
||||||
|
|
||||||
|
|
||||||
|
class Cloud189CheckIn: |
||||||
|
def __init__(self, check_item: dict): |
||||||
|
self.check_item = check_item |
||||||
|
self.b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" |
||||||
|
|
||||||
|
@staticmethod |
||||||
|
def int2char(a): |
||||||
|
return list("0123456789abcdefghijklmnopqrstuvwxyz")[a] |
||||||
|
|
||||||
|
def b64tohex(self, a): |
||||||
|
d = "" |
||||||
|
e = 0 |
||||||
|
c = 0 |
||||||
|
for i in range(len(a)): |
||||||
|
if list(a)[i] != "=": |
||||||
|
v = self.b64map.index(list(a)[i]) |
||||||
|
if 0 == e: |
||||||
|
e = 1 |
||||||
|
d += self.int2char(v >> 2) |
||||||
|
c = 3 & v |
||||||
|
elif 1 == e: |
||||||
|
e = 2 |
||||||
|
d += self.int2char(c << 2 | v >> 4) |
||||||
|
c = 15 & v |
||||||
|
elif 2 == e: |
||||||
|
e = 3 |
||||||
|
d += self.int2char(c) |
||||||
|
d += self.int2char(v >> 2) |
||||||
|
c = 3 & v |
||||||
|
else: |
||||||
|
e = 0 |
||||||
|
d += self.int2char(c << 2 | v >> 4) |
||||||
|
d += self.int2char(15 & v) |
||||||
|
if e == 1: |
||||||
|
d += self.int2char(c << 2) |
||||||
|
return d |
||||||
|
|
||||||
|
def rsa_encode(self, j_rsakey, string): |
||||||
|
rsa_key = f"-----BEGIN PUBLIC KEY-----\n{j_rsakey}\n-----END PUBLIC KEY-----" |
||||||
|
pubkey = rsa.PublicKey.load_pkcs1_openssl_pem(rsa_key.encode()) |
||||||
|
result = self.b64tohex((base64.b64encode(rsa.encrypt(f"{string}".encode(), pubkey))).decode()) |
||||||
|
return result |
||||||
|
|
||||||
|
def login(self, session, username, password): |
||||||
|
url = "https://cloud.189.cn/udb/udb_login.jsp?pageId=1&redirectURL=/main.action" |
||||||
|
r = session.get(url=url) |
||||||
|
captchatoken = re.findall(r"captchaToken' value='(.+?)'", r.text)[0] |
||||||
|
lt = re.findall(r'lt = "(.+?)"', r.text)[0] |
||||||
|
returnurl = re.findall(r"returnUrl = '(.+?)'", r.text)[0] |
||||||
|
paramid = re.findall(r'paramId = "(.+?)"', r.text)[0] |
||||||
|
j_rsakey = re.findall(r'j_rsaKey" value="(\S+)"', r.text, re.M)[0] |
||||||
|
session.headers.update({"lt": lt}) |
||||||
|
|
||||||
|
username = self.rsa_encode(j_rsakey, username) |
||||||
|
password = self.rsa_encode(j_rsakey, password) |
||||||
|
url = "https://open.e.189.cn/api/logbox/oauth2/loginSubmit.do" |
||||||
|
headers = { |
||||||
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/76.0", |
||||||
|
"Referer": "https://open.e.189.cn/", |
||||||
|
} |
||||||
|
data = { |
||||||
|
"appKey": "cloud", |
||||||
|
"accountType": "01", |
||||||
|
"userName": f"{{RSA}}{username}", |
||||||
|
"password": f"{{RSA}}{password}", |
||||||
|
"validateCode": "", |
||||||
|
"captchaToken": captchatoken, |
||||||
|
"returnUrl": returnurl, |
||||||
|
"mailSuffix": "@189.cn", |
||||||
|
"paramId": paramid, |
||||||
|
} |
||||||
|
r = session.post(url, data=data, headers=headers, timeout=5) |
||||||
|
if r.json()["result"] == 0: |
||||||
|
redirect_url = r.json()["toUrl"] |
||||||
|
session.get(url=redirect_url) |
||||||
|
return True |
||||||
|
else: |
||||||
|
return "登陆状态: " + r.json()["msg"] |
||||||
|
|
||||||
|
@staticmethod |
||||||
|
def sign(session): |
||||||
|
rand = str(round(time.time() * 1000)) |
||||||
|
surl = f"https://api.cloud.189.cn/mkt/userSign.action?rand={rand}&clientType=TELEANDROID&version=8.6.3&model=SM-G930K" |
||||||
|
url = "https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN" |
||||||
|
url2 = "https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN" |
||||||
|
headers = { |
||||||
|
"User-Agent": "Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6", |
||||||
|
"Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1", |
||||||
|
"Host": "m.cloud.189.cn", |
||||||
|
"Accept-Encoding": "gzip, deflate", |
||||||
|
} |
||||||
|
response = session.get(url=surl, headers=headers) |
||||||
|
netdiskbonus = response.json().get("netdiskBonus") |
||||||
|
if response.json().get("isSign") == "false": |
||||||
|
msg = f"签到结果: 未签到,签到获得 {netdiskbonus}M 空间" |
||||||
|
else: |
||||||
|
msg = f"签到结果: 已经签到过了,签到获得 {netdiskbonus}M 空间" |
||||||
|
response = session.get(url=url, headers=headers) |
||||||
|
if "errorCode" in response.text: |
||||||
|
msg += f"\n第一次抽奖: {response.json().get('errorCode')}" |
||||||
|
else: |
||||||
|
description = response.json().get("description", "") |
||||||
|
if description in ["1", 1]: |
||||||
|
description = "50M空间" |
||||||
|
msg += f"\n第一次抽奖: 获得{description}" |
||||||
|
response = session.get(url=url2, headers=headers) |
||||||
|
if "errorCode" in response.text: |
||||||
|
msg += f"\n第二次抽奖: {response.json().get('errorCode')}" |
||||||
|
else: |
||||||
|
description = response.json().get("description", "") |
||||||
|
if description in ["1", 1]: |
||||||
|
description = "50M空间" |
||||||
|
msg += f"\n第二次抽奖: 获得{description}" |
||||||
|
return msg |
||||||
|
|
||||||
|
def main(self): |
||||||
|
cloud189_phone = self.check_item.get("cloud189_phone") |
||||||
|
cloud189_password = self.check_item.get("cloud189_password") |
||||||
|
session = requests.Session() |
||||||
|
flag = self.login(session=session, username=cloud189_phone, password=cloud189_password) |
||||||
|
if flag is True: |
||||||
|
sign_msg = self.sign(session=session) |
||||||
|
else: |
||||||
|
sign_msg = flag |
||||||
|
msg = f"帐号信息: {cloud189_phone}\n{sign_msg}" |
||||||
|
return msg |
||||||
|
|
||||||
|
|
||||||
|
def start(): |
||||||
|
getENv() |
||||||
|
with open("/ql/config/check.json", "r", encoding="utf-8") as f: |
||||||
|
datas = json.loads(f.read()) |
||||||
|
_check_item = datas.get("CLOUD189_ACCOUNT_LIST", [])[0] |
||||||
|
res = Cloud189CheckIn(check_item=_check_item).main() |
||||||
|
print(res) |
||||||
|
send('天翼网盘', res) |
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__": |
||||||
|
start() |
@ -0,0 +1,216 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
# 22 9 * * * |
||||||
|
import json |
||||||
|
import os |
||||||
|
import re |
||||||
|
import time |
||||||
|
from urllib.parse import unquote |
||||||
|
|
||||||
|
import requests |
||||||
|
from getENV import getENv |
||||||
|
from checksendNotify import send |
||||||
|
|
||||||
|
|
||||||
|
class IQIYICheckIn: |
||||||
|
def __init__(self, check_item): |
||||||
|
self.check_item = check_item |
||||||
|
|
||||||
|
@staticmethod |
||||||
|
def parse_cookie(cookie): |
||||||
|
p00001 = re.findall(r"P00001=(.*?);", cookie)[0] |
||||||
|
p00002 = re.findall(r"P00002=(.*?);", cookie)[0] if re.findall(r"P00002=(.*?);", cookie) else "" |
||||||
|
p00003 = re.findall(r"P00003=(.*?);", cookie)[0] |
||||||
|
return p00001, p00002, p00003 |
||||||
|
|
||||||
|
@staticmethod |
||||||
|
def user_information(p00001): |
||||||
|
""" |
||||||
|
用户信息查询 |
||||||
|
""" |
||||||
|
time.sleep(3) |
||||||
|
url = "http://serv.vip.iqiyi.com/vipgrowth/query.action" |
||||||
|
params = {"P00001": p00001} |
||||||
|
res = requests.get(url=url, params=params).json() |
||||||
|
if res["code"] == "A00000": |
||||||
|
try: |
||||||
|
res_data = res.get("data", {}) |
||||||
|
level = res_data.get("level", 0) # VIP 等级 |
||||||
|
growthvalue = res_data.get("growthvalue", 0) # 当前 VIP 成长值 |
||||||
|
distance = res_data.get("distance", 0) # 升级需要成长值 |
||||||
|
deadline = res_data.get("deadline", "非 VIP 用户") # VIP 到期时间 |
||||||
|
today_growth_value = res_data.get("todayGrowthValue", 0) # 今日成长值 |
||||||
|
msg = ( |
||||||
|
f"VIP 等级: {level}\n当前成长值: {growthvalue}\n" |
||||||
|
f"升级需成长值: {distance}\n今日成长值: +{today_growth_value}\nVIP 到期时间: {deadline}" |
||||||
|
) |
||||||
|
except Exception as e: |
||||||
|
msg = str(e) |
||||||
|
print(msg) |
||||||
|
else: |
||||||
|
msg = res.get("msg") |
||||||
|
return msg |
||||||
|
|
||||||
|
@staticmethod |
||||||
|
def sign(p00001): |
||||||
|
""" |
||||||
|
VIP 签到 |
||||||
|
""" |
||||||
|
url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask" |
||||||
|
params = {"P00001": p00001, "autoSign": "yes"} |
||||||
|
res = requests.get(url=url, params=params).json() |
||||||
|
if res["code"] == "A00000": |
||||||
|
try: |
||||||
|
growth = res["data"]["signInfo"]["data"]["rewardMap"]["growth"] |
||||||
|
continue_sign_days_sum = res["data"]["signInfo"]["data"]["continueSignDaysSum"] |
||||||
|
reward_day = ( |
||||||
|
7 if continue_sign_days_sum % 28 <= 7 else (14 if continue_sign_days_sum % 28 <= 14 else 28) |
||||||
|
) |
||||||
|
rouund_day = 28 if continue_sign_days_sum % 28 == 0 else continue_sign_days_sum % 28 |
||||||
|
msg = f"+{growth}成长值\n连续签到: {continue_sign_days_sum}天\n签到周期: {rouund_day}天/{reward_day}天" |
||||||
|
except Exception as e: |
||||||
|
print(e) |
||||||
|
msg = res["data"]["signInfo"].get("msg") |
||||||
|
else: |
||||||
|
msg = res.get("msg") |
||||||
|
return msg |
||||||
|
|
||||||
|
@staticmethod |
||||||
|
def query_user_task(p00001): |
||||||
|
""" |
||||||
|
获取 VIP 日常任务 和 taskCode(任务状态) |
||||||
|
""" |
||||||
|
url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask" |
||||||
|
params = {"P00001": p00001} |
||||||
|
task_list = [] |
||||||
|
res = requests.get(url=url, params=params).json() |
||||||
|
if res["code"] == "A00000": |
||||||
|
for item in res["data"]["tasks"]["daily"]: |
||||||
|
task_list.append( |
||||||
|
{ |
||||||
|
"name": item["name"], |
||||||
|
"taskCode": item["taskCode"], |
||||||
|
"status": item["status"], |
||||||
|
"taskReward": item["taskReward"]["task_reward_growth"], |
||||||
|
} |
||||||
|
) |
||||||
|
return task_list |
||||||
|
|
||||||
|
@staticmethod |
||||||
|
def join_task(p00001, task_list): |
||||||
|
""" |
||||||
|
遍历完成任务 |
||||||
|
""" |
||||||
|
url = "https://tc.vip.iqiyi.com/taskCenter/task/joinTask" |
||||||
|
params = {"P00001": p00001, "taskCode": "", "platform": "bb136ff4276771f3", "lang": "zh_CN"} |
||||||
|
for item in task_list: |
||||||
|
if item["status"] == 2: |
||||||
|
params["taskCode"] = item["taskCode"] |
||||||
|
requests.get(url=url, params=params) |
||||||
|
|
||||||
|
@staticmethod |
||||||
|
def get_task_rewards(p00001, task_list): |
||||||
|
""" |
||||||
|
获取任务奖励 |
||||||
|
:return: 返回信息 |
||||||
|
""" |
||||||
|
url = "https://tc.vip.iqiyi.com/taskCenter/task/getTaskRewards" |
||||||
|
params = {"P00001": p00001, "taskCode": "", "platform": "bb136ff4276771f3", "lang": "zh_CN"} |
||||||
|
growth_task = 0 |
||||||
|
for item in task_list: |
||||||
|
if item["status"] == 0: |
||||||
|
params["taskCode"] = item.get("taskCode") |
||||||
|
requests.get(url=url, params=params) |
||||||
|
elif item["status"] == 4: |
||||||
|
requests.get(url="https://tc.vip.iqiyi.com/taskCenter/task/notify", params=params) |
||||||
|
params["taskCode"] = item.get("taskCode") |
||||||
|
requests.get(url=url, params=params) |
||||||
|
elif item["status"] == 1: |
||||||
|
growth_task += item["taskReward"] |
||||||
|
msg = f"+{growth_task}成长值" |
||||||
|
return msg |
||||||
|
|
||||||
|
@staticmethod |
||||||
|
def draw(draw_type, p00001, p00003): |
||||||
|
""" |
||||||
|
查询抽奖次数(必),抽奖 |
||||||
|
:param draw_type: 类型。0 查询次数;1 抽奖 |
||||||
|
:param p00001: 关键参数 |
||||||
|
:param p00003: 关键参数 |
||||||
|
:return: {status, msg, chance} |
||||||
|
""" |
||||||
|
url = "https://iface2.iqiyi.com/aggregate/3.0/lottery_activity" |
||||||
|
params = { |
||||||
|
"lottery_chance": 1, |
||||||
|
"app_k": "b398b8ccbaeacca840073a7ee9b7e7e6", |
||||||
|
"app_v": "11.6.5", |
||||||
|
"platform_id": 10, |
||||||
|
"dev_os": "8.0.0", |
||||||
|
"dev_ua": "FRD-AL10", |
||||||
|
"net_sts": 1, |
||||||
|
"qyid": "2655b332a116d2247fac3dd66a5285011102", |
||||||
|
"psp_uid": p00003, |
||||||
|
"psp_cki": p00001, |
||||||
|
"psp_status": 3, |
||||||
|
"secure_v": 1, |
||||||
|
"secure_p": "GPhone", |
||||||
|
"req_sn": round(time.time() * 1000), |
||||||
|
} |
||||||
|
if draw_type == 1: |
||||||
|
del params["lottery_chance"] |
||||||
|
res = requests.get(url=url, params=params).json() |
||||||
|
if not res.get("code"): |
||||||
|
chance = int(res.get("daysurpluschance")) |
||||||
|
msg = res.get("awardName") |
||||||
|
return {"status": True, "msg": msg, "chance": chance} |
||||||
|
else: |
||||||
|
try: |
||||||
|
msg = res.get("kv", {}).get("msg") |
||||||
|
except Exception as e: |
||||||
|
print(e) |
||||||
|
msg = res["errorReason"] |
||||||
|
return {"status": False, "msg": msg, "chance": 0} |
||||||
|
|
||||||
|
def main(self): |
||||||
|
p00001, p00002, p00003 = self.parse_cookie(self.check_item.get("iqiyi_cookie")) |
||||||
|
sign_msg = self.sign(p00001=p00001) |
||||||
|
chance = self.draw(0, p00001=p00001, p00003=p00003)["chance"] |
||||||
|
if chance: |
||||||
|
draw_msg = "" |
||||||
|
for i in range(chance): |
||||||
|
ret = self.draw(1, p00001=p00001, p00003=p00003) |
||||||
|
draw_msg += ret["msg"] + ";" if ret["status"] else "" |
||||||
|
else: |
||||||
|
draw_msg = "抽奖机会不足" |
||||||
|
task_msg = "" |
||||||
|
for one in range(6): |
||||||
|
task_list = self.query_user_task(p00001=p00001) |
||||||
|
self.join_task(p00001=p00001, task_list=task_list) |
||||||
|
time.sleep(10) |
||||||
|
task_msg = self.get_task_rewards(p00001=p00001, task_list=task_list) |
||||||
|
try: |
||||||
|
user_info = json.loads(unquote(p00002, encoding="utf-8")) |
||||||
|
user_name = user_info.get("user_name") |
||||||
|
user_name = user_name.replace(user_name[3:7], "****") |
||||||
|
nickname = user_info.get("nickname") |
||||||
|
except Exception as e: |
||||||
|
print(f"获取用户信息失败,错误信息: {e}") |
||||||
|
nickname = "未获取到,请检查 Cookie 中 P00002 字段" |
||||||
|
user_name = "未获取到,请检查 Cookie 中 P00002 字段" |
||||||
|
user_msg = self.user_information(p00001=p00001) |
||||||
|
msg = f"用户账号: {user_name}\n用户昵称: {nickname}\n{user_msg}\n" \ |
||||||
|
f"签到奖励: {sign_msg}\n任务奖励: {task_msg}\n抽奖奖励: {draw_msg}" |
||||||
|
return msg |
||||||
|
|
||||||
|
|
||||||
|
def start(): |
||||||
|
getENv() |
||||||
|
with open("/ql/config/check.json", "r", encoding="utf-8") as f: |
||||||
|
datas = json.loads(f.read()) |
||||||
|
_check_item = datas.get("IQIYI_COOKIE_LIST", [])[0] |
||||||
|
res = IQIYICheckIn(check_item=_check_item).main() |
||||||
|
print(res) |
||||||
|
send('爱奇艺', res) |
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__": |
||||||
|
start() |
Loading…
Reference in new issue