From 71221cd17b2e81a217e97063a74de8777e3c29ec Mon Sep 17 00:00:00 2001 From: yuxian158 Date: Wed, 22 Dec 2021 10:09:34 +0800 Subject: [PATCH] by sitoi/dailycheckin --- dailycheckin_scripts/README.md | 81 +++++ dailycheckin_scripts/ck_2nzz.py | 77 +++++ dailycheckin_scripts/ck_52pojie.py | 64 ++++ dailycheckin_scripts/ck_AcFun.py | 153 ++++++++++ dailycheckin_scripts/ck_EVERPHOTO.py | 83 +++++ dailycheckin_scripts/ck_baidu.py | 64 ++++ dailycheckin_scripts/ck_bilibili.py | 335 ++++++++++++++++++++ dailycheckin_scripts/ck_cloud189.py | 164 ++++++++++ dailycheckin_scripts/ck_csdn.py | 64 ++++ dailycheckin_scripts/ck_duokan.py | 370 ++++++++++++++++++++++ dailycheckin_scripts/ck_fmapp.py | 109 +++++++ dailycheckin_scripts/ck_iqiyi.py | 232 ++++++++++++++ dailycheckin_scripts/ck_kgqq.py | 146 +++++++++ dailycheckin_scripts/ck_meizu.py | 110 +++++++ dailycheckin_scripts/ck_mgtv.py | 77 +++++ dailycheckin_scripts/ck_mimotion.py | 118 ++++++++ dailycheckin_scripts/ck_music163.py | 188 ++++++++++++ dailycheckin_scripts/ck_oneplusBBS.py | 120 ++++++++ dailycheckin_scripts/ck_picacomic.py | 95 ++++++ dailycheckin_scripts/ck_smzdm.py | 79 +++++ dailycheckin_scripts/ck_tieba.py | 112 +++++++ dailycheckin_scripts/ck_unicom.py | 349 +++++++++++++++++++++ dailycheckin_scripts/ck_v2ex.py | 88 ++++++ dailycheckin_scripts/ck_vqq.py | 134 ++++++++ dailycheckin_scripts/ck_weibo.py | 126 ++++++++ dailycheckin_scripts/ck_womail.py | 421 ++++++++++++++++++++++++++ dailycheckin_scripts/ck_wzyd.py | 54 ++++ dailycheckin_scripts/ck_youdao.py | 68 +++++ dailycheckin_scripts/ck_zhiyoo.py | 77 +++++ 29 files changed, 4158 insertions(+) create mode 100644 dailycheckin_scripts/README.md create mode 100644 dailycheckin_scripts/ck_2nzz.py create mode 100644 dailycheckin_scripts/ck_52pojie.py create mode 100644 dailycheckin_scripts/ck_AcFun.py create mode 100644 dailycheckin_scripts/ck_EVERPHOTO.py create mode 100644 dailycheckin_scripts/ck_baidu.py create mode 100644 dailycheckin_scripts/ck_bilibili.py create mode 100644 dailycheckin_scripts/ck_cloud189.py create mode 100644 dailycheckin_scripts/ck_csdn.py create mode 100644 dailycheckin_scripts/ck_duokan.py create mode 100644 dailycheckin_scripts/ck_fmapp.py create mode 100644 dailycheckin_scripts/ck_iqiyi.py create mode 100644 dailycheckin_scripts/ck_kgqq.py create mode 100644 dailycheckin_scripts/ck_meizu.py create mode 100644 dailycheckin_scripts/ck_mgtv.py create mode 100644 dailycheckin_scripts/ck_mimotion.py create mode 100644 dailycheckin_scripts/ck_music163.py create mode 100644 dailycheckin_scripts/ck_oneplusBBS.py create mode 100644 dailycheckin_scripts/ck_picacomic.py create mode 100644 dailycheckin_scripts/ck_smzdm.py create mode 100644 dailycheckin_scripts/ck_tieba.py create mode 100644 dailycheckin_scripts/ck_unicom.py create mode 100644 dailycheckin_scripts/ck_v2ex.py create mode 100644 dailycheckin_scripts/ck_vqq.py create mode 100644 dailycheckin_scripts/ck_weibo.py create mode 100644 dailycheckin_scripts/ck_womail.py create mode 100644 dailycheckin_scripts/ck_wzyd.py create mode 100644 dailycheckin_scripts/ck_youdao.py create mode 100644 dailycheckin_scripts/ck_zhiyoo.py diff --git a/dailycheckin_scripts/README.md b/dailycheckin_scripts/README.md new file mode 100644 index 0000000..77fc7f5 --- /dev/null +++ b/dailycheckin_scripts/README.md @@ -0,0 +1,81 @@ +# 配置说明 + +## 参数说明 + +### Web 签到配置 + +| Name | 归属 | 属性 | 说明 | +| :------------------------: | :-------------------------------------------------: | :--: | :----------------------------------------------------------- | +| _**IQIYI**_.cookie | [爱奇艺](https://www.iqiyi.com/) | Web | 爱奇艺 帐号的 cookie 信息 | +| _**KGQQ**_.cookie | [全民K歌](https://kg.qq.com/index-pc.html) | Web | 全民K歌 帐号的 cookie 信息 | +| _**VQQ**_.auth_refresh | [腾讯视频](https://v.qq.com/) | Web | 腾讯视频 搜索 带有 `auth_refresh` 的 url,填写其完整的 URL | +| _**VQQ**_.cookie | [腾讯视频](https://v.qq.com/) | Web | 腾讯视频 搜索 带有 `auth_refresh` 的 url,填写其对应的 cookie | +| _**YOUDAO**_.cookie | [有道云笔记](https://note.youdao.com/web/) | Web | 有道云笔记 帐号的 cookie 信息 | +| _**MUSIC163**_.phone | [网易云音乐](https://music.163.com/) | 账号 | 网易云音乐 帐号的手机号 | +| _**MUSIC163**_.password | [网易云音乐](https://music.163.com/) | 账号 | 网易云音乐 帐号的密码 | +| _**ONEPLUSBBS**_.cookie | [一加手机社区官方论坛](https://www.oneplusbbs.com/) | Web | 一加手机社区官方论坛 账户的 cookie | +| _**TIEBA**_.cookie | [百度贴吧](https://tieba.baidu.com/index.html) | Web | 百度贴吧 cookie | +| _**BILIBILI**_.cookie | [Bilibili](https://www.bilibili.com) | Web | Bilibili cookie | +| _**BILIBILI**_.coin_num | [Bilibili](https://www.bilibili.com) | Web | Bilibili 每日投币数量 | +| _**BILIBILI**_.coin_type | [Bilibili](https://www.bilibili.com) | Web | Bilibili 投币方式 默认为 0 ;1: 为关注用户列表视频投币 0: 为随机投币。如果关注用户发布的视频不足配置的投币数,则剩余部分使用随机投币 | +| _**BILIBILI**_.silver2coin | [Bilibili](https://www.bilibili.com) | Web | Bilibili 是否开启银瓜子换硬币,默认为 True 开启 | +| _**V2EX**_.cookie | [V2EX](https://www.v2ex.com/) | Web | V2EX 每日签到 | +| _**V2EX**_.proxy | [V2EX](https://www.v2ex.com/) | Web | V2EX 代理的信息,无密码例子: http://127.0.0.1:1080 有密码例子: http://username:password@127.0.0.1:1080 | +| _**WWW2NZZ**_.cookie | [咔叽网单](https://www.2nzz.com/) | Web | 咔叽网单 每日签到 | +| _**SMZDM**_.cookie | [什么值得买](https://www.smzdm.com) | Web | 什么值得买 每日签到 | +| _**CLOUD189**_.phone | [天翼云盘](https://cloud.189.cn/) | Web | 天翼云盘 手机号 | +| _**CLOUD189**_.password | [天翼云盘](https://cloud.189.cn/) | Web | 天翼云盘 手机号对应的密码 | +| _**POJIE**_.cookie | [吾爱破解](https://www.52pojie.cn/index.php) | Web | 吾爱破解 cookie | +| _**MEIZU**_.cookie | [MEIZU 社区](https://bbs.meizu.cn) | Web | MEIZU 社区 cookie | +| _**MEIZU**_.draw_count | [MEIZU 社区](https://bbs.meizu.cn) | Web | MEIZU 社区 抽奖次数 | +| _**ZHIYOO**_.cookie | [智友邦](http://zhizhiyoo.net/) | Web | 智友邦 WEB Cookie | +| _**CSDN**_.cookie | [CSDN](https://www.csdn.net/) | Web | CSDN Cookie | +| _**EVERPHOTO**_.mobile | [时光相册](https://web.everphoto.cn/) | Web | 时光相册 https://web.everphoto.cn/api/auth URL 表单内的 mobile 数据 | +| _**EVERPHOTO**_.password | [时光相册](https://web.everphoto.cn/) | Web | 时光相册 https://web.everphoto.cn/api/auth URL 表单内的 password 数据 | + +### 公众号签到配置 + +| Name | 归属 | 属性 | 说明 | +| :----------------------: | :--------: | :----: | :----------------------------------------------------------- | +| _**WOMAIL**_.url | 联通沃邮箱 | 公众号 | 联通沃邮箱 公众号 `https://nyan.mail.wo.cn/cn/sign/index/index?mobile` 开头的 URL | +| _**WOMAIL**_.pause21days | 联通沃邮箱 | 公众号 | true: 开启21天自动暂停,false: 关闭自动暂停,每天都签到。默认开启自动暂停 | +| _**WOMAIL**_.phone | 联通沃邮箱 | 公众号 | 手机号 | +| _**WOMAIL**_.password | 联通沃邮箱 | 公众号 | 密码 | + +### APP 签到配置 + +| Name | 归属 | 属性 | 说明 | +| :----------------------: | :-----------------------------------: | :--: | :----------------------------------------------------------- | +| _**FMAPP**_.token | Fa米家 | APP | Fa米家 APP headers 中的 token | +| _**FMAPP**_.cookie | Fa米家 | APP | Fa米家 APP headers 中的 cookie | +| _**FMAPP**_.blackbox | Fa米家 | APP | Fa米家 APP headers 中的 blackBox | +| _**FMAPP**_.device_id | Fa米家 | APP | Fa米家 APP headers 中的 deviceId | +| _**FMAPP**_.fmversion | Fa米家 | APP | Fa米家 APP headers 中的 fmVersion | +| _**FMAPP**_.os | Fa米家 | APP | Fa米家 APP headers 中的 os | +| _**FMAPP**_.useragent | Fa米家 | APP | Fa米家 APP headers 中的 User-Agent | +| _**ACFUN**_.phone | [AcFun](https://www.acfun.cn/) | APP | AcFun 手机账号 | +| _**ACFUN**_.password | [AcFun](https://www.acfun.cn/) | APP | AcFun 账号密码 | +| _**MGTV**_.params | 芒果 TV | APP | 芒果 TV 请求参数 | +| _**PICACOMIC**_.email | [哔咔漫画](https://www.picacomic.com) | APP | 哔咔漫画 账号 | +| _**PICACOMIC**_.password | [哔咔漫画](https://www.picacomic.com) | APP | 哔咔漫画 密码 | +| _**WEIBO**_.url | 微博 | APP | 抓取开头为 `https://api.weibo.cn/2/users/show?` 的整个 url 填入即可 | +| _**DUOKAN**_.cookie | 多看阅读 | APP | 多看阅读 cookie, 抓取开头为 `https://www.duokan.com` 下的 cookie 即可 | +| _**WZYD**_.data | 王者营地 | APP | 王者营地 请求体中的 data, 抓包 APP 中域名为 `https://ssl.kohsocial.qq.com` 请求内容的全部参数 | +| _**HEYTAP**_.cookie | 欢太商城 | APP | 欢太商城 请求体中的 Cookie, 抓包 APP 中域名为 `https://store.oppo.com/` 请求内容的 Cookie | +| _**HEYTAP**_.useragent | 欢太商城 | APP | 欢太商城 请求体中的 User-Agent, 抓包 APP 中域名为 `https://store.oppo.com/` 请求内容的 User-Agent | +| _**HEYTAP**_.draw | 欢太商城 | APP | 是否开启抽奖,默认 false | +| _**UNICOM**_.mobile | 联通营业厅 | APP | 联通营业厅 手机号 | +| _**UNICOM**_.password | 联通营业厅 | APP | 联通营业厅 6位登录密码 | +| _**UNICOM**_.app_id | 联通营业厅 | APP | 联通营业厅 请求体中的 appId, 抓包 APP 中域名为 `https://m.client.10010.com/mobileService/login.htm` 请求内容的 appId | + +### 其他任务配置 + +| Name | 归属 | 属性 | 说明 | +| :---------------------: | :-------------------------------------------------------: | :--: | :-------------------------------------- | +| _**MIMOTION**_.phone | 小米运动 | 其他 | 小米运动刷步数的手机账号 | +| _**MIMOTION**_.password | 小米运动 | 其他 | 小米运动刷步数的手机账号密码 | +| _**MIMOTION**_.min_step | 小米运动 | 其他 | 小米运动刷步数的最小步数 | +| _**MIMOTION**_.max_step | 小米运动 | 其他 | 小米运动刷步数的最大步数 | +| _**BAIDUT**_.data_url | [百度搜索资源平台](https://ziyuan.baidu.com/site/index#/) | 其他 | 提交网站的 URL 链接 | +| _**BAIDUT**_.submit_url | [百度搜索资源平台](https://ziyuan.baidu.com/site/index#/) | 其他 | 百度搜索资源平台 提交百度网站的目标 URL | +| _**BAIDUT**_.times | [百度搜索资源平台](https://ziyuan.baidu.com/site/index#/) | 其他 | 每日对同一个网站提交次数 | diff --git a/dailycheckin_scripts/ck_2nzz.py b/dailycheckin_scripts/ck_2nzz.py new file mode 100644 index 0000000..e2d50e0 --- /dev/null +++ b/dailycheckin_scripts/ck_2nzz.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +""" +new Env('咔叽网单'); +""" +import re + +import requests +import urllib3 +from requests import utils + +from utils import check + +urllib3.disable_warnings() + + +class WWW2NZZ: + name = "咔叽网单" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(session): + response = session.get(url="http://www.2nzz.com/index.php", verify=False) + formhash = re.findall(r'(.*?)", response.text, re.S) + check_msg = check_msg[0].strip() if check_msg else "签到失败" + msg = [ + {"name": "账号信息", "value": uid}, + {"name": "签到信息", "value": check_msg}, + ] + return msg + + def main(self): + cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("cookie").split("; ")} + session = requests.session() + requests.utils.add_dict_to_cookiejar(session.cookies, cookie) + session.headers.update( + { + "Origin": "http://www.2nzz.com", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74", + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", + "Referer": "http://www.2nzz.com/index.php", + "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", + } + ) + msg = self.sign(session=session) + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="小米运动",run_script_expression="WWW2NZZ") +def main(*args, **kwargs): + return WWW2NZZ(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() + diff --git a/dailycheckin_scripts/ck_52pojie.py b/dailycheckin_scripts/ck_52pojie.py new file mode 100644 index 0000000..f8617e1 --- /dev/null +++ b/dailycheckin_scripts/ck_52pojie.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +""" +new Env('吾爱破解'); +""" +from utils import check +import re + +import requests + + +class Pojie: + name = "吾爱破解" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(headers): + msg = "" + try: + session = requests.session() + session.get(url="https://www.52pojie.cn/home.php?mod=task&do=apply&id=2", headers=headers) + resp = session.get(url="https://www.52pojie.cn/home.php?mod=task&do=draw&id=2", headers=headers) + content = re.findall(r'
(.*?)

