From a69e0901491db288efd76da11eb900718f199a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B4=9B?= Date: Sat, 24 Jul 2021 17:18:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 +++-- ck_163music.py | 177 --------------------------- bilibili.py => ck_bilibili.py | 1 + ck_cloud189.py | 155 ++++++++++++++++++++++++ hlx.py => ck_hlx.py | 221 +++++++++++++++++----------------- ck_iqiyi.py | 216 +++++++++++++++++++++++++++++++++ ck_vqq.py | 12 +- wzyd.py => ck_wzyd.py | 1 + 8 files changed, 518 insertions(+), 297 deletions(-) delete mode 100644 ck_163music.py rename bilibili.py => ck_bilibili.py (99%) create mode 100644 ck_cloud189.py rename hlx.py => ck_hlx.py (89%) create mode 100644 ck_iqiyi.py rename wzyd.py => ck_wzyd.py (96%) diff --git a/README.md b/README.md index 1b48e7e..335f434 100644 --- a/README.md +++ b/README.md @@ -12,19 +12,37 @@ [青龙](https://github.com/whyour/qinglong.git) +代码来自于[Sitoi/dailycheckin](https://github.com/Sitoi/dailycheckin.git) +## 特别声明 +- 本仓库发布的脚本及其中涉及的任何解锁和解密分析脚本,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断。 + +- 本项目内所有资源文件,禁止任何公众号、自媒体进行任何形式的转载、发布。 + +- 本人对任何脚本问题概不负责,包括但不限于由任何脚本错误导致的任何损失或损害。 + +- 间接使用脚本的任何用户,包括但不限于建立VPS或在某些行为违反国家/地区法律或相关法规的情况下进行传播, 本人对于由此引起的任何隐私泄漏或其他后果概不负责。 + +- 请勿将本仓库的任何内容用于商业或非法目的,否则后果自负。 + +- 如果任何单位或个人认为该项目的脚本可能涉嫌侵犯其权利,则应及时通知并提供身份证明,所有权证明,我们将在收到认证文件后删除相关脚本。 + +- 任何以任何方式查看此项目的人或直接或间接使用该项目的任何脚本的使用者都应仔细阅读此声明。本人保留随时更改或补充此免责声明的权利。一旦使用并复制了任何相关脚本或Script项目的规则,则视为您已接受此免责声明。 + +**您必须在下载后的24小时内从计算机或手机中完全删除以上内容** + +> ***您使用或者复制了本仓库且本人制作的任何脚本,则视为 `已接受` 此声明,请仔细阅读*** ## 使用方法 ### 1拉取仓库 -ql repo https://gitee.com/zhangluo0104/check.git "" "^checksendNotify|^getENV" +ql repo https://gitee.com/zhangluo0104/check.git "ck" "^checksendNotify|^getENV" -### 2参数列表 +### 2配置 -| 值 | 名称 | 例子 | 说明 | -| :----------: | ------------ | ------------------------------------------------------------ | ------------------- | -| 葫芦侠用户名 | hlx_username | '13888888888' | | -| 葫芦侠密钥 | hlx_password | 7607db7a5bbbbbec8c7bbbbbbb | 密码的32位小md5加密 | -| 王者营地 | wzyd | areaId=xxxxxx&roleId=xxxxxx&gameId=xxxxxx&serverId=xxxxxx&gameOpenid=xxxxxx&userId=xxxxxx、&appVersion=xxxxxx&cClientVersionName=xxxxxx&platid=xxxxxx&source=xxxxxx&algorithm=xxxxxx&、version=xxxxxx×tamp=xxxxxx&appid=xxxxxx&openid=xxxxxx&sig=xxxxxx&encode=2&、msdkEncodeParam=xxxxxx&、cSystem=xxxxxx&h5Get=xxxxxx&msdkToken=&appOpenid=xxxxxx | 抓包获得 | +可以参见原文档的config.json +[这里](https://sitoi.gitee.io/dailycheckin/settings/) +编辑好后放入青龙目录/ql/config/check.json +😘记得修改文件名字 diff --git a/ck_163music.py b/ck_163music.py deleted file mode 100644 index acc0503..0000000 --- a/ck_163music.py +++ /dev/null @@ -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) \ No newline at end of file diff --git a/bilibili.py b/ck_bilibili.py similarity index 99% rename from bilibili.py rename to ck_bilibili.py index 55cc6f8..d7fa66c 100644 --- a/bilibili.py +++ b/ck_bilibili.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# 20 7 * * * import json import os diff --git a/ck_cloud189.py b/ck_cloud189.py new file mode 100644 index 0000000..945db4d --- /dev/null +++ b/ck_cloud189.py @@ -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() diff --git a/hlx.py b/ck_hlx.py similarity index 89% rename from hlx.py rename to ck_hlx.py index 4ab6f2f..42403b1 100644 --- a/hlx.py +++ b/ck_hlx.py @@ -1,110 +1,111 @@ -#20 9 * * * https://raw.githubusercontent.com/yuxian158/check/master/hlx.py, tag=葫芦侠签到, enabled=true - -import requests -import os -from checksendNotify import send -r = requests.Session() - - -def login(user, passwd): - url = 'http://floor.huluxia.com/account/login/ANDROID/4.0?platform=2&gkey=000000&app_version=4.0.0.6.2' \ - '&versioncode=20141433&market_id=floor_baidu&_key=&device_code=%5Bw%5D02%3A00%3A00%3A00%3A00%3A00 ' - params = { - 'account': user, - 'login_type': '2', - 'password': passwd - } - login_res = r.post(url=url, data=params) - login_res = login_res.json() - nick = login_res['user']['nick'] - key = login_res['_key'] - s_key = login_res['session_key'] - return nick, key, s_key - - -def check(key): - url1 = 'http://floor.huluxia.com/user/status/ANDROID/2.1' - params = { - 'platform': '2', - 'gkey': '000000', - 'app_version': '4.0.0.6.3', - 'versioncode': '20141434', - 'market_id': 'floor_baidu', - '_key': key, - 'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00', - } - check_req = r.get(url=url1, params=params) - check_req = check_req.json() - status = check_req['status'] - if status == 0: - raise Exception("令牌验证失败") - elif status == 1: - pass - return status - - -def category(key): - global experienceVal - titles = [] - categoryIDs = [] - category_url = 'http://floor.huluxia.com/category/list/ANDROID/2.0' - params = { - 'platform': '2', - 'gkey': '000000', - 'app_version': '4.0.0.6.3', - 'versioncode': '20141434', - 'market_id': 'floor_huluxia', - '_key': key, - 'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00', - 'is_hidden': '1' - } - category_res = r.get(url=category_url, params=params) - category_res = category_res.json() - category_res = category_res["categories"] - for i in range(3, len(category_res)): - res = category_res[i] - titles.append(res['title']) - categoryIDs.append(res['categoryID']) - #print(res) - url = f'http://floor.huluxia.com/user/signin/ANDROID/4.0' - all_experienceVal = 0 - for i in range(0, len(categoryIDs)): - IDS = str(categoryIDs[i]) - params = { - 'platform': '2', - 'gkey': '000000', - 'app_version': '4.0.0.6.3', - 'versioncode': '20141434', - 'market_id': 'floor_baidu', - '_key': key, - 'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00', - 'cat_id': IDS - } - try: - experienceVal = r.get(url=url, params=params).json()['experienceVal'] - except: - experienceVal = 0 - finally: - all_experienceVal = all_experienceVal + experienceVal - return '签到成功 共获得{}点经验'.format(all_experienceVal) - - -def hlx(user, passwd): - nick, key, s_key = login(user, passwd) - check(key) - return "用户名:" + nick + category(key) - - -def start(): - scriptName = '葫芦侠签到' - print(scriptName) - if "hlx_username" in os.environ and "hlx_password" in os.environ: - print('已经在环境中找到用户名和密码,开始执行程序') - res = hlx(os.environ['hlx_username'], os.environ['hlx_password']) - result = f' {scriptName} \n {res}' - send("葫芦侠",result) - else: - print('未找到用户名和密码停止执行') - -if __name__ == '__main__': - start() +# 20 9 * * * +import requests +import os +from checksendNotify import send + +r = requests.Session() + + +def login(user, passwd): + url = 'http://floor.huluxia.com/account/login/ANDROID/4.0?platform=2&gkey=000000&app_version=4.0.0.6.2' \ + '&versioncode=20141433&market_id=floor_baidu&_key=&device_code=%5Bw%5D02%3A00%3A00%3A00%3A00%3A00 ' + params = { + 'account': user, + 'login_type': '2', + 'password': passwd + } + login_res = r.post(url=url, data=params) + login_res = login_res.json() + nick = login_res['user']['nick'] + key = login_res['_key'] + s_key = login_res['session_key'] + return nick, key, s_key + + +def check(key): + url1 = 'http://floor.huluxia.com/user/status/ANDROID/2.1' + params = { + 'platform': '2', + 'gkey': '000000', + 'app_version': '4.0.0.6.3', + 'versioncode': '20141434', + 'market_id': 'floor_baidu', + '_key': key, + 'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00', + } + check_req = r.get(url=url1, params=params) + check_req = check_req.json() + status = check_req['status'] + if status == 0: + raise Exception("令牌验证失败") + elif status == 1: + pass + return status + + +def category(key): + global experienceVal + titles = [] + categoryIDs = [] + category_url = 'http://floor.huluxia.com/category/list/ANDROID/2.0' + params = { + 'platform': '2', + 'gkey': '000000', + 'app_version': '4.0.0.6.3', + 'versioncode': '20141434', + 'market_id': 'floor_huluxia', + '_key': key, + 'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00', + 'is_hidden': '1' + } + category_res = r.get(url=category_url, params=params) + category_res = category_res.json() + category_res = category_res["categories"] + for i in range(3, len(category_res)): + res = category_res[i] + titles.append(res['title']) + categoryIDs.append(res['categoryID']) + # print(res) + url = f'http://floor.huluxia.com/user/signin/ANDROID/4.0' + all_experienceVal = 0 + for i in range(0, len(categoryIDs)): + IDS = str(categoryIDs[i]) + params = { + 'platform': '2', + 'gkey': '000000', + 'app_version': '4.0.0.6.3', + 'versioncode': '20141434', + 'market_id': 'floor_baidu', + '_key': key, + 'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00', + 'cat_id': IDS + } + try: + experienceVal = r.get(url=url, params=params).json()['experienceVal'] + except: + experienceVal = 0 + finally: + all_experienceVal = all_experienceVal + experienceVal + return '签到成功 共获得{}点经验'.format(all_experienceVal) + + +def hlx(user, passwd): + nick, key, s_key = login(user, passwd) + check(key) + return "用户名:" + nick + category(key) + + +def start(): + scriptName = '葫芦侠签到' + print(scriptName) + if "hlx_username" in os.environ and "hlx_password" in os.environ: + print('已经在环境中找到用户名和密码,开始执行程序') + res = hlx(os.environ['hlx_username'], os.environ['hlx_password']) + result = f' {scriptName} \n {res}' + send("葫芦侠", result) + else: + print('未找到用户名和密码停止执行') + + +if __name__ == '__main__': + start() diff --git a/ck_iqiyi.py b/ck_iqiyi.py new file mode 100644 index 0000000..ace2332 --- /dev/null +++ b/ck_iqiyi.py @@ -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() diff --git a/ck_vqq.py b/ck_vqq.py index 06f4686..6f22aa8 100644 --- a/ck_vqq.py +++ b/ck_vqq.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# 56 23 * * * import json import os import re @@ -10,6 +11,7 @@ from requests import utils from getENV import getENv from checksendNotify import send + class VQQCheckIn: def __init__(self, check_item): self.check_item = check_item @@ -115,11 +117,15 @@ class VQQCheckIn: return msg -if __name__ == "__main__": +def start(): getENv() with open("/ql/config/check.json", "r", encoding="utf-8") as f: datas = json.loads(f.read()) _check_item = datas.get("VQQ_COOKIE_LIST", [])[0] - res=VQQCheckIn(check_item=_check_item).main() + res = VQQCheckIn(check_item=_check_item).main() print(res) - send('腾讯视频',res) + send('腾讯视频', res) + + +if __name__ == "__main__": + start() diff --git a/wzyd.py b/ck_wzyd.py similarity index 96% rename from wzyd.py rename to ck_wzyd.py index b821107..0a1ed27 100644 --- a/wzyd.py +++ b/ck_wzyd.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# 20 10 * * * import json import os import time