From 7fdd843dafea8c2da7066a6ea701ee28f1822937 Mon Sep 17 00:00:00 2001 From: Sitoi <133397418@qq.com> Date: Wed, 28 Apr 2021 18:45:47 +0800 Subject: [PATCH] =?UTF-8?q?:hammer:=20=E6=B7=BB=E5=8A=A0=E3=80=90=E8=81=94?= =?UTF-8?q?=E9=80=9A=E6=B2=83=E9=82=AE=E7=AE=B1=E3=80=91=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E7=AD=BE=E5=88=B0=E8=84=9A=E6=9C=AC=20=E6=84=9F=E8=B0=A2?= =?UTF-8?q?=E6=B0=B4=E5=8F=8B`@=E4=BB=80=E4=B9=88=E5=A4=A7=E9=A3=8E?= =?UTF-8?q?=E5=A4=A7=E6=B5=AA=E9=83=BD=E8=A7=81=E8=BF=87`=20=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy_tencent_scf.yml | 1 + .github/workflows/main.yml | 1 + README.md | 3 + config.py | 2 + config/config.template.json | 8 ++ docs/index.md | 1 + docs/settings.md | 18 +++- womail/__init__.py | 2 + womail/womail.py | 111 +++++++++++++++++++++++ 9 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 womail/__init__.py create mode 100644 womail/womail.py diff --git a/.github/workflows/deploy_tencent_scf.yml b/.github/workflows/deploy_tencent_scf.yml index 6cc5827..ad9971f 100644 --- a/.github/workflows/deploy_tencent_scf.yml +++ b/.github/workflows/deploy_tencent_scf.yml @@ -85,6 +85,7 @@ jobs: DUOKAN_COOKIE_LIST: ${{secrets.DUOKAN_COOKIE_LIST}} CSDN_COOKIE_LIST: ${{secrets.CSDN_COOKIE_LIST}} WZYD_DATA_LIST: ${{secrets.WZYD_DATA_LIST}} + WOMAIL_URL_LIST: ${{secrets.WOMAIL_URL_LIST}} - name: "部署到腾讯云函数" run: sls deploy --debug diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 271f2d6..b22118a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,3 +75,4 @@ jobs: DUOKAN_COOKIE_LIST: ${{secrets.DUOKAN_COOKIE_LIST}} CSDN_COOKIE_LIST: ${{secrets.CSDN_COOKIE_LIST}} WZYD_DATA_LIST: ${{secrets.WZYD_DATA_LIST}} + WOMAIL_URL_LIST: ${{secrets.WOMAIL_URL_LIST}} diff --git a/README.md b/README.md index 52e584f..db36e10 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ |签到|[MEIZU 社区](https://bbs.meizu.cn)|每日签到、可配置抽奖|WEB|待测试|🟢️| |签到|[智友邦](http://zhizhiyoo.net/)|每日签到获取金币|WEB|待测试|🟢️| |签到|[CSDN](https://www.csdn.net/)|每日签到、抽奖|WEB|待测试|🟢️| +|签到|联通沃邮箱|每日签到、抽奖|小程序|待测试|🟡| |签到|王者营地|每日签到(仅限 QQ 区)|APP|待测试|🟢| |签到|微博|每日钱包签到、打卡|APP|待测试|🟢️| |签到|多看阅读|获取书豆,用于购买书籍|APP|待测试|🟢️| @@ -112,6 +113,8 @@
更新日志(点击展开) +- 2021-04-28 + * 添加【联通沃邮箱】每日签到脚本 感谢水友`@什么大风大浪都见过` 提供脚本 - 2021-04-07 * 添加【王者营地】每日签到脚本 * 添加【CSDN】每日签到脚本 diff --git a/config.py b/config.py index 0ed1adc..d5965ba 100644 --- a/config.py +++ b/config.py @@ -25,6 +25,7 @@ from v2ex import V2exCheckIn from vqq import VQQCheckIn from weather import Weather from weibo import WeiBoCheckIn +from womail import WoMailCheckIn from wps import WPSCheckIn from www2nzz import WWW2nzzCheckIn from wzyd import WZYDCheckIn @@ -59,6 +60,7 @@ checkin_map = { "DUOKAN_COOKIE_LIST": ("多看阅读", DuoKanCheckIn), "CSDN_COOKIE_LIST": ("CSDN", CSDNCheckIn), "WZYD_DATA_LIST": ("王者营地", WZYDCheckIn), + "WOMAIL_URL_LIST": ("沃邮箱", WoMailCheckIn), "CITY_NAME_LIST": ("天气预报", Weather), } diff --git a/config/config.template.json b/config/config.template.json index 43240df..0ed167a 100644 --- a/config/config.template.json +++ b/config/config.template.json @@ -272,5 +272,13 @@ { "wzyd_data": "多账号 data 填写,请参考上面,data 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" } + ], + "WOMAIL_URL_LIST": [ + { + "womail_url": "https://nyan.mail.wo.cn/cn/sign/index/index?mobile=xxxxxx&userName=&openId=xxxxxx" + }, + { + "womail_url": "多账号 url 填写,请参考上面,url 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } ] } \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index ef81c41..4ddfd37 100644 --- a/docs/index.md +++ b/docs/index.md @@ -39,6 +39,7 @@ |签到|[MEIZU 社区](https://bbs.meizu.cn)|每日签到、可配置抽奖|WEB|待测试|🟢️| |签到|[智友邦](http://zhizhiyoo.net/)|每日签到获取金币|WEB|待测试|🟢️| |签到|[CSDN](https://www.csdn.net/)|每日签到、抽奖|WEB|待测试|🟢️| +|签到|联通沃邮箱|每日签到、抽奖|小程序|待测试|🟡| |签到|王者营地|每日签到(仅限 QQ 区)|APP|待测试|🟢| |签到|微博|每日钱包签到、打卡|APP|待测试|🟢️| |签到|多看阅读|获取书豆,用于购买书籍|APP|待测试|🟢️| diff --git a/docs/settings.md b/docs/settings.md index 986d4e9..840348b 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -58,11 +58,19 @@ |_**ZHIYOO_COOKIE_LIST**_.zhiyoo_cookie|[智友邦](http://zhizhiyoo.net/)|Web| 智友邦 WEB Cookie| |_**CSDN_COOKIE_LIST**_.csdn_cookie|[CSDN](https://www.csdn.net/)|Web| CSDN Cookie| + +### 小程序签到配置 + +|Name|归属|属性|说明| +|:---:|:---:|:---:|:---| +|_**WOMAIL_URL_LIST**_.womail_url|联通沃邮箱|小程序|联通沃邮箱 小程序 `https://nyan.mail.wo.cn/cn/sign/index/index?mobile` 开头的 URL| + + ### APP 签到配置 |Name|归属|属性|说明| |:---:|:---:|:---:|:---| -|_**LIANTONG_ACCOUNT_LIST**_.data|联通营业厅|APP|联通营业厅 每日签到| +|_**LIANTONG_ACCOUNT_LIST**_.data|联通营业厅|APP|联通营业厅 APP 请求中的 Body| |_**FMAPP_ACCOUNT_LIST**_.fmapp_token|Fa米家|APP|Fa米家 APP headers 中的 token| |_**FMAPP_ACCOUNT_LIST**_.fmapp_cookie|Fa米家|APP|Fa米家 APP headers 中的 cookie| |_**FMAPP_ACCOUNT_LIST**_.fmapp_blackbox|Fa米家|APP|Fa米家 APP headers 中的 blackBox| @@ -450,6 +458,14 @@ { "wzyd_data": "多账号 data 填写,请参考上面,data 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" } + ], + "WOMAIL_URL_LIST": [ + { + "womail_url": "https://nyan.mail.wo.cn/cn/sign/index/index?mobile=xxxxxx&userName=&openId=xxxxxx" + }, + { + "womail_url": "多账号 url 填写,请参考上面,url 以实际获取为准(遇到特殊字符如双引号\" 请加反斜杠转义)" + } ] } ``` \ No newline at end of file diff --git a/womail/__init__.py b/womail/__init__.py new file mode 100644 index 0000000..732f4d2 --- /dev/null +++ b/womail/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from womail.womail import WoMailCheckIn diff --git a/womail/womail.py b/womail/womail.py new file mode 100644 index 0000000..b3d82de --- /dev/null +++ b/womail/womail.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +import json +import os +import re + +import requests + + +class WoMailCheckIn: + 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 dotask(cookies): + 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") + userdata = f"帐号信息: {wxName} - {userMobile[:3]}****{userMobile[-4:]}\n" + msg += userdata + except Exception as e: + print("沃邮箱获取用户信息失败", e) + msg += "沃邮箱获取用户信息失败\n" + try: + 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 += "每日签到: 已签到\n" + elif result is None: + msg += f"每日签到: 签到失败\n" + else: + msg += f"每日签到: 签到成功~已签到{result}天!\n" + except Exception as e: + print("沃邮箱签到错误", e) + msg += "沃邮箱签到错误\n" + try: + url = "https://nyan.mail.wo.cn/cn/sign/user/doTask.do?rand=0.8776674762904109" + data_params = { + "每日首次登录手机邮箱": {"taskName": "loginmail"}, + "和WOWO熊一起寻宝": {"taskName": "treasure"}, + "去用户俱乐部逛一逛": {"taskName": "club"}, + } + for key, data in dict.items(data_params): + try: + res = requests.post(url=url, data=data, headers=headers).json() + result = res.get("result") + if result == 1: + msg += f"{key}: 做任务成功\n" + elif result == -1: + msg += f"{key}: 任务已做过\n" + elif result == -2: + msg += f"{key}: 请检查登录状态\n" + else: + msg += f"{key}: 未知错误\n" + except Exception as e: + print(f"沃邮箱执行任务【{key}】错误", e) + msg += f"沃邮箱执行任务【{key}】错误" + + except Exception as e: + print("沃邮箱执行任务错误", e) + msg += "沃邮箱执行任务错误错误" + return msg + + def main(self): + womail_url = self.check_item.get("womail_url") + try: + cookies = self.login(womail_url) + if cookies: + msg = self.dotask(cookies) + else: + msg = "登录失败" + except Exception as e: + print(e) + msg = "登录失败" + return msg + + +if __name__ == "__main__": + with open( + os.path.join(os.path.dirname(os.path.dirname(__file__)), "config/config.json"), "r", encoding="utf-8" + ) as f: + datas = json.loads(f.read()) + _check_item = datas.get("WOMAIL_URL_LIST", [])[1] + print(WoMailCheckIn(check_item=_check_item).main())