', resp.text)[0] + if "您需要先登录才能继续本操作" in resp.text: + msg += "吾爱破解 cookie 失效" + elif "安域防护节点" in resp.text: + msg += "触发吾爱破解安全防护,访问出错。自行修改脚本运行时间和次数,总有能访问到的时间" + elif "恭喜" in resp.text: + msg += "吾爱破解签到成功" + else: + msg += content + except Exception as e: + print("签到错误", e) + msg += "吾爱破解出错" + return msg + + def main(self): + cookie = self.check_item.get("cookie") + headers = { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36", + "Cookie": cookie, + "ContentType": "text/html;charset=gbk", + } + try: + uid = re.findall(r"htVD_2132_lastcheckfeed=(.*?);", cookie)[0].split("%7C")[0] + except Exception as e: + print(e) + uid = "未获取到用户 uid" + sign_msg = self.sign(headers=headers) + msg = [ + {"name": "帐号信息", "value": f"{uid}"}, + {"name": "签到信息", "value": f"{sign_msg}"}, + ] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + +@check(run_script_name="吾爱破解", run_script_expression="POJIE") +def main(*args, **kwargs): + return Pojie(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_AcFun.py b/dailycheckin_scripts/ck_AcFun.py new file mode 100644 index 0000000..f51ce39 --- /dev/null +++ b/dailycheckin_scripts/ck_AcFun.py @@ -0,0 +1,153 @@ +# -*- coding: utf-8 -*- +""" +new Env('ACFUN'); +""" + +import requests +import urllib3 + +from utils import check + +urllib3.disable_warnings() + + +class AcFun(object): + name = "AcFun" + + def __init__(self, check_item: dict): + self.check_item = check_item + self.contentid = "27259341" + + @staticmethod + def get_cookies(session, phone, password): + url = "https://id.app.acfun.cn/rest/app/login/signin" + headers = { + "Host": "id.app.acfun.cn", + "user-agent": "AcFun/6.39.0 (iPhone; iOS 14.3; Scale/2.00)", + "devicetype": "0", + "accept-language": "zh-Hans-CN;q=1, en-CN;q=0.9, ja-CN;q=0.8, zh-Hant-HK;q=0.7, io-Latn-CN;q=0.6", + "accept": "application/json", + "content-type": "application/x-www-form-urlencoded", + } + data = f"password={password}&username={phone}" + response = session.post(url=url, data=data, headers=headers, verify=False) + acpasstoken = response.json().get("acPassToken") + auth_key = str(response.json().get("auth_key")) + if acpasstoken and auth_key: + cookies = {"acPasstoken": acpasstoken, "auth_key": auth_key} + return cookies + else: + return False + + @staticmethod + def get_token(session, cookies): + url = "https://id.app.acfun.cn/rest/web/token/get" + headers = { + "Content-Type": "application/x-www-form-urlencoded", + } + response = session.post(url=url, cookies=cookies, data="sid=acfun.midground.api", headers=headers, verify=False) + return response.json().get("acfun.midground.api_st") + + def get_video(self, session): + url = "https://www.acfun.cn/rest/pc-direct/rank/channel" + data = "channelId=0&rankPeriod=DAY" + headers = { + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70", + } + response = session.post(url=url, data=data, headers=headers, verify=False) + self.contentid = response.json().get("rankList")[0].get("contentId") + return self.contentid + + @staticmethod + def sign(session, cookies): + headers = { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70" + } + response = session.post( + url="https://www.acfun.cn/rest/pc-direct/user/signIn", headers=headers, cookies=cookies, verify=False + ) + return {"name": "签到信息", "value": response.json().get("msg")} + + @staticmethod + def danmu(session, cookies): + url = "https://www.acfun.cn/rest/pc-direct/new-danmaku/add" + body = "body=sitoi&color=16777215&id=27259341&mode=1&position=5019&size=25&subChannelId=84&subChannelName=%E4%B8%BB%E6%9C%BA%E5%8D%95%E6%9C%BA&type=douga&videoId=22898696" + headers = { + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70", + } + response = session.post(url=url, headers=headers, cookies=cookies, data=body, verify=False) + if response.json().get("result") == 0: + msg = "弹幕成功" + else: + msg = "弹幕失败" + return {"name": "弹幕任务", "value": msg} + + def throwbanana(self, session, cookies): + url = "https://www.acfun.cn/rest/pc-direct/banana/throwBanana" + body = f"count=1&resourceId={self.contentid}&resourceType=2" + headers = { + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70", + } + response = session.post(url=url, headers=headers, cookies=cookies, data=body, verify=False) + if response.json().get("result") == 0: + msg = "香蕉成功" + else: + msg = "香蕉失败" + return {"name": "香蕉任务", "value": msg} + + def like(self, session, token): + like_url = "https://api.kuaishouzt.com/rest/zt/interact/add" + unlike_url = "https://api.kuaishouzt.com/rest/zt/interact/delete" + headers = { + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70", + } + cookies = {"acfun.midground.api_st": token, "kpn": "ACFUN_APP"} + body = f"interactType=1&objectId={self.contentid}&objectType=2&subBiz=mainApp" + response = session.post(url=like_url, headers=headers, cookies=cookies, data=body, verify=False) + session.post(url=unlike_url, headers=headers, cookies=cookies, data=body, verify=False) + if response.json().get("result") == 1: + msg = "点赞成功" + else: + msg = "点赞失败" + return {"name": "点赞任务", "value": msg} + + def share(self, session, cookies): + url = "https://api-ipv6.acfunchina.com/rest/app/task/reportTaskAction?taskType=1&market=tencent&product=ACFUN_APP&appMode=0" + headers = { + "Content-Type": "application/x-www-form-urlencoded", + } + response = session.get(url=url, headers=headers, cookies=cookies, verify=False) + if response.json().get("result") == 0: + msg = "分享成功" + else: + msg = "分享失败" + return {"name": "分享任务", "value": msg} + + def main(self): + phone = self.check_item.get("phone") + password = self.check_item.get("password") + session = requests.session() + self.get_video(session=session) + cookies = self.get_cookies(session=session, phone=phone, password=password) + token = self.get_token(session=session, cookies=cookies) + sign_msg = self.sign(session=session, cookies=cookies) + like_msg = self.like(session=session, token=token) + # share_msg = self.share(session=session, cookies=cookies) + # danmu_msg = self.danmu(session=session, cookies=cookies) + # throwbanana_msg = self.throwbanana(session=session, cookies=cookies) + msg = [{"name": "帐号信息", "value": phone}, sign_msg, like_msg] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="ACFUN",run_script_expression="ACF") +def main(*args, **kwargs): + return AcFun(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_EVERPHOTO.py b/dailycheckin_scripts/ck_EVERPHOTO.py new file mode 100644 index 0000000..3b704b2 --- /dev/null +++ b/dailycheckin_scripts/ck_EVERPHOTO.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +""" +new Env('时光相册'); +""" +import requests + +from utils import check + + +class EverPhoto: + name = "时光相册" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(mobile, password): + headers = { + "content-type": "application/x-www-form-urlencoded; charset=UTF-8", + "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.38", + "accept": "*/*", + "origin": "https://web.everphoto.cn", + "referer": "https://web.everphoto.cn/", + "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", + } + + data = {"mobile": mobile, "password": password} + try: + response = requests.post(url="https://web.everphoto.cn/api/auth", headers=headers, data=data).json() + if response.get("code") == 0: + data = response.get("data") + token = data.get("token") + mobile = data.get("user_profile", {}).get("mobile") + return token, {"name": "账号信息", "value": mobile} + else: + return False, {"name": "账号信息", "value": "登录失败"} + except Exception as e: + return False, {"name": "账号信息", "value": "登录失败"} + + @staticmethod + def checkin(token): + headers = { + "content-type": "application/x-www-form-urlencoded; charset=UTF-8", + "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.38", + "accept": "*/*", + "origin": "https://web.everphoto.cn", + "authorization": f"Bearer {token}", + "referer": "https://web.everphoto.cn/", + "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", + } + try: + response = requests.post(url="https://api.everphoto.cn/users/self/checkin/v2", headers=headers).json() + if response.get("code") == 0: + data = response.get("data") + checkin_result = data.get("checkin_result") + if checkin_result: + return {"name": "签到信息", "value": "签到成功"} + else: + return {"name": "签到信息", "value": "已签到过或签到失败"} + else: + return {"name": "签到信息", "value": "签到失败"} + except Exception as e: + return {"name": "签到信息", "value": "签到失败"} + + def main(self): + mobile = self.check_item.get("mobile") + password = self.check_item.get("password") + token, sign_msg = self.sign(mobile=mobile, password=password) + msg = [sign_msg] + if token: + checkin_msg = self.checkin(token=token) + msg.append(checkin_msg) + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="时光相册", run_script_expression="EVERPHOTO|时光") +def main(*args, **kwargs): + return EverPhoto(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_baidu.py b/dailycheckin_scripts/ck_baidu.py new file mode 100644 index 0000000..979272c --- /dev/null +++ b/dailycheckin_scripts/ck_baidu.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +""" +new Env('百度站点提交'); +""" + +from urllib import parse + +import requests + +from utils import check + + +class Baidu(object): + name = "百度站点提交" + + def __init__(self, check_item: dict): + self.check_item = check_item + + @staticmethod + def url_submit(data_url: str, submit_url: str, times: int = 100) -> str: + site = parse.parse_qs(parse.urlsplit(submit_url).query).get("site")[0] + urls_data = requests.get(url=data_url) + remian = 100000 + success_count = 0 + error_count = 0 + for one in range(times): + try: + response = requests.post(url=submit_url, data=urls_data) + if response.json().get("success"): + remian = response.json().get("remain") + success_count += response.json().get("success") + else: + error_count += 1 + except Exception as e: + print(e) + error_count += 1 + msg = [ + {"name": "站点地址", "value": site}, + {"name": "剩余条数", "value": remian}, + {"name": "成功条数", "value": success_count}, + {"name": "成功次数", "value": times - error_count}, + {"name": "失败次数", "value": error_count}, + ] + return msg + + def main(self): + data_url = self.check_item.get("data_url") + submit_url = self.check_item.get("submit_url") + times = int(self.check_item.get("times", 100)) + if data_url and submit_url: + msg = self.url_submit(data_url=data_url, submit_url=submit_url, times=times) + else: + msg = {"name": "站点配置", "value": "配置错误"} + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="百度站点提交", run_script_expression="baidu") +def main(*args, **kwargs): + return Baidu(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_bilibili.py b/dailycheckin_scripts/ck_bilibili.py new file mode 100644 index 0000000..924f522 --- /dev/null +++ b/dailycheckin_scripts/ck_bilibili.py @@ -0,0 +1,335 @@ +# -*- coding: utf-8 -*- +""" +cron: 30 8 * * * +new Env('哔哩哔哩'); +""" +import requests +from requests import utils + +from utils import check + + +class BiliBili(): + name = "Bilibili" + + # TODO 待测试,需要大会员账号测试领取福利 + def __init__(self, check_item: dict): + self.check_item = check_item + + @staticmethod + def get_nav(session): + url = "https://api.bilibili.com/x/web-interface/nav" + ret = session.get(url=url).json() + uname = ret.get("data", {}).get("uname") + uid = ret.get("data", {}).get("mid") + is_login = ret.get("data", {}).get("isLogin") + coin = ret.get("data", {}).get("money") + vip_type = ret.get("data", {}).get("vipType") + current_exp = ret.get("data", {}).get("level_info", {}).get("current_exp") + return uname, uid, is_login, coin, vip_type, current_exp + + @staticmethod + def reward(session) -> dict: + """取B站经验信息""" + url = "https://account.bilibili.com/home/reward" + ret = session.get(url=url).json() + return ret + + @staticmethod + def live_sign(session) -> dict: + """B站直播签到""" + try: + url = "https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/DoSign" + ret = session.get(url=url).json() + if ret["code"] == 0: + msg = f'签到成功,{ret["data"]["text"]},特别信息:{ret["data"]["specialText"]},本月已签到{ret["data"]["hadSignDays"]}天' + elif ret["code"] == 1011040: + msg = "今日已签到过,无法重复签到" + else: + msg = f'签到失败,信息为: {ret["message"]}' + except Exception as e: + msg = f"签到异常,原因为{str(e)}" + print(msg) + return msg + + @staticmethod + def manga_sign(session, platform="android") -> dict: + """ + 模拟B站漫画客户端签到 + """ + try: + url = "https://manga.bilibili.com/twirp/activity.v1.Activity/ClockIn" + post_data = {"platform": platform} + ret = session.post(url=url, data=post_data).json() + if ret["code"] == 0: + msg = "签到成功" + elif ret["msg"] == "clockin clockin is duplicate": + msg = "今天已经签到过了" + else: + msg = f'签到失败,信息为({ret["msg"]})' + print(msg) + except Exception as e: + msg = f"签到异常,原因为: {str(e)}" + print(msg) + return msg + + @staticmethod + def vip_privilege_receive(session, bili_jct, receive_type: int = 1) -> dict: + """ + 领取B站大会员权益 + receive_type int 权益类型,1为B币劵,2为优惠券 + """ + url = "https://api.bilibili.com/x/vip/privilege/receive" + post_data = {"type": receive_type, "csrf": bili_jct} + ret = session.post(url=url, data=post_data).json() + return ret + + @staticmethod + def vip_manga_reward(session) -> dict: + """获取漫画大会员福利""" + url = "https://manga.bilibili.com/twirp/user.v1.User/GetVipReward" + ret = session.post(url=url, json={"reason_id": 1}).json() + return ret + + @staticmethod + def report_task(session, bili_jct, aid: int, cid: int, progres: int = 300) -> dict: + """ + B站上报视频观看进度 + aid int 视频av号 + cid int 视频cid号 + progres int 观看秒数 + """ + url = "http://api.bilibili.com/x/v2/history/report" + post_data = {"aid": aid, "cid": cid, "progres": progres, "csrf": bili_jct} + ret = session.post(url=url, data=post_data).json() + return ret + + @staticmethod + def share_task(session, bili_jct, aid) -> dict: + """ + 分享指定av号视频 + aid int 视频av号 + """ + url = "https://api.bilibili.com/x/web-interface/share/add" + post_data = {"aid": aid, "csrf": bili_jct} + ret = session.post(url=url, data=post_data).json() + return ret + + @staticmethod + def get_followings( + session, uid: int, pn: int = 1, ps: int = 50, order: str = "desc", order_type: str = "attention" + ) -> dict: + """ + 获取指定用户关注的up主 + uid int 账户uid,默认为本账户,非登录账户只能获取20个*5页 + pn int 页码,默认第一页 + ps int 每页数量,默认50 + order str 排序方式,默认desc + order_type 排序类型,默认attention + """ + params = { + "vmid": uid, + "pn": pn, + "ps": ps, + "order": order, + "order_type": order_type, + } + url = f"https://api.bilibili.com/x/relation/followings" + ret = session.get(url=url, params=params).json() + return ret + + @staticmethod + def space_arc_search( + session, uid: int, pn: int = 1, ps: int = 100, tid: int = 0, order: str = "pubdate", keyword: str = "" + ) -> dict: + """ + 获取指定up主空间视频投稿信息 + uid int 账户uid,默认为本账户 + pn int 页码,默认第一页 + ps int 每页数量,默认50 + tid int 分区 默认为0(所有分区) + order str 排序方式,默认pubdate + keyword str 关键字,默认为空 + """ + params = { + "mid": uid, + "pn": pn, + "ps": ps, + "tid": tid, + "order": order, + "keyword": keyword, + } + url = f"https://api.bilibili.com/x/space/arc/search" + ret = session.get(url=url, params=params).json() + data_list = [ + {"aid": one.get("aid"), "cid": 0, "title": one.get("title"), "owner": one.get("author")} + for one in ret.get("data", {}).get("list", {}).get("vlist", []) + ] + return data_list + + @staticmethod + def elec_pay(session, bili_jct, uid: int, num: int = 50) -> dict: + """ + 用B币给up主充电 + uid int up主uid + num int 充电电池数量 + """ + url = "https://api.bilibili.com/x/ugcpay/trade/elec/pay/quick" + post_data = {"elec_num": num, "up_mid": uid, "otype": "up", "oid": uid, "csrf": bili_jct} + ret = session.post(url=url, data=post_data).json() + return ret + + @staticmethod + def coin_add(session, bili_jct, aid: int, num: int = 1, select_like: int = 1) -> dict: + """ + 给指定 av 号视频投币 + aid int 视频av号 + num int 投币数量 + select_like int 是否点赞 + """ + url = "https://api.bilibili.com/x/web-interface/coin/add" + post_data = { + "aid": aid, + "multiply": num, + "select_like": select_like, + "cross_domain": "true", + "csrf": bili_jct, + } + ret = session.post(url=url, data=post_data).json() + + return ret + + @staticmethod + def live_status(session) -> dict: + """B站直播获取金银瓜子状态""" + url = "https://api.live.bilibili.com/pay/v1/Exchange/getStatus" + ret = session.get(url=url).json() + data = ret.get("data") + silver = data.get("silver", 0) + gold = data.get("gold", 0) + coin = data.get("coin", 0) + msg = [ + {"name": "硬币数量", "value": coin}, + {"name": "金瓜子数", "value": gold}, + {"name": "银瓜子数", "value": silver}, + ] + return msg + + @staticmethod + def get_region(session, rid=1, num=6) -> dict: + """ + 获取 B站分区视频信息 + rid int 分区号 + num int 获取视频数量 + """ + url = "https://api.bilibili.com/x/web-interface/dynamic/region?ps=" + str(num) + "&rid=" + str(rid) + ret = session.get(url=url).json() + data_list = [ + { + "aid": one.get("aid"), + "cid": one.get("cid"), + "title": one.get("title"), + "owner": one.get("owner", {}).get("name"), + } + for one in ret.get("data", {}).get("archives", []) + ] + return data_list + + def main(self): + bilibili_cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("cookie").split("; ")} + bili_jct = bilibili_cookie.get("bili_jct") + coin_num = self.check_item.get("coin_num", 0) + coin_type = self.check_item.get("coin_type", 1) + session = requests.session() + requests.utils.add_dict_to_cookiejar(session.cookies, bilibili_cookie) + session.headers.update( + { + "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.64", + "Referer": "https://www.bilibili.com/", + "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", + "Connection": "keep-alive", + } + ) + success_count = 0 + uname, uid, is_login, coin, vip_type, current_exp = self.get_nav(session=session) + if is_login: + manhua_msg = self.manga_sign(session=session) + live_msg = self.live_sign(session=session) + aid_list = self.get_region(session=session) + reward_ret = self.reward(session=session) + coins_av_count = reward_ret.get("data", {}).get("coins_av") // 10 + coin_num = coin_num - coins_av_count + coin_num = coin_num if coin_num < coin else coin + if coin_type == 1 and coin_num: + following_list = self.get_followings(session=session, uid=uid) + for following in following_list.get("data", {}).get("list"): + mid = following.get("mid") + if mid: + aid_list += self.space_arc_search(session=session, uid=mid) + if coin_num > 0: + for aid in aid_list[::-1]: + ret = self.coin_add(session=session, aid=aid.get("aid"), bili_jct=bili_jct) + if ret["code"] == 0: + coin_num -= 1 + print(f'成功给{aid.get("title")}投一个币') + success_count += 1 + elif ret["code"] == 34005: + print(f'投币{aid.get("title")}失败,原因为{ret["message"]}') + continue + # -104 硬币不够了 -111 csrf 失败 34005 投币达到上限 + else: + print(f'投币{aid.get("title")}失败,原因为{ret["message"]},跳过投币') + break + if coin_num <= 0: + break + coin_msg = f"今日成功投币{success_count + coins_av_count}/{self.check_item.get('coin_num', 5)}个" + else: + coin_msg = f"今日成功投币{coins_av_count}/{self.check_item.get('coin_num', 5)}个" + aid = aid_list[0].get("aid") + cid = aid_list[0].get("cid") + title = aid_list[0].get("title") + report_ret = self.report_task(session=session, bili_jct=bili_jct, aid=aid, cid=cid) + if report_ret.get("code") == 0: + report_msg = f"观看《{title}》300秒" + else: + report_msg = f"任务失败" + print(report_msg) + share_ret = self.share_task(session=session, bili_jct=bili_jct, aid=aid) + if share_ret.get("code") == 0: + share_msg = f"分享《{title}》成功" + else: + share_msg = f"分享失败" + print(share_msg) + live_stats = self.live_status(session=session) + uname, uid, is_login, new_coin, vip_type, new_current_exp = self.get_nav(session=session) + reward_ret = self.reward(session=session) + login = reward_ret.get("data", {}).get("login") + watch_av = reward_ret.get("data", {}).get("watch_av") + coins_av = reward_ret.get("data", {}).get("coins_av", 0) + share_av = reward_ret.get("data", {}).get("share_av") + today_exp = len([one for one in [login, watch_av, share_av] if one]) * 5 + today_exp += coins_av + update_data = (28800 - new_current_exp) // (today_exp if today_exp else 1) + msg = [ + {"name": "帐号信息", "value": uname}, + {"name": "漫画签到", "value": manhua_msg}, + {"name": "直播签到", "value": live_msg}, + {"name": "登陆任务", "value": "今日已登陆"}, + {"name": "观看视频", "value": report_msg}, + {"name": "分享任务", "value": share_msg}, + {"name": "投币任务", "value": coin_msg}, + {"name": "今日经验", "value": today_exp}, + {"name": "当前经验", "value": new_current_exp}, + {"name": "升级还需", "value": f"{update_data}天"}, + ] + live_stats + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="哔哩哔哩",run_script_expression="bili|哔哩哔哩") +def main(*args, **kwargs): + return BiliBili(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_cloud189.py b/dailycheckin_scripts/ck_cloud189.py new file mode 100644 index 0000000..c784a92 --- /dev/null +++ b/dailycheckin_scripts/ck_cloud189.py @@ -0,0 +1,164 @@ +# -*- coding: utf-8 -*- +""" +new Env('天翼云盘'); +""" +import base64 +import re +import time + +import requests +import rsa + + +from utils import check + + +class Cloud189: + name = "天翼云盘" + + 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/api/portal/loginUrl.action?redirectURL=https://cloud.189.cn/web/redirect.html" + 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 {"name": "登陆信息", "value": 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") + msg = [] + if response.json().get("isSign") == "false": + msg.append({"name": "签到结果", "value": f"未签到,签到获得 {netdiskbonus}M 空间"}) + else: + msg.append({"name": "签到结果", "value": f"已经签到过了,签到获得 {netdiskbonus}M 空间"}) + response = session.get(url=url, headers=headers) + if "errorCode" in response.text: + if response.json().get("errorCode") == "User_Not_Chance": + description = "没有抽奖机会了" + else: + description = response.json().get("errorCode") + msg.append({"name": "第一次抽", "value": description}) + else: + description = response.json().get("description", "") + if description in ["1", 1]: + description = "50M空间" + msg.append({"name": "第一次抽", "value": f"获得{description}"}) + response = session.get(url=url2, headers=headers) + if "errorCode" in response.text: + if response.json().get("errorCode") == "User_Not_Chance": + description = "没有抽奖机会了" + else: + description = response.json().get("errorCode") + msg.append({"name": "第二次抽", "value": description}) + else: + description = response.json().get("description", "") + if description in ["1", 1]: + description = "50M空间" + msg.append({"name": "第二次抽", "value": f"获得{description}"}) + return msg + + def main(self): + cloud189_phone = self.check_item.get("phone") + cloud189_password = self.check_item.get("password") + session = requests.Session() + flag = self.login(session=session, username=cloud189_phone, password=cloud189_password) + print(flag) + if flag is True: + sign_msg = self.sign(session=session) + else: + sign_msg = flag + msg = [{"name": "帐号信息", "value": cloud189_phone}] + sign_msg + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="天翼云盘",run_script_expression="CLOUD189|天翼") +def main(*args, **kwargs): + return Cloud189(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + # main() + print(Cloud189(check_item={'cloud189_phone': '17735745982', 'cloud189_password': 'Zl159753123'}).main()) diff --git a/dailycheckin_scripts/ck_csdn.py b/dailycheckin_scripts/ck_csdn.py new file mode 100644 index 0000000..ede9fad --- /dev/null +++ b/dailycheckin_scripts/ck_csdn.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +""" +new Env('CSDN'); +""" +import requests + +from utils import check + + +class CSDN: + name = "CSDN" + + def __init__(self, check_item): + self.check_item = check_item + self.headers = { + "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74", + } + + def sign(self, cookies): + response = requests.get( + url="https://me.csdn.net/api/LuckyDraw_v2/signIn", headers=self.headers, cookies=cookies + ).json() + if response.get("code") == 200: + msg = response.get("data").get("msg") + else: + msg = "签到失败" + print(response) + return msg + + def draw(self, cookies): + response = requests.get( + url="https://me.csdn.net/api/LuckyDraw_v2/goodluck", headers=self.headers, cookies=cookies + ).json() + if response.get("code") == 200: + msg = response.get("data").get("msg") + else: + msg = "抽奖失败" + return msg + + def main(self): + csdn_cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("cookie").split("; ")} + try: + user_name = csdn_cookie.get("UserName", "") + except Exception as e: + print(f"获取账号信息失败: {e}") + user_name = "未获取到账号信息" + sign_msg = self.sign(cookies=csdn_cookie) + draw_msg = self.draw(cookies=csdn_cookie) + msg = [ + {"name": "帐号信息", "value": user_name}, + {"name": "签到信息", "value": sign_msg}, + {"name": "抽奖结果", "value": draw_msg}, + ] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="CSDN", run_script_expression="csdn") +def main(*args, **kwargs): + return CSDN(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_duokan.py b/dailycheckin_scripts/ck_duokan.py new file mode 100644 index 0000000..09780f8 --- /dev/null +++ b/dailycheckin_scripts/ck_duokan.py @@ -0,0 +1,370 @@ +# -*- coding: utf-8 -*- +""" +new Env('多看阅读'); +""" + +import time + +import requests + +from utils import check + + +class DuoKan: + name = "多看阅读" + + def __init__(self, check_item): + self.check_item = check_item + self.gift_code_list = [ + "d16ad58199c69518a4afd87b5cf0fe67", + "828672d6bc39ccd25e1f6ad34e00b86c", + "f0ccc1bb1cecea673c197b928fb8dbd9", + "6b86c490d92a138de9a0ae6847781caa", + "c707047e8b820ba441d29cf87dff341e", + "82b2c012a956b18cff2388d24f2574a6", + "87d6b5183a361ee1f6ea8cece1ee83c3", + "9d42576f7e99c94bb752fde06e6770a5", + "e58d1f67a82a539d9331baaa3785a943", + "52c95192ebcb1d0113a748df58a72055", + "511f33e481fe4504d2637aaf6cbbbaff", + "6e986f36f4a45cadf61d2f246b27cdc6", + "f27797a6a1d7fe495b0f4de05f799327", + "4bd335e899fa665f15eea2f215156321", + "9355df762183f084473432b5c6900c44", + "4fb21fb04cbbae9d65556c3958603674", + "2d02ceb4f1bc916510c7407ce4eca5a5", + "ef314bf665af0b51294e624244acd7d6", + "1b441a2ab8e9e7dcf11a55b85931132f", + "005d2345782ab456e5af167336b70623", + "51ac508a4d494654035f17f1d646779b", + "0f6579670f1081f1bcba89dd64645b48", + "0cd858abe26f0d3db561185fe26bbb75", + "b5f5fd5b47fd587cb003807e97bed783", + "6ac9509a5cb799efeb1bb877c505f7e3", + "b5dd986ffc84762429901ffe633d82a0", + "f98a436cc2c85943d23d986a8d84c3bd", + "6fc387f2a17b8564ca212e2b16544cc3", + "12ead6a62411402378c6311199a0b2ef", + "7d8dcf31e2e69fcf6bd8af4f48831e92", + "446c3d0303b0dbd6bc2157844f1222ad", + "439890227d823ff57bed8ad351fa1b75", + "645acf3107722ab26b9d3194ecd156ff", + "afcb41dd9bc54d752c26ace985b49960", + "1100ab94ccd2e8373af70326c194d8ea", + "373d73c0c0975cf959eb4c40dc82b27c", + "2167ac28833149e9ad4ca217bcfa1a62", + "80547afccc42f34e4c8c4083e00a41a6", + "b604dda473644bd8157bafdf4ae518dc", + "15eaa8f727b595d512b82f55364b53b9", + "8fb656937fd613ccbbcacdc384595b03", + "dd8410da0b5144ba4aba5a618723b72e", + "204208386b056a2288e541110bfeeec3", + "c5b2e7344efd4128bcab5840fa427103", + "0168601e4335095c502e2e550ca53114", + "dfa12fe056a8deee35da18613173560f", + "ed945efdef9c7b2de41249a4fed3945e", + "b9ece5964ab62d51f8b70ffd35191e9d", + "f0e0ca4ca0b8afd766821a4922a2873c", + "5c687b8c6bd641f3f2c0d6aaeceafff6", + "c983be6420027231d77b748f9d02c1f2", + "7c53358df8156d979cb6cbb74e15877b", + "a58058035f73628a7c0847c66c350e88", + "79dd039ca5cf401993801710f9900d6b", + "5aff116c2cec01fcc69b389034f456a2", + "d006927cd9bfd620a6af4f76ee3c4100", + "410fe62830eeb91ca48be24ffe596364", + "9d18226ff144a72812d0104ce59fb34e", + "de439c7f75ca80b1d5b8aba619ee200d", + "00d1a0479590793294bfdd5c427643aa", + "d57176b1ce88135243bd501e448b8559", + "7c500eff681637b97dd526bb11737abb", + "3e197e47aaac926ccd50c37eb2828311", + "7db084ea5987f841ad77240bcbb8ce54", + "cce74f0facc50d47c0dd0e3e2f7435fb", + "f8bb53fbeb9b2d45db8aca1401817599", + "5baf7f0f355db11eeb0e936b675cdb82", + "4478a3354de6bcd7e91b49e28a2b2b3f", + "66a0338d93af82e956122288b08d2b4b", + "9f598b2b1c9cd0f2b20e335831cce366", + "9f4a45fec88b2820653abba179759eb6", + "41086649c9a39ec977ba42f9ce81f828", + "06ccca6fd73a6e38f65638ab8abbab76", + "0cfa0a034a203bb3a22be499e74906f4", + "c0d1da35a8878b7e4dcdf44bf3cd6b96", + "f34921e16f6518c1149cc083bd8e1ad7", + "ed0be3c70075d1d8f1a412f9e59a12e7", + "eb4d6324bae7db952bd220cb4d57a3de", + "5ba65d9f8ad735681b594f5092f6ab37", + "2fa6e0b612962937edb37ed7043923fd", + "baa8268c7d85d793011c5f5b977f8d4b", + "f4842a465e4583646abf7df67d8e2915", + "12c6332c8c9ded3d58d45f2dae7de8da", + "f56609232205692acf6b6a5d337b0965", + "3e4eed15387843c668fba53641599d07", + "d1b9d9ede145b5d426130986245cb66e", + "2979e43f6ab786f5d68cc262105f3c45", + "118a18ed578c78f4855b416f8271b29a", + "9122e158d034f094627c70ed6c3d0c33", + "dd5413c17253e86cc4247984f3bb77e5", + "b36bb0124b962efccbb601486665ce9e", + "6afb3a719f8b0a0b2f744b3dad8b15ab", + "faf18d64268402ed2975a3f60bc9e651", + "9f4081944d4ca3fa7b831d7c3b6c289d", + "367d7a3d77a9f96cbd7903b33c30b61f", + "605276cf621ff9ba34a99e3675a006f6", + "a50a734c1a3a749918e20205505ef91d", + "271ff14ba5edfe89a80a3430227bc11b", + "3bae338062b4bb3a5087eb13cbcc6efe", + "9b443d60178a9bcb08bae62c41970abf", + "a4f6e97741054f3567ab6a7257c63ab1", + "e06a82cc1f05eda4947e5fa0927d89c5", + "4fa3b4fc274c283efb02c0a1ddd133e7", + "4aa59e16a3961ed1ebd12b7f15d79547", + "f75fe88eaa24fc28ac57d963d8b90f2d", + "42cbe52b6f74761a5a7a79bf370c30ef", + "7d4571b5c9710e3b5481330bc7123ecc", + "fcf2f7ec42086809991de5aed5e7ef0d", + "bb7de9aaf68a83ac1ddbe75ba913b8af", + "a9bd964b97e785fffb641edb9b402d3f", + "6a815be6f537b2351e947ed66f74e209", + "27ae4e4d71395c6255bf7ea57c496507", + "2b07f369e90f4fc34ef419d891a2906f", + "7a2dc8a5b3fc0c7ecddb97ed1ce2c833", + "e7ad152ef27beb80c5d343f41f885b21", + "ba21758aed15a3a20a27f63bc0d84626", + "3820f7b8e1ece2614a11264501b5c93e", + "c3c41c87e6bf752f5237b4fffa33f08b", + "ed21086ff6682ab8495ecbfbb697af4a", + "5a2585ff3524f319dfd1f6b735c9a18d", + "0e61444507f0a780a1c83b612eb5fb9b", + "b105aa5c696648c0f7aae9e3933f8fe0", + "fec8f729e9e1d02248b949ce17674e0c", + "d3323d5560d15d4bc03575dcd0f53ae9", + "15fbf9d24dd05d9d64a18a8fd28f4dcc", + "ac0f3bda53081eee547882b2cdc8b04f", + "5dd3fadcd4ea6b922e1462431966c2bf", + "4acb71816dad0ce9a53d8fee301d857c", + "4c7e173f3a046919587db5b2640896e7", + "8407dc0459d0b367eaced7e5dfdef8ed", + "17e02409659223ff4e32cabd9ad352d9", + "c49edc07086b27769eddb981359f56b2", + "344822f5d8d53fe9aa7a1c7328cd2c59", + "92259343c65ac0feab5cb56b2e851783", + "e1e537b0bd37091c0ba4d5f614af9160", + "dff1116c175ddaaa20f3985a3d88abc6", + "3b1131a7c7273aa61cbd71b044e9beca", + "431aab37ef168c383f078b9244008cee", + "96c3bb8355d7e3ed7265095374f1c090", + "c3a7d304cdb307f073bef5003d1b8b78", + "627d884fc905cc353d0028076e39846b", + "36ce0d88a6bb2d10e0dc0a697f64df4e", + "dc8dbd035d42a5d8170976d5f532dab0", + "01c2665e7ea15bc56cca6d955c2e8ae1", + "c54ae7eeedc87ac52249684f012d3805", + "2df9b3b8f21a682b20d9d77669087a7a", + "fded473150a783586c12692fd57d0825", + "580499e69f42c0ccba0d1f87a83e41e9", + "99433cb83f1cd7176b7cdeaa7be49cd8", + "fbd76e8265547376905b3b6004150064", + "362768496052ae0dfbe909a9b5c6f54e", + "4f33581089c90944e5ad950646b17712", + "bffe93cdfe4b8833190e0a59c779e027", + "78e042b792c3af7faf7a6ebfedf6af9e", + "51a59c881726c2887efe9752bd9db715", + "a46ecf03d3f4038ba3de4ae4ac28170f", + "48d025f7cc34ac29c21d03b2c1f36449", + "8c9ceb77d61c20cb96ee652eb7b838c9", + "47a5882c89671429ae532339b7f333ce", + "a0b735557416ff3d08d3d8440393061a", + "976d3b3a8fbdf33d525075a9288455ab", + "636ca4c1db1c4450431ecd7e10a5e671", + "8c5cd12180027ee6535a837bd4f0259a", + "b82315333974c76793b3c7f517fe977c", + "6143d1f3472cd7cf08e3780918019158", + "20d032426fd66d49bec4f99579252cfa", + "398ee715d1dfd058a912bc7768d35f82", + "1f678678966444fb53d118b8134ceb94", + "d6641f3ed9444eae2b77ba68d3552f6a", + "ab2babaa19539895a5285c1ded6de8c6", + "5bc61d3cd53582b859db9cf04fc7e250", + "5deb619ed27c2754df4f9c7e3ce16b82", + "b81a322830fee59c75985626f7e0a8b5", + "e2313ad53d58e181c5fbaef29e5772c3", + "70d2aa99ef48b6cf1c0e8c107c0e121d", + "0633cdb06253a2b11e9a9ca234a3e9c3", + "bd1cbb9764fba94e8f1c0d1c024487af", + "301cbdbf26210596f9b22123abff0ca8", + "1fc2448ee192a1d0806ae1eb6fcc81fe", + "306247030d0b6442c3ded42e9ca99872", + "1c8f9a0786a01db1d06989345887967e", + "256ec3a54aaae719aae88d8f9c7f9b5f", + "45645896cccec48191916fec482979d9", + "c3a19c728d6fd39925bd63abe15aa446", + "15f45c4cd8fd4a6c0a3fae14ccafff47", + "a082c46b09772739af41f01676e1d0d1", + "14928418f94f5d35b182001ae0160455", + "dfbc5bc946c72650adaaf570f11a1e80", + "8a312e3e30d2e8fd1cf8873c3abe1d8c", + "ef425403acaabfb2a5b3f6ab0aafce8c", + "c78d471822dd961a53afe23e6c2dfa61", + "a40f670d8de3784b54784daf63095d88", + "49a72ace7fd54d8d0833bb2590db58aa", + "38e3808d28de73af3578f6d64020e1fc", + "a8be6ab39263d2edf61acafc60949921", + "d9c16bf0032800916e948ea26624a253", + "dbf3a62ff403c3ba94d5ab1e6219f5bc", + "3a6415de684e2978ce17543d66d523f6", + "2f69a681ee1ff927df1bdbd5431ced1d", + "e55c0390872735ec285dad8ebdd939e0", + ] + self.code_list = [ + "K7S36GFSZC", + "A2AMBFHP6C", + "K5HHKUU14D", + "J18UK6YYAY", + "1BJGW140U5", + ] + self.headers = {"Content-Type": "application/x-www-form-urlencoded; charset=utf-8"} + + @staticmethod + def get_data(cookies): + device_id = cookies.get("device_id") + t = int(time.time()) + t_device_id = f"{device_id}&{t}" + c = 0 + for index, one in enumerate(t_device_id): + c = (c * 131 + ord(one)) % 65536 + data = f"_t={t}&_c={c}" + return data + + def sign(self, cookies): + url = "https://www.duokan.com/checkin/v0/checkin" + data = self.get_data(cookies=cookies) + response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + msg = {"name": "每日签到", "value": result.get("msg")} + return msg + + def info(self, cookies): + url = "https://www.duokan.com/store/v0/award/coin/list" + data = f"sandbox=0&{self.get_data(cookies=cookies)}&withid=1" + response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + msg = [] + if "尚未登录" not in result.get("msg"): + coin = sum([one.get("coin") for one in result.get("data", {}).get("award")]) + msg.append({"name": "当前书豆", "value": coin}) + msg += [ + {"name": f"{one.get('expire')} 到期", "value": f"{one.get('coin')} 书豆"} + for one in result.get("data", {}).get("award") + ] + return msg + else: + return [{"name": "账号异常", "value": "Cookie 失效"}] + + def free(self, cookies): + url = "https://www.duokan.com/hs/v4/channel/query/2027" + response = requests.get(url=url, cookies=cookies, headers=self.headers) + bid = response.json().get("items")[0].get("data").get("book_id") + data = f"payment_name=BC&ch=VSZUVB&book_id={bid}&price=0&allow_discount=1" + free_url = "https://www.duokan.com/store/v0/payment/book/create" + response = requests.post(url=free_url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + if "尚未登录" not in result.get("msg"): + book_title = result.get("book").get("title") + book_msg = result.get("msg") + msg = {"name": "今日限免", "value": f"{book_title} · {book_msg}"} + else: + msg = {"name": "今日限免", "value": f"Cookie 失效"} + return msg + + def gift(self, cookies): + url = "https://www.duokan.com/events/common_task_gift_check" + data = f"code=KYKJF7LL0G&{self.get_data(cookies=cookies)}&withid=1" + response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + if result.get("chances") == 0: + msg = {"name": "体验任务", "value": "已经做完啦"} + elif result.get("chances"): + num = 0 + for gift_code in self.gift_code_list: + url = "https://www.duokan.com/events/common_task_gift" + data = f"code=KYKJF7LL0G&chances=1&sign={gift_code}&{self.get_data(cookies=cookies)}&withid=1" + response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + if result.get("msg") == "成功": + num += 30 + print("体验任务完成啦!豆子 +30") + else: + print(result.get("data")) + msg = {"name": "体验任务", "value": f"获得 {num} 豆子"} + else: + msg = {"name": "体验任务", "value": f"{response.text}"} + return msg + + def add_draw(self, cookies): + success_count = 0 + for one in range(6): + url = "https://www.duokan.com/store/v0/event/chances/add" + data = f"code=8ulcky4bknbe_f&count=1&{self.get_data(cookies=cookies)}&withid=1" + response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + if result.get("result") == 0: + success_count += 1 + msg = {"name": "添加抽奖", "value": f"{success_count} 次"} + return msg + + def draw(self, cookies): + success_count = 0 + for one in range(6): + url = "https://www.duokan.com/store/v0/event/drawing" + data = f"code=8ulcky4bknbe_f&{self.get_data(cookies=cookies)}&withid=1" + response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + if result.get("result") == 0: + success_count += 1 + msg = {"name": "成功抽奖", "value": f"{success_count} 次"} + return msg + + def download(self, cookies): + url = "https://www.duokan.com/events/common_task_gift" + data = f"code=J18UK6YYAY&chances=17&{self.get_data(cookies=cookies)}&withid=1" + response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + msg = {"name": "下载任务", "value": result.get("msg")} + return msg + + def task(self, cookies): + success_count = 0 + url = "https://www.duokan.com/events/tasks_gift" + for code in self.code_list: + data = f"code={code}&chances=3&{self.get_data(cookies=cookies)}&withid=1" + response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + if result.get("result") == 0: + success_count += 1 + msg = {"name": "其他任务", "value": f"完成 {success_count} 个"} + return msg + + def main(self): + duokan_cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("cookie").split("; ")} + sign_msg = self.sign(cookies=duokan_cookie) + free_msg = self.free(cookies=duokan_cookie) + gift_msg = self.gift(cookies=duokan_cookie) + add_draw_msg = self.add_draw(cookies=duokan_cookie) + draw_msg = self.draw(cookies=duokan_cookie) + download_msg = self.download(cookies=duokan_cookie) + task_msg = self.task(cookies=duokan_cookie) + info_msg = self.info(cookies=duokan_cookie) + msg = [sign_msg, free_msg, gift_msg, add_draw_msg, draw_msg, download_msg, task_msg] + info_msg + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="多看阅读",run_script_expression="duokan|多看") +def main(*args, **kwargs): + return DuoKan(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_fmapp.py b/dailycheckin_scripts/ck_fmapp.py new file mode 100644 index 0000000..6618741 --- /dev/null +++ b/dailycheckin_scripts/ck_fmapp.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- +""" +new Env('米家'); +""" +import json + +import requests + +from utils import check + + +class FMAPP: + name = "Fa米家" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(headers): + try: + url = "https://fmapp.chinafamilymart.com.cn/api/app/market/member/signin/sign" + response = requests.post(url=url, headers=headers).json() + code = response.get("code") + if code == "200": + data = response.get("data", {}) + msg = ( + f"在坚持{data.get('nextDay')}天即可获得{data.get('nextNumber')}个发米粒, " + f"签到{data.get('lastDay')}天可获得{data.get('lastNumber')}个发米粒" + ) + else: + msg = response.get("message") + except Exception as e: + print("错误信息", str(e)) + msg = "未知错误,检查日志" + msg = {"name": "签到信息", "value": msg} + return msg + + @staticmethod + def user_info(headers): + try: + url = "https://fmapp.chinafamilymart.com.cn/api/app/member/info" + response = requests.post(url=url, headers=headers).json() + code = response.get("code") + if code == "200": + data = response.get("data", {}) + msg = data.get("nickName") + else: + msg = response.get("message") + except Exception as e: + print("错误信息", str(e)) + msg = "未知错误,检查日志" + msg = {"name": "帐号信息", "value": msg} + return msg + + @staticmethod + def mili_count(headers): + try: + url = "https://fmapp.chinafamilymart.com.cn/api/app/member/v1/mili/service/detail" + response = requests.post(url=url, headers=headers, data=json.dumps({"pageSize": 10, "pageNo": 1})).json() + code = response.get("code") + if code == "200": + data = response.get("data", {}) + msg = data.get("miliNum") + else: + msg = response.get("message") + except Exception as e: + print("错误信息", str(e)) + msg = "未知错误,检查日志" + msg = {"name": "米粒数量", "value": msg} + return msg + + def main(self): + token = self.check_item.get("token") + cookie = self.check_item.get("cookie") + blackbox = self.check_item.get("blackbox") + device_id = self.check_item.get("device_id") + fmversion = self.check_item.get("fmversion", "2.2.3") + fm_os = self.check_item.get("os", "ios") + useragent = self.check_item.get("useragent", "Fa") + headers = { + "Accept": "*/*", + "Accept-Language": "zh-Hans;q=1.0", + "Accept-Encoding": "br;q=1.0, gzip;q=0.9, deflate;q=0.8", + "Host": "fmapp.chinafamilymart.com.cn", + "Content-Type": "application/json", + "loginChannel": "app", + "token": token, + "fmVersion": fmversion, + "deviceId": device_id, + "User-Agent": useragent, + "os": fm_os, + "cookie": cookie, + "blackBox": blackbox, + } + sign_msg = self.sign(headers=headers) + name_msg = self.user_info(headers=headers) + mili_msg = self.mili_count(headers=headers) + msg = [name_msg, sign_msg, mili_msg] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="米家", run_script_expression="fmapp|米家") +def main(*args, **kwargs): + return FMAPP(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_iqiyi.py b/dailycheckin_scripts/ck_iqiyi.py new file mode 100644 index 0000000..90dbf6d --- /dev/null +++ b/dailycheckin_scripts/ck_iqiyi.py @@ -0,0 +1,232 @@ +# -*- coding: utf-8 -*- +""" +new Env('爱奇艺'); +""" +import json +import re +import time +from urllib.parse import unquote + +import requests + +from utils import check + + +class IQIYI: + name = "爱奇艺" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def parse_cookie(cookie): + p00001 = re.findall(r"P00001=(.*?);", cookie)[0] if re.findall(r"P00001=(.*?);", cookie) else "" + p00002 = re.findall(r"P00002=(.*?);", cookie)[0] if re.findall(r"P00002=(.*?);", cookie) else "" + p00003 = re.findall(r"P00003=(.*?);", cookie)[0] if re.findall(r"P00003=(.*?);", cookie) else "" + 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 = [ + {"name": "VIP 等级", "value": level}, + {"name": "当前成长", "value": growthvalue}, + {"name": "今日成长", "value": today_growth_value}, + {"name": "升级还需", "value": distance}, + {"name": "VIP 到期", "value": deadline}, + ] + except Exception as e: + msg = [ + {"name": "账号信息", "value": str(e)}, + ] + print(msg) + else: + msg = [ + {"name": "账号信息", "value": 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"] + cumulate_sign_days_sum = res["data"]["signInfo"]["data"]["cumulateSignDaysSum"] + msg = [ + {"name": "签到奖励", "value": f"{growth}成长值"}, + {"name": "当月签到", "value": f"{cumulate_sign_days_sum}天"}, + ] + except Exception as e: + print(e) + msg = [{"name": "签到奖励", "value": res["data"]["signInfo"].get("msg")}] + else: + msg = [{"name": "签到奖励", "value": 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 = {"name": "任务奖励", "value": 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("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 = ( + [ + {"name": "用户账号", "value": user_name}, + {"name": "用户昵称", "value": nickname}, + ] + + user_msg + + sign_msg + + [ + task_msg, + {"name": "抽奖奖励", "value": draw_msg}, + ] + ) + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="爱奇艺",run_script_expression="IQIYI|爱奇艺") +def main(*args, **kwargs): + return IQIYI(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_kgqq.py b/dailycheckin_scripts/ck_kgqq.py new file mode 100644 index 0000000..88fbc9b --- /dev/null +++ b/dailycheckin_scripts/ck_kgqq.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*- +""" +new Env('全民k歌'); +""" +import requests + +from utils import check + + +class KGQQ: + name = "全民K歌" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(kgqq_cookie): + headers = {"Cookie": kgqq_cookie} + uid = kgqq_cookie.split("; ") + t_uuid = "" + for i in uid: + if i.find("uid=") >= 0: + t_uuid = i.split("=")[1] + proto_profile_url = "https://node.kg.qq.com/webapp/proxy?ns=proto_profile&cmd=profile.getProfile&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnByb2ZpbGVfd2ViYXBwSmNlJTIyJTJDJTIyY21kTmFtZSUyMiUzQSUyMlByb2ZpbGVHZXQlMjIlMkMlMjJhcHBpZCUyMiUzQTEwMDA2MjYlMkMlMjJkY2FwaSUyMiUzQSU3QiUyMmludGVyZmFjZUlkJTIyJTNBMjA1MzU5NTk3JTdEJTJDJTIybDVhcGklMjIlM0ElN0IlMjJtb2RpZCUyMiUzQTI5NDAxNyUyQyUyMmNtZCUyMiUzQTI2MjE0NCU3RCUyQyUyMmlwJTIyJTNBJTIyMTAwLjExMy4xNjIuMTc4JTIyJTJDJTIycG9ydCUyMiUzQSUyMjEyNDA2JTIyJTdE&t_uUid={0}".format( + t_uuid + ) + + url_list = ( + [ + "https://node.kg.qq.com/webapp/proxy?ns=KG_TASK&cmd=task.getLottery&ns_inbuf=&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnRhc2tKY2UlMjIlMkMlMjJjbWROYW1lJTIyJTNBJTIyTG90dGVyeVJlcSUyMiUyQyUyMnduc0NvbmZpZyUyMiUzQSU3QiUyMmFwcGlkJTIyJTNBMTAwMDU1NyU3RCUyQyUyMmw1YXBpJTIyJTNBJTdCJTIybW9kaWQlMjIlM0E1MDM5MzclMkMlMjJjbWQlMjIlM0E1ODk4MjQlN0QlN0Q%3D&t_uid={0}&t_iShowEntry=1&t_type={1}".format( + t_uuid, one + ) + for one in ["1", "2"] + ] + + [ + "https://node.kg.qq.com/webapp/proxy?ns=KG_TASK&cmd=task.signinGetAward&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnRhc2tKY2UlMjIlMkMlMjJjbWROYW1lJTIyJTNBJTIyR2V0U2lnbkluQXdhcmRSZXElMjIlMkMlMjJ3bnNDb25maWclMjIlM0ElN0IlMjJhcHBpZCUyMiUzQTEwMDA2MjYlN0QlMkMlMjJsNWFwaSUyMiUzQSU3QiUyMm1vZGlkJTIyJTNBNTAzOTM3JTJDJTIyY21kJTIyJTNBNTg5ODI0JTdEJTdE&t_uid={0}&t_iShowEntry={1}".format( + t_uuid, one + ) + for one in ["1", "2", "4", "16", "128", "512"] + ] + + [ + "https://node.kg.qq.com/webapp/proxy?ns=KG_TASK&cmd=task.getLottery&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnRhc2tKY2UlMjIlMkMlMjJjbWROYW1lJTIyJTNBJTIyTG90dGVyeVJlcSUyMiUyQyUyMnduc0NvbmZpZyUyMiUzQSU3QiUyMmFwcGlkJTIyJTNBMTAwMDU1NyU3RCUyQyUyMmw1YXBpJTIyJTNBJTdCJTIybW9kaWQlMjIlM0E1MDM5MzclMkMlMjJjbWQlMjIlM0E1ODk4MjQlN0QlN0Q&t_uid={0}&t_iShowEntry=4&t_type=104".format( + t_uuid + ), + "https://node.kg.qq.com/webapp/proxy?ns=KG_TASK&cmd=task.getLottery&mapExt=JTdCJTIyZmlsZSUyMiUzQSUyMnRhc2tKY2UlMjIlMkMlMjJjbWROYW1lJTIyJTNBJTIyTG90dGVyeVJlcSUyMiUyQyUyMmw1YXBpJTIyJTNBJTdCJTIybW9kaWQlMjIlM0E1MDM5MzclMkMlMjJjbWQlMjIlM0E1ODk4MjQlN0QlMkMlMjJsNWFwaV9leHAxJTIyJTNBJTdCJTIybW9kaWQlMjIlM0E4MTcwODklMkMlMjJjbWQlMjIlM0EzODAxMDg4JTdEJTdE&t_uid={0}&t_type=103".format( + t_uuid + ), + ] + ) + + proto_music_station_url = "https://node.kg.qq.com/webapp/proxy?ns=proto_music_station&cmd=message.batch_get_music_cards&mapExt=JTdCJTIyY21kTmFtZSUyMiUzQSUyMkdldEJhdGNoTXVzaWNDYXJkc1JlcSUyMiUyQyUyMmZpbGUlMjIlM0ElMjJwcm90b19tdXNpY19zdGF0aW9uSmNlJTIyJTJDJTIyd25zRGlzcGF0Y2hlciUyMiUzQXRydWUlN0Q&t_uUid={0}&g_tk_openkey=".format( + t_uuid + ) + + url_10 = "https://node.kg.qq.com/webapp/proxy?t_stReward%3Aobject=%7B%22uInteractiveType%22%3A1%2C%22uRewardType%22%3A0%2C%22uFlowerNum%22%3A15%7D&ns=proto_music_station&cmd=message.get_reward&mapExt=JTdCJTIyY21kTmFtZSUyMiUzQSUyMkdldFJld2FyZFJlcSUyMiUyQyUyMmZpbGUlMjIlM0ElMjJwcm90b19tdXNpY19zdGF0aW9uSmNlJTIyJTJDJTIyd25zRGlzcGF0Y2hlciUyMiUzQXRydWUlN0Q&t_uUid={0}&t_strUgcId=".format( + t_uuid + ) + + url_15 = "https://node.kg.qq.com/webapp/proxy?t_stReward%3Aobject=%7B%22uInteractiveType%22%3A0%2C%22uRewardType%22%3A0%2C%22uFlowerNum%22%3A10%7D&ns=proto_music_station&cmd=message.get_reward&mapExt=JTdCJTIyY21kTmFtZSUyMiUzQSUyMkdldFJld2FyZFJlcSUyMiUyQyUyMmZpbGUlMjIlM0ElMjJwcm90b19tdXNpY19zdGF0aW9uSmNlJTIyJTJDJTIyd25zRGlzcGF0Y2hlciUyMiUzQXRydWUlN0Q&t_uUid={0}&t_strUgcId=".format( + t_uuid + ) + try: + old_proto_profile_response = requests.get(url=proto_profile_url, headers=headers) + old_num = old_proto_profile_response.json()["data"]["profile.getProfile"]["uFlowerNum"] + nickname = old_proto_profile_response.json()["data"]["profile.getProfile"]["stPersonInfo"]["sKgNick"] + for url in url_list: + try: + requests.get(url=url, headers=headers) + except Exception as e: + print(e) + for g_tk_openkey in range(16): + try: + proto_music_station_resp = requests.get( + url=proto_music_station_url + str(g_tk_openkey), headers=headers + ) + if proto_music_station_resp.json().get("code") in [1000]: + return proto_music_station_resp.json().get("msg") + vct_music_cards = proto_music_station_resp.json()["data"]["message.batch_get_music_cards"][ + "vctMusicCards" + ] + vct_music_cards_list = sorted( + vct_music_cards, key=lambda x: x["stReward"]["uFlowerNum"], reverse=True + )[0] + str_ugc_id = vct_music_cards_list["strUgcId"] + str_key = vct_music_cards_list["strKey"] + url = str_ugc_id + "&t_strKey=" + str_key + u_flower_num = vct_music_cards_list["stReward"]["uFlowerNum"] + if u_flower_num > 10: + requests.get(url=url_10 + url, headers=headers) + elif 1 < u_flower_num < 10: + requests.get(url=url_15 + url, headers=headers) + except Exception as e: + print(e) + # VIP 签到 + try: + getinfourl = ( + "https://node.kg.qq.com/webapp/proxy?ns=proto_vip_webapp&cmd=vip.get_vip_info&t_uUid=" + + t_uuid + + "&t_uWebReq=1&t_uGetDataFromC4B=1" + ) + inforequest = requests.get(url=getinfourl, headers=headers) + vip_status = inforequest.json()["data"]["vip.get_vip_info"]["stVipCoreInfo"]["uStatus"] + if vip_status == 1: + vipurl = ( + "https://node.kg.qq.com/webapp/proxy?t_uUid=" + + t_uuid + + "&ns=proto_vip_webapp&cmd=vip.get_vip_day_reward&ns_inbuf=&nocache=1613719349184&mapExt=JTdCJTIyY21kTmFtZSUyMiUzQSUyMkdldFZpcERheVJld2FyZCUyMiU3RA%3D%3D&g_tk_openkey=642424811" + ) + viprequest = requests.get(url=vipurl, headers=headers) + str_tips = viprequest.json()["data"]["vip.get_vip_day_reward"]["strTips"] + u_cur_reward_num = viprequest.json()["data"]["vip.get_vip_day_reward"]["uCurRewardNum"] + vip_message = f"{str_tips} 获取VIP福利道具:{u_cur_reward_num}个" + else: + vip_message = "非 VIP 用户" + except Exception as e: + print(e) + vip_message = "VIP 签到失败" + new_proto_profile_response = requests.get(url=proto_profile_url, headers=headers) + new_num = new_proto_profile_response.json()["data"]["profile.getProfile"]["uFlowerNum"] + get_num = int(new_num) - int(old_num) + msg = [ + {"name": "帐号信息", "value": nickname}, + {"name": "获取鲜花", "value": get_num}, + {"name": "当前鲜花", "value": new_num}, + {"name": "VIP 签到", "value": vip_message}, + ] + except Exception as e: + msg = [ + {"name": "帐号信息", "value": str(e)}, + ] + return msg + + def main(self): + kgqq_cookie = self.check_item.get("cookie") + msg = self.sign(kgqq_cookie=kgqq_cookie) + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="全民K歌",run_script_expression="KGQQ|全民K歌") +def main(*args, **kwargs): + return KGQQ(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_meizu.py b/dailycheckin_scripts/ck_meizu.py new file mode 100644 index 0000000..97ff458 --- /dev/null +++ b/dailycheckin_scripts/ck_meizu.py @@ -0,0 +1,110 @@ +# -*- coding: utf-8 -*- +""" +new Env('MEIZU社区'); +""" +import time + +import requests + +from utils import check + + +class Meizu: + name = "MEIZU社区" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(cookie): + headers = { + "authority": "bbs-act.meizu.cn", + "pragma": "no-cache", + "cache-control": "no-cache", + "accept": "application/json, text/javascript, */*; q=0.01", + "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74", + "origin": "https://bbs.meizu.cn", + "referer": "https://bbs.meizu.cn/", + "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", + "cookie": cookie, + } + params = ( + ("mod", "signin"), + ("action", "sign"), + ) + response = requests.get(url="https://bbs-act.meizu.cn/index.php", headers=headers, params=params).json() + msg = response.get("message") + return msg + + @staticmethod + def draw(cookie, count: int = 0): + headers = { + "authority": "bbs-act.meizu.cn", + "accept": "application/json, text/javascript, */*; q=0.01", + "x-requested-with": "XMLHttpRequest", + "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74", + "content-type": "application/x-www-form-urlencoded", + "origin": "https://bbs-act.meizu.cn", + "referer": "https://bbs-act.meizu.cn/2/index.html", + "accept-language": "zh-CN,zh;q=0.9", + "cookie": cookie, + } + data = {"mod": "index", "action": "draw", "id": "2"} + award_list = [] + success_count = 0 + error_count = 0 + if count: + for i in range(count): + try: + data = requests.post(url="https://bbs-act.meizu.cn/index.php", headers=headers, data=data).json() + if data["code"] == 200: + one_msg = data.get("data", {}).get("award_name") + award_list.append(one_msg) + success_count += 1 + else: + error_count += 1 + print(data.get("code"), data.get("message")) + one_msg = "抽奖失败" + except Exception as e: + one_msg = f"抽奖失败: {e}" + error_count += 1 + print(f"第{i + 1}次抽奖结果:" + str(one_msg)) + time.sleep(5) + msg = f"成功抽奖 {success_count} 次" + draw_msg = [ + {"name": "抽奖信息", "value": str(msg)}, + {"name": "抽奖结果", "value": ";".join(award_list)}, + ] + else: + draw_msg = [ + {"name": "抽奖信息", "value": "未开启抽奖"}, + ] + data = {"mod": "index", "action": "get_user_count", "id": "2"} + user_info = requests.post("https://bbs-act.meizu.cn/index.php", headers=headers, data=data).json() + uid = user_info.get("data", {}).get("uid") + return draw_msg, uid + + def main(self): + meizu_cookie = self.check_item.get("cookie") + try: + draw_count = int(self.check_item.get("draw_count", 0)) + except Exception as e: + print("初始化抽奖次数失败: 重置为 0 ", str(e)) + draw_count = 0 + sign_msg = self.sign(cookie=meizu_cookie) + draw_msg, uid = self.draw(cookie=meizu_cookie, count=draw_count) + msg = [ + {"name": "帐号信息", "value": uid}, + {"name": "签到信息", "value": sign_msg}, + ] + draw_msg + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="MEIZU社区", run_script_expression="meizu") +def main(*args, **kwargs): + return Meizu(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_mgtv.py b/dailycheckin_scripts/ck_mgtv.py new file mode 100644 index 0000000..d02ddac --- /dev/null +++ b/dailycheckin_scripts/ck_mgtv.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +""" +new Env('芒果TV'); +""" +import json +import time +from urllib import parse + +import requests + +from utils import check + + +class Mgtv: + name = "芒果TV" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(params): + url = "https://credits.bz.mgtv.com/user/creditsTake" + user_params = { + "abroad": params.get("abroad"), + "ageMode": "0", + "appVersion": params.get("appVersion"), + "artistId": params.get("uuid"), + "device": params.get("device"), + "did": params.get("did"), + "mac": params.get("did"), + "osType": params.get("osType"), + "src": "mgtv", + "testversion": "", + "ticket": params.get("ticket"), + "uuid": params.get("uuid"), + } + try: + user_info = requests.get(url="https://homepage.bz.mgtv.com/v2/user/userInfo", params=user_params).json() + username = user_info.get("data", {}).get("nickName") + except Exception as e: + print("获取账号信息失败", e) + username = params.get("uuid") + res = requests.get(url=url, params=params) + res_json = json.loads(res.text.replace(f"{params.get('callback')}(", "").replace(");", "")) + if res_json["code"] == 200: + cur_day = res_json["data"]["curDay"] + _credits = res_json["data"]["credits"] + msg = [ + {"name": "帐号信息", "value": username}, + {"name": "签到积分", "value": f"{_credits}积分"}, + {"name": "已经签到", "value": f"{cur_day}天/21天"}, + ] + else: + msg = [ + {"name": "帐号信息", "value": username}, + {"name": "签到信息", "value": f"已完成签到 or 签到失败"}, + ] + return msg + + def main(self): + mgtv_params = self.check_item.get("params") + params = parse.parse_qs(mgtv_params) + params["timestamp"] = [round(time.time())] + params = {key: value[0] for key, value in params.items()} + msg = self.sign(params=params) + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="芒果TV",run_script_expression="MGTV") +def main(*args, **kwargs): + return Mgtv(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() + diff --git a/dailycheckin_scripts/ck_mimotion.py b/dailycheckin_scripts/ck_mimotion.py new file mode 100644 index 0000000..88066d6 --- /dev/null +++ b/dailycheckin_scripts/ck_mimotion.py @@ -0,0 +1,118 @@ +# -*- coding: utf8 -*- +""" +new Env('小米运动'); +""" +from utils import check +import random +import re +import time + +import requests + + +class MiMotion: + name = "小米运动" + + def __init__(self, check_item): + self.check_item = check_item + self.headers = {"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 9; MI 6 MIUI/20.6.18)"} + + def get_time(self): + url = "http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp" + response = requests.get(url, headers=self.headers).json() + t = response["data"]["t"] + return t + + def get_app_token(self, login_token): + url = f"https://account-cn.huami.com/v1/client/app_tokens?app_name=com.xiaomi.hm.health&dn=api-user.huami.com%2Capi-mifit.huami.com%2Capp-analytics.huami.com&login_token={login_token}" + response = requests.get(url=url, headers=self.headers).json() + app_token = response["token_info"]["app_token"] + return app_token + + @staticmethod + def login(phone, password): + url1 = f"https://api-user.huami.com/registrations/+86{phone}/tokens" + headers = { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", + "User-Agent": "MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)", + } + data1 = { + "client_id": "HuaMi", + "password": f"{password}", + "redirect_uri": "https://s3-us-west-2.amazonaws.com/hm-registration/successsignin.html", + "token": "access", + } + r1 = requests.post(url=url1, data=data1, headers=headers, allow_redirects=False) + location = r1.headers["Location"] + try: + code_pattern = re.compile("(?<=access=).*?(?=&)") + code = code_pattern.findall(location)[0] + except Exception as e: + print(e) + return 0, 0 + url2 = "https://account.huami.com/v2/client/login" + data2 = { + "app_name": "com.xiaomi.hm.health", + "app_version": "5.0.2", + "code": f"{code}", + "country_code": "CN", + "device_id": "10E2A98F-D36F-4DF1-A7B9-3FBD8FBEB800", + "device_model": "phone", + "grant_type": "access_token", + "third_name": "huami_phone", + } + r2 = requests.post(url=url2, data=data2, headers=headers).json() + login_token = r2["token_info"]["login_token"] + userid = r2["token_info"]["user_id"] + return login_token, userid + + def main(self): + phone = str(self.check_item.get("phone")) + password = str(self.check_item.get("password")) + try: + min_step = int(self.check_item.get("min_step", 10000)) + except Exception as e: + print("初始化步数失败: 已将最小值设置为 19999", e) + min_step = 10000 + try: + max_step = int(self.check_item.get("max_step", 19999)) + except Exception as e: + print("初始化步数失败: 已将最大值设置为 19999", e) + max_step = 19999 + step = str(random.randint(min_step, max_step)) + login_token, userid = self.login(phone, password) + if login_token == 0: + msg = [ + {"name": "帐号信息", "value": f"{phone[:4]}****{phone[-4:]}"}, + {"name": "修改信息", "value": f"登陆失败"}, + ] + else: + t = self.get_time() + app_token = self.get_app_token(login_token) + today = time.strftime("%F") + data_json = "%5B%7B%22data_hr%22%3A%22%5C%2F%5C%2F%5C%2F%5C%2F%5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5C%22%3A-1440%2C%5C%22usrEd%5C%22%3A-1440%2C%5C%22wc%5C%22%3A0%2C%5C%22is%5C%22%3A0%2C%5C%22lb%5C%22%3A0%2C%5C%22to%5C%22%3A0%2C%5C%22dt%5C%22%3A0%2C%5C%22rhr%5C%22%3A0%2C%5C%22ss%5C%22%3A0%7D%2C%5C%22stp%5C%22%3A%7B%5C%22ttl%5C%22%3A18272%2C%5C%22dis%5C%22%3A10627%2C%5C%22cal%5C%22%3A510%2C%5C%22wk%5C%22%3A41%2C%5C%22rn%5C%22%3A50%2C%5C%22runDist%5C%22%3A7654%2C%5C%22runCal%5C%22%3A397%2C%5C%22stage%5C%22%3A%5B%7B%5C%22start%5C%22%3A327%2C%5C%22stop%5C%22%3A341%2C%5C%22mode%5C%22%3A1%2C%5C%22dis%5C%22%3A481%2C%5C%22cal%5C%22%3A13%2C%5C%22step%5C%22%3A680%7D%2C%7B%5C%22start%5C%22%3A342%2C%5C%22stop%5C%22%3A367%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A2295%2C%5C%22cal%5C%22%3A95%2C%5C%22step%5C%22%3A2874%7D%2C%7B%5C%22start%5C%22%3A368%2C%5C%22stop%5C%22%3A377%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1592%2C%5C%22cal%5C%22%3A88%2C%5C%22step%5C%22%3A1664%7D%2C%7B%5C%22start%5C%22%3A378%2C%5C%22stop%5C%22%3A386%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1072%2C%5C%22cal%5C%22%3A51%2C%5C%22step%5C%22%3A1245%7D%2C%7B%5C%22start%5C%22%3A387%2C%5C%22stop%5C%22%3A393%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1036%2C%5C%22cal%5C%22%3A57%2C%5C%22step%5C%22%3A1124%7D%2C%7B%5C%22start%5C%22%3A394%2C%5C%22stop%5C%22%3A398%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A488%2C%5C%22cal%5C%22%3A19%2C%5C%22step%5C%22%3A607%7D%2C%7B%5C%22start%5C%22%3A399%2C%5C%22stop%5C%22%3A414%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A2220%2C%5C%22cal%5C%22%3A120%2C%5C%22step%5C%22%3A2371%7D%2C%7B%5C%22start%5C%22%3A415%2C%5C%22stop%5C%22%3A427%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1268%2C%5C%22cal%5C%22%3A59%2C%5C%22step%5C%22%3A1489%7D%2C%7B%5C%22start%5C%22%3A428%2C%5C%22stop%5C%22%3A433%2C%5C%22mode%5C%22%3A1%2C%5C%22dis%5C%22%3A152%2C%5C%22cal%5C%22%3A4%2C%5C%22step%5C%22%3A238%7D%2C%7B%5C%22start%5C%22%3A434%2C%5C%22stop%5C%22%3A444%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A2295%2C%5C%22cal%5C%22%3A95%2C%5C%22step%5C%22%3A2874%7D%2C%7B%5C%22start%5C%22%3A445%2C%5C%22stop%5C%22%3A455%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1592%2C%5C%22cal%5C%22%3A88%2C%5C%22step%5C%22%3A1664%7D%2C%7B%5C%22start%5C%22%3A456%2C%5C%22stop%5C%22%3A466%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1072%2C%5C%22cal%5C%22%3A51%2C%5C%22step%5C%22%3A1245%7D%2C%7B%5C%22start%5C%22%3A467%2C%5C%22stop%5C%22%3A477%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1036%2C%5C%22cal%5C%22%3A57%2C%5C%22step%5C%22%3A1124%7D%2C%7B%5C%22start%5C%22%3A478%2C%5C%22stop%5C%22%3A488%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A488%2C%5C%22cal%5C%22%3A19%2C%5C%22step%5C%22%3A607%7D%2C%7B%5C%22start%5C%22%3A489%2C%5C%22stop%5C%22%3A499%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A2220%2C%5C%22cal%5C%22%3A120%2C%5C%22step%5C%22%3A2371%7D%2C%7B%5C%22start%5C%22%3A500%2C%5C%22stop%5C%22%3A511%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1268%2C%5C%22cal%5C%22%3A59%2C%5C%22step%5C%22%3A1489%7D%2C%7B%5C%22start%5C%22%3A512%2C%5C%22stop%5C%22%3A522%2C%5C%22mode%5C%22%3A1%2C%5C%22dis%5C%22%3A152%2C%5C%22cal%5C%22%3A4%2C%5C%22step%5C%22%3A238%7D%5D%7D%2C%5C%22goal%5C%22%3A8000%2C%5C%22tz%5C%22%3A%5C%2228800%5C%22%7D%22%2C%22source%22%3A24%2C%22type%22%3A0%7D%5D" + finddate = re.compile(r".*?date%22%3A%22(.*?)%22%2C%22data.*?") + findstep = re.compile(r".*?ttl%5C%22%3A(.*?)%2C%5C%22dis.*?") + data_json = re.sub(finddate.findall(data_json)[0], today, str(data_json)) + data_json = re.sub(findstep.findall(data_json)[0], step, str(data_json)) + url = f"https://api-mifit-cn.huami.com/v1/data/band_data.json?&t={t}" + headers = {"apptoken": app_token, "Content-Type": "application/x-www-form-urlencoded"} + data = f"userid={userid}&last_sync_data_time=1628256960&device_type=0&last_deviceid=C4BDB6FFFE2BCA4C&data_json={data_json}" + response = requests.post(url=url, data=data, headers=headers).json() + msg = [ + {"name": "帐号信息", "value": f"{phone[:4]}****{phone[-4:]}"}, + {"name": "修改信息", "value": f"{response['message']}"}, + {"name": "修改步数", "value": f"{step}"}, + ] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="小米运动",run_script_expression="MIMOTION") +def main(*args, **kwargs): + return MiMotion(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() + diff --git a/dailycheckin_scripts/ck_music163.py b/dailycheckin_scripts/ck_music163.py new file mode 100644 index 0000000..9013f57 --- /dev/null +++ b/dailycheckin_scripts/ck_music163.py @@ -0,0 +1,188 @@ +# -*- coding: utf-8 -*- +""" +new Env('网易云音乐'); +""" +from utils import check +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 algorithms, Cipher, modes +from requests import utils + + +urllib3.disable_warnings() + + +class Music163: + name = "网易云音乐" + + 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("phone") + password = self.check_item.get("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 = [ + {"name": "帐号信息", "value": f"{nickname}"}, + {"name": "当前等级", "value": f"{level}"}, + {"name": "签到信息", "value": f"{res_sign}"}, + {"name": "刷歌信息", "value": f"{res_task}"}, + {"name": "当前听歌", "value": f"{now_play_count}"}, + {"name": "升级听歌", "value": f"{next_play_count - now_play_count}"}, + {"name": "升级天数", "value": f"{next_login_count - now_login_count}"}, + ] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="网易云音乐",run_script_expression="music163") +def main(*args, **kwargs): + return Music163(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() + diff --git a/dailycheckin_scripts/ck_oneplusBBS.py b/dailycheckin_scripts/ck_oneplusBBS.py new file mode 100644 index 0000000..8335188 --- /dev/null +++ b/dailycheckin_scripts/ck_oneplusBBS.py @@ -0,0 +1,120 @@ +# -*- coding: utf-8 -*- +""" +new Env('一加手机社区官方论坛'); +""" +from utils import check +import re +import time +from urllib import parse + +import requests + + +class OnePlusBBS: + name = "一加手机社区官方论坛" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(cookie): + headers = { + "Origin": "https://www.oneplusbbs.com", + "Content-Type": "application/x-www-form-urlencoded", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.57", + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", + "Referer": "https://www.oneplusbbs.com/plugin-dsu_paulsign:sign.html", + "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,fr;q=0.5,pl;q=0.4", + "cookie": cookie, + } + params = ( + ("id", "dsu_paulsign:sign"), + ("operation", "qiandao"), + ("infloat", "1"), + ("inajax", "1"), + ) + formhash = re.findall(r"bbs_formhash=(.*?);", cookie)[0] + data = {"formhash": formhash, "qdxq": "kx", "qdmode": "1", "todaysay": "努力奋斗"} + response = requests.post( + url="https://www.oneplusbbs.com/plugin.php", headers=headers, params=params, data=data + ).text + msg = re.findall(r'
(.*?)
', response, re.S) + msg = msg[0].strip() if msg else "Cookie 可能过期" + return msg + + @staticmethod + def draw(cookie): + headers = { + "Accept": "application/json, text/javascript, */*; q=0.01", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.57", + "X-Requested-With": "XMLHttpRequest", + "Origin": "https://www.oneplusbbs.com", + "Referer": "https://www.oneplusbbs.com/plugin-choujiang.html", + "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,fr;q=0.5,pl;q=0.4", + "cookie": cookie, + } + params = ( + ("id", "choujiang"), + ("do", "draw"), + ) + sum_list = [] + success_count = 0 + error_count = 0 + for i in range(10): + try: + data = requests.post(url="https://www.oneplusbbs.com/plugin.php", headers=headers, params=params).json() + if data["ret"] != "": + ret_map = { + "2": 18, + "4": 188, + "5": 88, + "7": 8, + } + ret = data["ret"] + sum_list.append(ret_map.get(ret, 0)) + one_msg = data["msg"] + if str(ret) in ["-1", "-6", "-7"]: + break + else: + success_count += 1 + else: + error_count += 1 + one_msg = "抽奖失败" + except Exception as e: + one_msg = f"抽奖失败: {e}" + error_count += 1 + print(f"第{i + 1}次抽奖结果:" + str(one_msg)) + time.sleep(5) + msg = f"成功抽奖 {success_count} 次" + draw_msg = [ + {"name": "抽奖信息", "value": str(msg)}, + {"name": "抽奖结果", "value": f"获得 {sum(sum_list) - success_count * 10} 加油"}, + ] + return draw_msg + + def main(self): + cookie = self.check_item.get("cookie") + bbs_uname = re.findall(r"bbs_uname=(.*?);", cookie) + bbs_uname = bbs_uname[0].split("%7C")[0] if bbs_uname else "未获取到账号信息" + try: + bbs_uname = parse.unquote(bbs_uname) + except Exception as e: + print(f"bbs_uname 转换失败: {e}") + bbs_uname = bbs_uname + sign_msg = self.sign(cookie=cookie) + draw_msg = self.draw(cookie=cookie) + msg = [ + {"name": "帐号信息", "value": f"{bbs_uname}"}, + {"name": "签到信息", "value": f"{sign_msg}"}, + ] + draw_msg + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="一加手机社区官方论坛", run_script_expression="ONEPLUSBBS") +def main(*args, **kwargs): + return OnePlusBBS(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_picacomic.py b/dailycheckin_scripts/ck_picacomic.py new file mode 100644 index 0000000..4ca7099 --- /dev/null +++ b/dailycheckin_scripts/ck_picacomic.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +""" +new Env('哔咔漫画'); +""" +from utils import check +import hashlib +import hmac +import json +import os +import random +import string +import time + +import requests + + +class Picacomic: + name = "哔咔漫画" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def generate_headers(path: str, data: dict = None, token: str = None): + api_key = "C69BAF41DA5ABD1FFEDC6D2FEA56B" + api_secret = "~d}$Q7$eIni=V)9\\RK/P.RM4;9[7|@/CA}b~OW!3?EV`:<>M7pddUBL5n|0/*Cn" + headers = { + "api-key": api_key, + "accept": "application/vnd.picacomic.com.v1+json", + "app-channel": "2", + "app-version": "2.2.1.2.3.3", + "app-uuid": "defaultUuid", + "app-platform": "android", + "app-build-version": "44", + "User-Agent": "okhttp/3.8.1", + "image-quality": "original", + } + current_time = str(int(time.time())) + nonce = "".join(random.choices(string.ascii_lowercase + string.digits, k=32)) + raw = path + current_time + nonce + "POST" + api_key + raw = raw.lower() + h = hmac.new(api_secret.encode(), digestmod=hashlib.sha256) + h.update(raw.encode()) + signature = h.hexdigest() + headers["time"] = current_time + headers["nonce"] = nonce + headers["signature"] = signature + if data is not None: + headers["Content-Type"] = "application/json; charset=UTF-8" + if token is not None: + headers["authorization"] = token + return headers + + def sign(self, email, password): + try: + data = {"email": email, "password": password} + sign_headers = self.generate_headers(path="auth/sign-in", data=data) + sign_response = requests.post( + url="https://picaapi.picacomic.com/auth/sign-in", + data=json.dumps({"email": "sitoi", "password": "123456st"}), + headers=sign_headers, + timeout=60, + ).json() + token = sign_response.get("data", {}).get("token") + punch_headers = self.generate_headers(path="users/punch-in", token=token) + response = requests.post( + url="https://picaapi.picacomic.com/users/punch-in", headers=punch_headers, timeout=60 + ).json() + if response.get("data", {}).get("res", {}).get("status", {}) == "ok": + msg = "打卡成功" + else: + msg = "重复签到" + except Exception as e: + msg = str(e) + return msg + + def main(self): + email = self.check_item.get("email") + password = self.check_item.get("password") + sign_msg = self.sign(email=email, password=password) + msg = [ + {"name": "帐号信息", "value": f"{email}"}, + {"name": "签到信息", "value": f"{sign_msg}"}, + ] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="哔咔漫画", run_script_expression="PICACOMIC") +def main(*args, **kwargs): + return Picacomic(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_smzdm.py b/dailycheckin_scripts/ck_smzdm.py new file mode 100644 index 0000000..6bf8983 --- /dev/null +++ b/dailycheckin_scripts/ck_smzdm.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +""" +cron: 30 8 * * * +new Env('什么值得买'); +""" +import requests +from requests import utils + +from utils import check + + +class Smzdm(object): + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(session): + try: + current = session.get(url="https://zhiyou.smzdm.com/user/info/jsonp_get_current").json() + if current["checkin"]["has_checkin"]: + msg = [ + {"name": "账号信息", "value": current.get("nickname", "")}, + {"name": "目前积分", "value": current.get("point", "")}, + {"name": "当前经验", "value": current.get("exp", "")}, + {"name": "当前金币", "value": current.get("gold", "")}, + {"name": "碎银子数", "value": current.get("silver", "")}, + {"name": "当前威望", "value": current.get("prestige", "")}, + {"name": "当前等级", "value": current.get("level", "")}, + {"name": "已经签到", "value": f"{current.get('checkin', {}).get('daily_checkin_num', '')} 天"}, + ] + else: + response = session.get(url="https://zhiyou.smzdm.com/user/checkin/jsonp_checkin").json().get("data", {}) + msg = [ + {"name": "账号信息", "value": current.get("nickname", "")}, + {"name": "目前积分", "value": current.get("point", "")}, + {"name": "增加积分", "value": current.get("add_point", "")}, + {"name": "当前经验", "value": current.get("exp", "")}, + {"name": "当前金币", "value": current.get("gold", "")}, + {"name": "当前威望", "value": current.get("prestige", "")}, + {"name": "当前等级", "value": current.get("rank", "")}, + {"name": "已经签到", "value": f"{response.get('checkin_num', {})} 天"}, + ] + except Exception as e: + msg = [ + {"name": "签到信息", "value": "签到失败"}, + {"name": "错误信息", "value": str(e)}, + ] + return msg + + def main(self): + smzdm_cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("cookie").split("; ")} + session = requests.session() + requests.utils.add_dict_to_cookiejar(session.cookies, smzdm_cookie) + session.headers.update( + { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "zh-CN,zh;q=0.9", + "Connection": "keep-alive", + "Host": "zhiyou.smzdm.com", + "Referer": "https://www.smzdm.com/", + "Sec-Fetch-Dest": "script", + "Sec-Fetch-Mode": "no-cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36", + } + ) + msg = self.sign(session=session) + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="什么值得买",run_script_expression="smzdm|什么值得买") +def main(*args, **kwargs): + return Smzdm(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/dailycheckin_scripts/ck_tieba.py b/dailycheckin_scripts/ck_tieba.py new file mode 100644 index 0000000..4f22b4d --- /dev/null +++ b/dailycheckin_scripts/ck_tieba.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +""" +new Env('百度贴吧'); +""" +import hashlib +import json +import re + +import requests +from requests import utils + +from utils import check + + +class Tieba: + name = "百度贴吧" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def login_info(session): + return session.get(url="https://zhidao.baidu.com/api/loginInfo").json() + + def valid(self, session): + try: + content = session.get(url="http://tieba.baidu.com/dc/common/tbs") + except Exception as e: + return False, f"登录验证异常,错误信息: {e}" + data = json.loads(content.text) + if data["is_login"] == 0: + return False, "登录失败,cookie 异常" + tbs = data["tbs"] + user_name = self.login_info(session=session)["userName"] + return tbs, user_name + + @staticmethod + def tieba_list_more(session): + content = session.get(url="http://tieba.baidu.com/f/like/mylike?&pn=1", timeout=(5, 20), allow_redirects=False) + try: + pn = int(re.match(r".*/f/like/mylike\?&pn=(.*?)\">尾页.*", content.text, re.S | re.I).group(1)) + except Exception as e: + pn = 1 + next_page = 1 + pattern = re.compile(r".*?") + while next_page <= pn: + tbname = pattern.findall(content.text) + for x in tbname: + yield x + next_page += 1 + content = session.get( + url=f"http://tieba.baidu.com/f/like/mylike?&pn={next_page}", timeout=(5, 20), allow_redirects=False + ) + + def get_tieba_list(self, session): + tieba_list = list(self.tieba_list_more(session=session)) + return tieba_list + + @staticmethod + def sign(session, tb_name_list, tbs): + success_count, error_count, exist_count, shield_count = 0, 0, 0, 0 + for tb_name in tb_name_list: + md5 = hashlib.md5(f"kw={tb_name}tbs={tbs}tiebaclient!!!".encode("utf-8")).hexdigest() + data = {"kw": tb_name, "tbs": tbs, "sign": md5} + try: + response = session.post(url="http://c.tieba.baidu.com/c/c/forum/sign", data=data).json() + if response["error_code"] == "0": + success_count += 1 + elif response["error_code"] == "160002": + exist_count += 1 + elif response["error_code"] == "340006": + shield_count += 1 + else: + error_count += 1 + except Exception as e: + print(f"贴吧 {tb_name} 签到异常,原因{str(e)}") + msg = [ + {"name": "贴吧总数", "value": len(tb_name_list)}, + {"name": "签到成功", "value": success_count}, + {"name": "已经签到", "value": exist_count}, + {"name": "被屏蔽的", "value": shield_count}, + {"name": "签到失败", "value": error_count}, + ] + return msg + + def main(self): + tieba_cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("cookie").split("; ")} + session = requests.session() + requests.utils.add_dict_to_cookiejar(session.cookies, tieba_cookie) + session.headers.update({"Referer": "https://www.baidu.com/"}) + tbs, user_name = self.valid(session=session) + if tbs: + tb_name_list = self.get_tieba_list(session=session) + msg = self.sign(session=session, tb_name_list=tb_name_list, tbs=tbs) + msg = [{"name": "帐号信息", "value": user_name}] + msg + else: + msg = [ + {"name": "帐号信息", "value": user_name}, + {"name": "签到信息", "value": "Cookie 可能过期"}, + ] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="百度贴吧", run_script_expression="tieba") +def main(*args, **kwargs): + return Tieba(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() + diff --git a/dailycheckin_scripts/ck_unicom.py b/dailycheckin_scripts/ck_unicom.py new file mode 100644 index 0000000..3b43868 --- /dev/null +++ b/dailycheckin_scripts/ck_unicom.py @@ -0,0 +1,349 @@ +# -*- coding: utf-8 -*- +""" +new Env('联通营业厅'); +""" +import base64 +import random +import re +import time + +import requests +import rsa + +from utils import check + + +class UniCom: + name = "联通营业厅" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def str2key(s): + b_str = base64.b64decode(s) + if len(b_str) < 162: + return False + hex_str = "" + for x in b_str: + h = hex(x)[2:] + h = h.rjust(2, "0") + hex_str += h + m_start = 29 * 2 + e_start = 159 * 2 + m_len = 128 * 2 + e_len = 3 * 2 + modulus = hex_str[m_start: m_start + m_len] + exponent = hex_str[e_start: e_start + e_len] + return modulus, exponent + + @staticmethod + def encryption(message, key): + modulus = int(key[0], 16) + exponent = int(key[1], 16) + rsa_pubkey = rsa.PublicKey(modulus, exponent) + crypto = rsa.encrypt(message, rsa_pubkey) + b64str = base64.b64encode(crypto) + return b64str + + def login(self, mobile, password, app_id): + session = requests.Session() + pubkey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDc+CZK9bBA9IU+gZUOc6FUGu7yO9WpTNB0PzmgFBh96Mg1WrovD1oqZ+eIF4LjvxKXGOdI79JRdve9NPhQo07+uqGQgE4imwNnRx7PFtCRryiIEcUoavuNtuRVoBAm6qdB0SrctgaqGfLgKvZHOnwTjyNqjBUxzMeQlEC2czEMSwIDAQAB" + key = self.str2key(pubkey) + mobile = self.encryption(str.encode(mobile), key) + password = self.encryption(str.encode(password), key) + flag = False + cookies = { + "c_sfbm": "234g_00", + "logHostIP": "null", + "route": "cc3839c658dd60cb7c25f6c2fe6eb964", + "channel": "GGPD", + "city": "076|776", + "devicedId": "B97CDE2A-D435-437D-9FEC-5D821A012972", + "mobileService1": "ProEsSI6SM4DbWhaeVsPtve9pu7VWz0m94giTHkPBl40Gx8nebgV!-1027473388", + "mobileServiceAll": "a92d76b26705a45a087027f893c70618", + } + + headers = { + "Host": "m.client.10010.com", + "Accept": "/", + "Content-Type": "application/x-www-form-urlencoded", + "Connection": "keep-alive", + "User-Agent": "ChinaUnicom4.x/3.0 CFNetwork/1197 Darwin/20.0.0", + "Accept-Language": "zh-cn", + "Accept-Encoding": "deflate, br", + "Content-Length": "891", + } + + data = { + "reqtime": round(time.time() * 1000), + "simCount": "1", + "version": "iphone_c@8.0004", + "mobile": mobile, + "netWay": "wifi", + "isRemberPwd": "false", + "appId": app_id, + "deviceId": "b61f7efcba733583170df52d8f2f9f87521b3844d01ccbc774bbfa379eaeb3fa", + "pip": "192.168.1.4", + "password": password, + "deviceOS": "14.0.1", + "deviceBrand": "iphone", + "deviceModel": "iPad", + "remark4": "", + "keyVersion": "", + "deviceCode": "B97CDE2A-D435-437D-9FEC-5D821A012972", + } + + response = session.post( + url="https://m.client.10010.com/mobileService/login.htm", headers=headers, cookies=cookies, data=data + ) + response.encoding = "utf-8" + try: + result = response.json() + if result["code"] == "0": + login_msg = {"name": "账号信息", "value": result["default"][:4] + "xxxx" + result["default"][-4:]} + session.headers.update( + { + "User-Agent": "Mozilla/5.0 (Linux; Android 10; RMX1901 Build/QKQ1.190918.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.186 Mobile Safari/537.36; unicom{version:android@8.0100,desmobile:" + + str(mobile) + + "};devicetype{deviceBrand:Realme,deviceModel:RMX1901};{yw_code:}" + } + ) + flag = True + else: + login_msg = {"name": "账号信息", "value": result["dsc"]} + except Exception as e: + login_msg = {"name": "账号信息", "value": str(e)} + if flag: + return session, login_msg + else: + return False, login_msg + + @staticmethod + def get_encryptmobile(session): + page = session.post(url="https://m.client.10010.com/dailylottery/static/textdl/userLogin") + page.encoding = "utf-8" + match = re.search(r"encryptmobile=\w+", page.text, flags=0) + user_number = match.group(0)[14:] + return user_number + + # 每日签到 + @staticmethod + def daily_daysign(session, mobile): + try: + session.headers.update({"referer": "https://img.client.10010.com/activitys/member/index.html"}) + param = f"yw_code=&desmobile={mobile}&version=android@$8.0100" + session.get(url="https://act.10010.com/SigninApp/signin/querySigninActivity.htm?" + param) + session.headers.update( + {"referer": "https://act.10010.com/SigninApp/signin/querySigninActivity.htm?" + param} + ) + day_sign = session.post(url="https://act.10010.com/SigninApp/signin/daySign") + day_sign.encoding = "utf-8" + session.post(url="https://act.10010.com/SigninApp/signin/todaySign") + session.post(url="https://act.10010.com/SigninApp/signin/addIntegralDA") + session.post(url="https://act.10010.com/SigninApp/signin/getContinuous") + session.post(url="https://act.10010.com/SigninApp/signin/getIntegral") + session.post(url="https://act.10010.com/SigninApp/signin/getGoldTotal") + session.headers.pop("referer") + res = day_sign.json() + if res["status"] == "0000": + return {"name": "每日签到", "value": f"打卡成功!"} + elif res["status"] == "0002": + return {"name": "每日签到", "value": res["msg"]} + except Exception as e: + return {"name": "每日签到", "value": f"错误,原因为: {e}"} + + def daily_lottery(self, session): + daily_lottery_msg = [] + try: + numjsp = self.get_encryptmobile(session=session) + session.post(url="https://m.client.10010.com/mobileservicequery/customerService/share/defaultShare.htm") + session.get( + url="https://m.client.10010.com/dailylottery/static/doubleball/firstpage?encryptmobile=" + numjsp + ) + session.get( + url="https://m.client.10010.com/dailylottery/static/outdailylottery/getRandomGoodsAndInfo?areaCode=076" + ) + session.get( + url="https://m.client.10010.com/dailylottery/static/active/findActivityInfo?areaCode=076&groupByType=&mobile=" + + numjsp + ) + for i in range(3): + luck = session.post( + url="https://m.client.10010.com/dailylottery/static/doubleball/choujiang?usernumberofjsp=" + numjsp + ) + luck.encoding = "utf-8" + res = luck.json() + daily_lottery_msg.append(res["RspMsg"]) + except Exception as e: + daily_lottery_msg.append(str(e)) + return {"name": "天天抽奖", "value": ";".join(daily_lottery_msg)} + + def points_lottery(self, session): + try: + numjsp = self.get_encryptmobile(session=session) + one_free = session.post( + url="https://m.client.10010.com/dailylottery/static/integral/choujiang?usernumberofjsp=" + numjsp + ) + one_free.encoding = "utf-8" + res = one_free.json() + jifeng_msg = res["RspMsg"] + except Exception as e: + jifeng_msg = str(e) + return {"name": "积分抽奖", "value": jifeng_msg} + + @staticmethod + def game_signin(session, mobile): + data = {"methodType": "iOSIntegralGet", "gameLevel": "1", "deviceType": "iOS"} + try: + session.get( + url=f"https://img.client.10010.com/gametask/index.html?yw_code=&desmobile={mobile}&version=android@8.0100" + ) + time.sleep(2) + headers = { + "origin": "https://img.client.10010.com", + "referer": f"https://img.client.10010.com/gametask/index.html?yw_code=&desmobile={mobile}&version=android@8.0100", + } + session.headers.update(headers) + game_center_exp = session.post(url="https://m.client.10010.com/producGameApp", data=data) + game_center_exp.encoding = "utf-8" + res = game_center_exp.json() + session.headers.pop("referer") + session.headers.pop("origin") + time.sleep(1) + if res["code"] == "0000": + return {"name": "游戏频道打卡", "value": f"获得{res['integralNum']}积分"} + else: + return {"name": "游戏频道打卡", "value": res["msg"]} + except Exception as e: + return {"name": "游戏频道打卡", "value": f"错误,原因为: {e}"} + + @staticmethod + def daily_integral_100(session): + data = {"from": random.choice("123456789") + "".join(random.choice("0123456789") for i in range(10))} + try: + integral = session.post( + url="https://m.client.10010.com/welfare-mall-front/mobile/integral/gettheintegral/v1", data=data + ) + integral.encoding = "utf-8" + res = integral.json() + return {"name": "100定向积分", "value": res["msg"]} + except Exception as e: + return {"name": "100定向积分", "value": str(e)} + + @staticmethod + def game_dongao(session): + data = {"from": random.choice("123456789") + "".join(random.choice("0123456789") for i in range(10))} + trance = [600, 300, 300, 300, 300, 300, 300] + try: + dongao_point = session.post( + url="https://m.client.10010.com/welfare-mall-front/mobile/winterTwo/getIntegral/v1", data=data + ) + dongao_point.encoding = "utf-8" + res1 = dongao_point.json() + dongao_num = session.post( + url="https://m.client.10010.com/welfare-mall-front/mobile/winterTwo/winterTwoShop/v1", data=data + ) + dongao_num.encoding = "utf-8" + res2 = dongao_num.json() + if res1["resdata"]["code"] == "0000": + return { + "name": "冬奥积分活动", + "value": res1["resdata"]["desc"] + "," + str(trance[int(res2["resdata"]["signDays"])]) + "积分", + } + + else: + return {"name": "冬奥积分活动", "value": res1["resdata"]["desc"] + "," + res2["resdata"]["desc"]} + except Exception as e: + return {"name": "冬奥积分活动", "value": str(e)} + + @staticmethod + def get_wotree_glowlist(session): + response = session.post(url="https://m.client.10010.com/mactivity/arbordayJson/index.htm") + res = response.json() + return res["data"]["flowChangeList"] + + def wo_tree(self, session): + try: + flow_list = self.get_wotree_glowlist(session) + num = 1 + for flow in flow_list: + # 这里会请求很长时间,发送即请求成功 + flag = False + try: + take_flow = session.get( + url="https://m.client.10010.com/mactivity/flowData/takeFlow.htm?flowId=" + flow["id"], timeout=1 + ) + take_flow.encoding = "utf-8" + except Exception as e: + flag = True + print("【沃之树-领流量】: 4M流量 x" + str(num)) + time.sleep(1) + num = num + 1 + if flag: + continue + res1 = take_flow.json() + if res1["code"] == "0000": + print("【沃之树-领流量】: 4M流量 x" + str(num)) + else: + print("【沃之树-领流量】: 已领取过 x" + str(num)) + time.sleep(1) + num = num + 1 + session.post(url="https://m.client.10010.com/mactivity/arbordayJson/getChanceByIndex.htm?index=0") + grow = session.post(url="https://m.client.10010.com/mactivity/arbordayJson/arbor/3/0/3/grow.htm") + grow.encoding = "utf-8" + res2 = grow.json() + time.sleep(1) + return {"name": "沃之树-浇水", "value": str(res2["data"]["addedValue"]) + "培养值"} + except Exception as e: + return {"name": "沃之树-浇水", "value": str(e)} + + @staticmethod + def user_info(session): + resp = session.get(url="https://m.client.10010.com/mobileService/home/queryUserInfoSeven.htm?showType=3") + user_info_msg = [] + try: + for one in resp.json().get("data", {}).get("dataList", []): + user_info_msg.append({"name": one.get("remainTitle"), "value": one.get("number") + one.get("unit")}) + except Exception as e: + print(e) + return user_info_msg + + def main(self): + mobile = self.check_item.get("mobile") + password = self.check_item.get("password") + app_id = self.check_item.get("app_id") + session, login_msg = self.login(mobile=mobile, password=password, app_id=app_id) + if session: + daily_daysign_msg = self.daily_daysign(session=session, mobile=mobile) + daily_integral_100_msg = self.daily_integral_100(session=session) + daily_lottery_msg = self.daily_lottery(session=session) + game_dongao_msg = self.game_dongao(session=session) + game_signin_msg = self.game_signin(session=session, mobile=mobile) + points_lottery_msg = self.points_lottery(session=session) + wo_tree_msg = self.wo_tree(session=session) + user_info_msg = self.user_info(session=session) + msg = [ + login_msg, + daily_daysign_msg, + daily_integral_100_msg, + daily_lottery_msg, + game_dongao_msg, + game_signin_msg, + points_lottery_msg, + wo_tree_msg, + ] + user_info_msg + else: + msg = [login_msg] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="联通营业厅", run_script_expression="UNICOM") +def main(*args, **kwargs): + return UniCom(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() + diff --git a/dailycheckin_scripts/ck_v2ex.py b/dailycheckin_scripts/ck_v2ex.py new file mode 100644 index 0000000..68beb5a --- /dev/null +++ b/dailycheckin_scripts/ck_v2ex.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +""" +new Env('V2EX 论坛'); +""" +import re + +import requests +import urllib3 +from requests import utils + +from utils import check + +urllib3.disable_warnings() + + +class V2ex: + name = "V2EX 论坛" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(session): + msg = [] + response = session.get(url="https://www.v2ex.com/mission/daily", verify=False) + pattern = ( + r"" + ) + urls = re.findall(pattern=pattern, string=response.text) + url = urls[0] if urls else None + if url is None: + return "cookie 可能过期" + elif url != "/balance": + headers = {"Referer": "https://www.v2ex.com/mission/daily"} + data = {"once": url.split("=")[-1]} + _ = session.get(url="https://www.v2ex.com" + url, verify=False, headers=headers, params=data) + response = session.get(url="https://www.v2ex.com/balance", verify=False) + total = re.findall( + pattern=r"(\d+\.\d+)", string=response.text + ) + total = total[0] if total else "签到失败" + today = re.findall(pattern=r'(.*?)', string=response.text) + today = today[0] if today else "签到失败" + username = re.findall(pattern=r"(.*?)", string=response.text) + username = username[0] if username else "用户名获取失败" + msg += [ + {"name": "帐号信息", "value": username}, + {"name": "今日签到", "value": today}, + {"name": "帐号余额", "value": total}, + ] + response = session.get(url="https://www.v2ex.com/mission/daily", verify=False) + data = re.findall(pattern=r"
(.*?)天
", string=response.text) + data = data[0] + "天" if data else "获取连续签到天数失败" + msg += [ + {"name": "签到天数", "value": data}, + ] + return msg + + def main(self): + cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("cookie").split("; ")} + session = requests.session() + if self.check_item.get("proxy", ""): + proxies = { + "http": self.check_item.get("proxy", ""), + "https": self.check_item.get("proxy", ""), + } + session.proxies.update(proxies) + requests.utils.add_dict_to_cookiejar(session.cookies, cookie) + session.headers.update( + { + "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.66", + "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", + "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", + } + ) + msg = self.sign(session=session) + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="V2EX 论坛", run_script_expression="V2EX") +def main(*args, **kwargs): + return V2ex(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_vqq.py b/dailycheckin_scripts/ck_vqq.py new file mode 100644 index 0000000..9437d96 --- /dev/null +++ b/dailycheckin_scripts/ck_vqq.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +""" +new Env('腾讯视频'); +""" +import re +import time +from urllib import parse + +import requests +from requests import utils + +from utils import check + + +class VQQ: + name = "腾讯视频" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def refresh_cookie(url, headers, cookies): + login = requests.get(url=url, headers=headers, cookies=cookies) + nick = re.findall(r'nick":"(.*?)"', login.text) + if nick: + nick = nick[0] + try: + nick = parse.unquote(nick) + except Exception as e: + print(f"nick 转换失败: {e}") + else: + nick = "未获取到用户" + cookie = requests.utils.dict_from_cookiejar(login.cookies) + return cookie, nick + + @staticmethod + def sign_once(headers, cookies): + url = "http://v.qq.com/x/bu/mobile_checkin?isDarkMode=0&uiType=REGULAR" + res = requests.get(url=url, headers=headers, cookies=cookies) + res.encoding = "utf8" + match = re.search(r'isMultiple" />\s+(.*?)\s+<', res.text) + if "isMultiple" in res.text: + try: + value = match.group(1) + except Exception as e: + print(res.text) + value = "数据获取失败" + msg = f"成长值x{value}" + elif "Unauthorized" in res.text: + msg = "cookie 失效" + else: + msg = "签到失败(可能已签到)\n签到失败: 自行在腾讯视频APP内登录网址签到 http://v.qq.com/x/bu/mobile_checkin (基本每周都需要手动签到一次才可以)" + return msg + + @staticmethod + def sign_twice(headers, cookies): + this_time = int(round(time.time() * 1000)) + url = "https://vip.video.qq.com/fcgi-bin/comm_cgi?name=hierarchical_task_system&cmd=2&_=" + str(this_time) + res = requests.get(url=url, headers=headers, cookies=cookies) + res.encoding = "utf8" + if "Account Verify Error" in res.text: + msg = "签到失败-Cookie失效" + elif "Not VIP" in res.text: + msg = "非会员无法签到" + else: + try: + value = re.search('checkin_score": (.*?),', res.text).group(1) + except Exception as e: + print("获取成长值失败", e) + value = res.text + msg = f"成长值x{value}" + return msg + + @staticmethod + def tasks(headers, cookies): + task_map = { + "1": "观看视频60min", + "3": "使用弹幕特权", + "6": "使用赠片特权", + "7": "使用下载特权", + } + task_msg_list = [] + for task_id, task_name in task_map.items(): + this_time = int(round(time.time() * 1000)) + url = f"https://vip.video.qq.com/fcgi-bin/comm_cgi?name=spp_MissionFaHuo&cmd=4&task_id={task_id}&_=${this_time}" + res = requests.get(url=url, headers=headers, cookies=cookies) + res.encoding = "utf8" + if "score" in res.text: + msg = f"获得+10成长值" + elif "已发过货" in res.text: + msg = "任务已完成" + elif "任务未完成" in res.text: + msg = "任务未完成,需手动完成任务" + else: + msg = res.text + task_msg_list.append({"name": task_name, "value": msg}) + time.sleep(1) + return task_msg_list + + def main(self): + auth_refresh = self.check_item.get("auth_refresh") + if not auth_refresh: + return "参数错误: 缺少 auth_refresh 参数,请查看配置文档" + cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("cookie").split("; ")} + headers = { + "Referer": "https://v.qq.com", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.204 Safari/537.36", + } + login_cookie, nick = self.refresh_cookie(url=auth_refresh, headers=headers, cookies=cookie) + if login_cookie.get("main_login") == "qq": + cookie["vqq_vusession"] = login_cookie.get("vqq_vusession") + else: + cookie["vusession"] = login_cookie.get("vusession") + cookie["access_token"] = login_cookie.get("access_token") + sign_once_msg = self.sign_once(headers=headers, cookies=cookie) + sign_twice_msg = self.sign_twice(headers=headers, cookies=cookie) + task_msg = self.tasks(headers=headers, cookies=cookie) + msg = [ + {"name": "账号信息", "value": nick}, + {"name": "签到奖励1", "value": sign_once_msg}, + {"name": "签到奖励2", "value": sign_twice_msg}, + ] + task_msg + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="腾讯视频",run_script_expression="VQQ") +def main(*args, **kwargs): + return VQQ(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() + diff --git a/dailycheckin_scripts/ck_weibo.py b/dailycheckin_scripts/ck_weibo.py new file mode 100644 index 0000000..c02898d --- /dev/null +++ b/dailycheckin_scripts/ck_weibo.py @@ -0,0 +1,126 @@ +# -*- coding: utf-8 -*- +""" +new Env('微博'); +""" +from urllib import parse + +import requests +import urllib3 + +from utils import check + +urllib3.disable_warnings() + + +class WeiBo: + name = "微博" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(token): + headers = {"User-Agent": "Weibo/52588 (iPhone; iOS 14.5; Scale/3.00)"} + response = requests.get( + url=f"https://api.weibo.cn/2/checkin/add?c=iphone&{token}", headers=headers, verify=False + ) + result = response.json() + if result.get("status") == 10000: + msg = [ + {"name": "连续签到", "value": f'{result.get("data").get("continuous")}天'}, + {"name": "本次收益", "value": result.get("data").get("desc")}, + ] + elif result.get("errno") == 30000: + msg = [ + {"name": "每日签到", "value": "已签到"}, + ] + elif result.get("status") == 90005: + msg = [ + {"name": "每日签到", "value": result.get("msg")}, + ] + else: + msg = [ + {"name": "每日签到", "value": "签到失败"}, + ] + return msg + + @staticmethod + def card(token): + headers = {"User-Agent": "Weibo/52588 (iPhone; iOS 14.5; Scale/3.00)"} + response = requests.get( + url=f"https://api.weibo.cn/2/!/ug/king_act_home?c=iphone&{token}", headers=headers, verify=False + ) + result = response.json() + if result.get("status") == 10000: + nickname = result.get("data").get("user").get("nickname") + msg = [ + {"name": "用户昵称", "value": nickname}, + {"name": "每日打卡", "value": f'{result.get("data").get("signin").get("title").split("<")[0]}天'}, + {"name": "积分总计", "value": result.get("data").get("user").get("energy")}, + ] + else: + msg = [ + {"name": "每日打卡", "value": "活动过期或失效"}, + ] + return msg + + @staticmethod + def pay(token): + headers = { + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Type": "application/x-www-form-urlencoded", + "Host": "pay.sc.weibo.com", + "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Weibo (iPhone10,1__weibo__11.2.1__iphone__os14.5)", + } + data = token + "&lang=zh_CN&wm=3333_2001" + response = requests.post( + url=f"https://pay.sc.weibo.com/aj/mobile/home/welfare/signin/do", headers=headers, data=data, verify=False + ) + try: + result = response.json() + if result.get("status") == 1: + msg = [ + {"name": "微博钱包", "value": f'{result.get("score")} 积分'}, + ] + elif result.get("status") == 2: + msg = [ + {"name": "微博钱包", "value": f"已签到"}, + ] + info_response = requests.post( + url="https://pay.sc.weibo.com/api/client/sdk/app/balance", headers=headers, data=data + ) + info_result = info_response.json() + msg += [ + {"name": "当前现金", "value": f"{info_result.get('data').get('balance')} 元"}, + ] + else: + msg = [ + {"name": "微博钱包", "value": f"Cookie失效"}, + ] + return msg + except Exception as e: + msg = [ + {"name": "微博钱包", "value": f"Cookie失效"}, + ] + return msg + + def main(self): + url = self.check_item.get("url") + query_dict = dict(parse.parse_qsl(parse.urlsplit(url).query)) + token = "&".join([f"{key}={value}" for key, value in query_dict.items() if key in ["from", "uid", "s", "gsid"]]) + sign_msg = self.sign(token=token) + card_msg = self.card(token=token) + pay_msg = self.pay(token=token) + msg = sign_msg + card_msg + pay_msg + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="微博", run_script_expression="WEIBO") +def main(*args, **kwargs): + return WeiBo(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_womail.py b/dailycheckin_scripts/ck_womail.py new file mode 100644 index 0000000..4d3f616 --- /dev/null +++ b/dailycheckin_scripts/ck_womail.py @@ -0,0 +1,421 @@ +# -*- coding: utf-8 -*- +""" +new Env('沃邮箱'); +""" +from utils import check +import json +import os +import re + +import requests + + +class WoMail: + name = "沃邮箱" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def login(womail_url): + try: + url = womail_url + headers = { + "User-Agent": "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3868.400 QQBrowser/10.8.4394.400" + } + res = requests.get(url=url, headers=headers, allow_redirects=False) + set_cookie = res.headers["Set-Cookie"] + cookies = re.findall("YZKF_SESSION.*?;", set_cookie)[0] + if "YZKF_SESSION" in cookies: + return cookies + else: + print("沃邮箱获取 cookies 失败") + return None + except Exception as e: + print("沃邮箱错误:", e) + return None + + @staticmethod + def nyan_task(cookies, pause21days=True): + msg = [] + headers = { + "User-Agent": "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3868.400 QQBrowser/10.8.4394.400", + "Cookie": cookies, + } + try: + url = "https://nyan.mail.wo.cn/cn/sign/index/userinfo.do?rand=0.8897817905278955" + res = requests.post(url=url, headers=headers) + result = res.json() + wxname = result.get("result").get("wxName") + usermobile = result.get("result").get("userMobile") + keep_sign = result["result"]["keepSign"] + msg.append({"name": "帐号信息", "value": f"{wxname} - {usermobile[:3]}****{usermobile[-4:]}"}) + except Exception as e: + keep_sign = 0 + msg.append({"name": "帐号信息", "value": str(e)}) + try: + if pause21days and keep_sign >= 21: + msg.append({"name": "每日签到", "value": f"昨日为打卡{keep_sign}天,今日暂停打卡"}) + else: + url = "https://nyan.mail.wo.cn/cn/sign/user/checkin.do?rand=0.913524814493383" + res = requests.post(url=url, headers=headers).json() + result = res.get("result") + if result == -2: + msg.append({"name": "每日签到", "value": f"已签到 {keep_sign} 天"}) + elif result is None: + msg.append({"name": "每日签到", "value": f"签到失败"}) + else: + msg.append({"name": "每日签到", "value": f"签到成功~已签到{result}天!"}) + except Exception as e: + msg.append({"name": "每日签到", "value": str(e)}) + try: + url = "https://nyan.mail.wo.cn/cn/sign/user/doTask.do?rand=0.8776674762904109" + data_params = { + "每日首次登录手机邮箱": {"taskName": "loginmail"}, + "去用户俱乐部逛一逛": {"taskName": "club"}, + "小积分抽大奖": {"taskName": "clubactivity"}, + "每日答题赢奖": {"taskName": "answer"}, + "下载沃邮箱": {"taskName": "download"}, + } + for key, data in data_params.items(): + try: + res = requests.post(url=url, data=data, headers=headers).json() + result = res.get("result") + if result == 1: + msg.append({"name": key, "value": "做任务成功"}) + elif result == -1: + msg.append({"name": key, "value": "任务已做过"}) + elif result == -2: + msg.append({"name": key, "value": "请检查登录状态"}) + else: + msg.append({"name": key, "value": "未知错误"}) + except Exception as e: + msg.append({"name": key, "value": str(e)}) + except Exception as e: + msg.append({"name": "执行任务错误", "value": str(e)}) + return msg + + @staticmethod + def club_task(womail_url, pause21days=True): + msg = [] + userdata = re.findall("mobile.*", womail_url)[0] + url = "https://club.mail.wo.cn/clubwebservice/?" + userdata + headers = { + "User-Agent": "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3868.400 QQBrowser/10.8.4394.400" + } + try: + res = requests.get(url=url, headers=headers, allow_redirects=False) + set_cookie = res.headers["Set-Cookie"] + cookies = re.findall("SESSION.*?;", set_cookie)[0] + if "SESSION" in cookies: + headers = { + "User-Agent": "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3868.400 QQBrowser/10.8.4394.400", + "Cookie": cookies, + "Referer": "https://club.mail.wo.cn/clubwebservice/club-user/user-info/mine-task", + } + # 获取账号信息 + try: + url = "https://club.mail.wo.cn/clubwebservice/club-user/user-info/get-user-score-info/" + res = requests.get(url=url, headers=headers) + result = res.json() + integraltotal = result.get("integralTotal") + msg.append({"name": "当前积分", "value": f"{integraltotal}"}) + task_data = [ + # 签到任务 + { + "resourceName": "每日签到(积分)", + "url": "https://club.mail.wo.cn/clubwebservice/club-user/user-sign/create?channelId=", + }, + # 积分任务 + { + "irid": 539, + "resourceName": "参与俱乐部活动", + "resourceFlag": "Web_canyujulebuhuodong+2jifen", + "scoreNum": 1, + "scoreResourceType": "add", + "attachData": '{"1":"每天只增加一次积分"}', + "description": "参与俱乐部活动+1积分", + "sourceType": 0, + "link": '{"jumpLink":"https://club.mail.wo.cn/clubwebservice/club-index/activity-scope?currentPage=activityScope"}', + "taskState": 1, + "show": True, + }, + { + "irid": 545, + "resourceName": "俱乐部积分兑换", + "resourceFlag": "Web_jifenduihuan+2jifen", + "scoreNum": 1, + "scoreResourceType": "add", + "attachData": '{"1":"每天只增加一次积分"}', + "description": "俱乐部积分兑换+1积分", + "sourceType": 0, + "link": '{"jumpLink":"https://club.mail.wo.cn/clubwebservice/score-exchange/into-score-exchange?currentPage=js-hover"}', + "taskState": 1, + "show": True, + }, + # 成长值任务 + { + "irid": 254, + "resourceName": "参与俱乐部活动", + "resourceFlag": "activity-web", + "scoreNum": 1, + "scoreResourceType": "add", + "attachData": '{"limit":"true","每日限定几次":"1次"}', + "description": "参与俱乐部活动", + "sourceType": 1, + "link": '{"jumpLink":"https://club.mail.wo.cn/clubwebservice/club-index/activity-scope?currentPage=activityScope"}', + "taskState": 0, + "show": True, + }, + { + "irid": 561, + "resourceName": "俱乐部积分兑换", + "resourceFlag": "Web_jifenduihuan+5chengzhangzhi", + "scoreNum": 1, + "scoreResourceType": "add", + "attachData": '{"limit":"true","每日限定几次":"1次"}', + "description": "俱乐部积分兑换+1成长值", + "sourceType": 1, + "link": '{"jumpLink":"https://club.mail.wo.cn/clubwebservice/score-exchange/into-score-exchange?currentPage=js-hover"}', + "taskState": 0, + "show": True, + }, + ] + for task_item in task_data: + resource_name = task_item["resourceName"] + try: + if "每日签到" in resource_name: + record_url = "https://club.mail.wo.cn/clubwebservice/club-user/user-sign/query-continuous-sign-record" + record_res = requests.get(url=record_url, headers=headers).json() + if len(record_res): + new_continuous_day = record_res[0].get("newContinuousDay") + else: + new_continuous_day = 0 + if pause21days and new_continuous_day >= 21: + msg.append({"name": resource_name, "value": f"昨日为打卡{new_continuous_day}天,今日暂停打卡"}) + else: + url = task_item["url"] + res = requests.get(url=url, headers=headers).json() + result = res.get("description") + if "success" in result: + continuous_day = json.loads(res["data"])["continuousDay"] + msg.append({"name": resource_name, "value": f"签到成功~已连续签到{continuous_day}天!"}) + else: + if "您今天已签到" in result: + msg.append( + {"name": resource_name, "value": f"签到成功~已连续签到{new_continuous_day}天!"} + ) + else: + msg.append({"name": resource_name, "value": result}) + else: + resource_flag = task_item["resourceFlag"] + resource_flag = resource_flag.replace("+", "%2B") + url = ( + f"https://club.mail.wo.cn/clubwebservice/growth/addGrowthViaTask?resourceType={resource_flag}" + if task_item["sourceType"] + else f"https://club.mail.wo.cn/clubwebservice/growth/addIntegral?resourceType={resource_flag}" + ) + res = requests.get(url=url, headers=headers).json() + result = res.get("description") + msg.append({"name": resource_name, "value": result}) + except Exception as e: + msg.append({"name": resource_name, "value": str(e)}) + except Exception as e: + msg.append({"name": "沃邮箱俱乐部", "value": str(e)}) + else: + msg.append({"name": "沃邮箱俱乐部", "value": "获取 SESSION 失败"}) + except Exception as e: + print("沃邮箱俱乐部获取 COOKIES 失败", e) + msg.append({"name": "沃邮箱俱乐部", "value": "获取 COOKIES 失败"}) + return msg + + @staticmethod + def core_task(phone, password): + msg = [] + try: + url = "https://mail.wo.cn/coremail/s/json?func=user:login" + headers = {"User-Agent": "okhttp/${project.version}"} + data_json = {"uid": str(phone), "password": str(password)} + response = requests.post(url=url, headers=headers, data=json.dumps(data_json)) + sid = re.findall('"sid":"(.*?)"', response.text)[0] + set_cookie = response.headers["Set-Cookie"] + cookie = re.findall("Coremail.*?;", set_cookie)[0] + cookie = cookie + "Coremail.sid=" + str(sid) + ";" + if "Coremail" not in cookie: + msg.append({"name": "Coremail", "value": "沃邮箱获取 sid,Coremail 失败"}) + return msg + cookies = cookie + "domain=mail.wo.cn;" + headers = { + "User-Agent": "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3868.400 QQBrowser/10.8.4394.400", + "Cookie": cookies, + "Accept": "text/x-json", + "Content-Type": "text/x-json", + "X-CM-SERVICE": "PHONE", + "Origin": "https://mail.wo.cn", + "X-Requested-With": "com.asiainfo.android", + "Sec-Fetch-Site": "same-origin", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Dest": "empty", + } + # 增加积分 + integral_data = { + "每日登录": "login", + "发送邮件": "sendMail", + "查看邮件": "listMail", + "登录百度网盘": "baiduCloud", + "新建日程": "createCal", + } + for key, userAction in integral_data.items(): + try: + url = "https://mail.wo.cn/coremail/s/?func=club:addClubInfo&sid=" + str(sid) + data_json = { + "uid": str(phone), + "userAction": "" + str(userAction), + "userType": "integral", + } + response = requests.post(url=url, headers=headers, data=json.dumps(data_json)) + code = json.loads(response.text).get("code") + msg.append({"name": key, "value": "app积分结果:" + str(code)}) + except Exception as e: + msg.append({"name": key, "value": f"app沃邮箱执行任务错误:{e}"}) + # 增加成长值 + growth_data = { + "每日登录": "login", + "发送邮件": "sendMail", + "查看邮件": "listMail", + "登录百度网盘": "baiduCloud", + "新建日程": "createCal", + } + for key, userAction in growth_data.items(): + try: + url = "https://mail.wo.cn/coremail/s/?func=club:addClubInfo&sid=" + str(sid) + data_json = { + "uid": str(phone), + "userAction": str(userAction), + "userType": "growth", + } + response = requests.post(url=url, headers=headers, data=json.dumps(data_json)) + code = response.json().get("code") + msg.append({"name": key, "value": "app成长值结果:" + str(code)}) + except Exception as e: + msg.append({"name": key, "value": f"app沃邮箱执行任务错误:{e}"}) + # 网页 + cookies = cookie + "CoremailReferer=https%3A%2F%2Fmail.wo.cn%2Fcoremail%2Fhxphone%2F;" + headers = { + "User-Agent": "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3868.400 QQBrowser/10.8.4394.400", + "Cookie": cookies, + "Accept": "text/x-json", + "Content-Type": "text/x-json", + "Origin": "https://mail.wo.cn", + "X-Requested-With": "com.tencent.mm", + "Sec-Fetch-Site": "same-origin", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Dest": "empty", + } + # 增加积分 + integral_data = { + "每日登录": "login", + "发送邮件": "sendMail", + "查看邮件": "listMail", + "登录百度网盘": "baiduCloud", + "新建日程": "createCal", + "上传文件到中转站": "uploadFile", + } + for key, userAction in dict.items(integral_data): + try: + url = "https://mail.wo.cn/coremail/s/?func=club:addClubInfo&sid=" + str(sid) + data_json = { + "uid": str(phone), + "userAction": str(userAction), + "userType": "integral", + } + response = requests.post(url=url, headers=headers, data=json.dumps(data_json)) + code = response.json().get("code") + msg.append({"name": key, "value": "网页端积分结果:" + str(code)}) + except Exception as e: + msg.append({"name": key, "value": "网页端沃邮箱执行任务错误:" + str(e)}) + # 增加成长值 + growth_data = { + "每日登录": "login", + "发送邮件": "sendMail", + "查看邮件": "listMail", + "登录百度网盘": "baiduCloud", + "新建日程": "createCal", + "上传文件到中转站": "uploadFile", + } + for key, userAction in growth_data.items(): + try: + url = "https://mail.wo.cn/coremail/s/?func=club:addClubInfo&sid=" + str(sid) + data_json = { + "uid": str(phone), + "userAction": str(userAction), + "userType": "growth", + } + response = requests.post(url=url, headers=headers, data=json.dumps(data_json)) + code = response.json().get("code") + msg.append({"name": key, "value": "网页端成长值结果:" + str(code)}) + except Exception as e: + msg.append({"name": key, "value": f"网页端沃邮箱执行任务错误:{e}"}) + # 电脑 + cookies = cookie + "domain=;CoremailReferer=https%3A%2F%2Fmail.wo.cn%2Fcoremail%2Findex.jsp%3Fcus%3D1;" + headers = { + "User-Agent": "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3868.400 QQBrowser/10.8.4394.400", + "Cookie": cookies, + "Accept": "text/x-json", + "Content-Type": "text/x-json", + "Origin": "https://mail.wo.cn", + "X-Requested-With": "XMLHttpRequest", + "Sec-Fetch-Site": "same-origin", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Dest": "empty", + } + # 增加积分 + integral_data = { + "每日登录": "login", + "发送邮件": "sendMail", + "查看邮件": "listMail", + "登录百度网盘": "baiduCloud", + "新建日程": "createCal", + "上传文件到中转站": "uploadFile", + } + for key, userAction in integral_data.items(): + try: + url = "https://mail.wo.cn/coremail/s/?func=club:addClubInfo&sid=" + str(sid) + data_json = {"userAction": "" + str(userAction) + ""} + response = requests.post(url=url, headers=headers, data=json.dumps(data_json)) + code = response.json().get("code") + msg.append({"name": key, "value": "电脑端积分结果:" + str(code)}) + except Exception as e: + msg.append({"name": key, "value": "电脑端沃邮箱执行任务错误:" + str(e)}) + except Exception as e: + msg.append({"name": "web沃邮箱错误", "value": str(e)}) + return msg + + def main(self): + url = self.check_item.get("url") + phone = self.check_item.get("phone") + password = self.check_item.get("password") + pause21days = self.check_item.get("pause21days", True) + try: + cookies = self.login(womail_url=url) + if cookies: + nyan_task_msg = self.nyan_task(cookies=cookies, pause21days=pause21days) + club_task_msg = self.club_task(womail_url=url, pause21days=pause21days) + core_task_msg = self.core_task(phone=phone, password=password) + msg = nyan_task_msg + club_task_msg + core_task_msg + else: + msg = [{"name": "账号信息", "value": "登录失败"}] + except Exception as e: + msg = [{"name": "账号信息", "value": str(e)}] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="沃邮箱",run_script_expression="WOMAIL") +def main(*args, **kwargs): + return WoMail(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() + diff --git a/dailycheckin_scripts/ck_wzyd.py b/dailycheckin_scripts/ck_wzyd.py new file mode 100644 index 0000000..7976761 --- /dev/null +++ b/dailycheckin_scripts/ck_wzyd.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +""" +new Env('王者营地'); +""" +from urllib import parse + +import requests + +from utils import check + + +class WZYD: + name = "王者营地" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(data): + response = requests.post(url="https://ssl.kohsocialapp.qq.com:10001/play/h5sign", data=data).json() + try: + if response["result"] == 0: + msg = "签到成功" + else: + msg = response["returnMsg"] + except: + msg = "请求失败,请检查接口" + return msg + + def main(self): + wzyd_data = self.check_item.get("data") + data = {k: v[0] for k, v in parse.parse_qs(wzyd_data).items()} + try: + user_id = data.get("userId", "") + except Exception as e: + print(f"获取账号信息失败: {e}") + user_id = "未获取到账号信息" + sign_msg = self.sign(data=data) + msg = [ + {"name": "帐号信息", "value": user_id}, + {"name": "签到信息", "value": sign_msg}, + ] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="王者营地",run_script_expression="WZYD") +def main(*args, **kwargs): + return WZYD(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() + diff --git a/dailycheckin_scripts/ck_youdao.py b/dailycheckin_scripts/ck_youdao.py new file mode 100644 index 0000000..bafa8ea --- /dev/null +++ b/dailycheckin_scripts/ck_youdao.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +""" +new Env('有道云笔记'); +""" +from utils import check +import json +import os + +import requests + + +class YouDao: + name = "有道云笔记" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(cookies): + ad_space = 0 + refresh_cookies_res = requests.get("http://note.youdao.com/login/acc/pe/getsess?product=YNOTE", cookies=cookies) + cookies = dict(refresh_cookies_res.cookies) + url = "https://note.youdao.com/yws/api/daupromotion?method=sync" + res = requests.post(url=url, cookies=cookies) + if "error" not in res.text: + checkin_response = requests.post( + url="https://note.youdao.com/yws/mapi/user?method=checkin", cookies=cookies + ) + for i in range(3): + ad_response = requests.post( + url="https://note.youdao.com/yws/mapi/user?method=adRandomPrompt", cookies=cookies + ) + ad_space += ad_response.json().get("space", 0) // 1048576 + if "reward" in res.text: + sync_space = res.json().get("rewardSpace", 0) // 1048576 + checkin_space = checkin_response.json().get("space", 0) // 1048576 + space = sync_space + checkin_space + ad_space + youdao_message = "+{0}M".format(space) + else: + youdao_message = "获取失败" + else: + youdao_message = "Cookie 可能过期" + return youdao_message + + def main(self): + youdao_cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("cookie").split("; ")} + try: + ynote_pers = youdao_cookie.get("YNOTE_PERS", "") + uid = ynote_pers.split("||")[-2] + except Exception as e: + print(f"获取账号信息失败: {e}") + uid = "未获取到账号信息" + msg = self.sign(cookies=youdao_cookie) + msg = [ + {"name": "帐号信息", "value": uid}, + {"name": "获取空间", "value": msg}, + ] + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) + return msg + + +@check(run_script_name="有道云笔记", run_script_expression="YOUDAO") +def main(*args, **kwargs): + return YouDao(check_item=kwargs.get("value")).main() + + +if __name__ == "__main__": + main() diff --git a/dailycheckin_scripts/ck_zhiyoo.py b/dailycheckin_scripts/ck_zhiyoo.py new file mode 100644 index 0000000..10b8edc --- /dev/null +++ b/dailycheckin_scripts/ck_zhiyoo.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +""" +new Env('智友邦'); +""" +from utils import check +import json +import os +import re + +import requests +import urllib3 +from requests import utils + +urllib3.disable_warnings() + + +class ZhiYoo: + name = "智友邦" + + def __init__(self, check_item): + self.check_item = check_item + + @staticmethod + def sign(session): + response = session.get(url="http://bbs.zhiyoo.net/plugin.php?id=dsu_paulsign:sign", verify=False) + formhash = re.findall(r'