From e3d006a8538f91be8725a6d96f5eb11be13df2d5 Mon Sep 17 00:00:00 2001 From: Sitoi <133397418@qq.com> Date: Tue, 6 Feb 2024 14:45:12 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=96=B0=E5=A2=9E(README.md):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96README.md=E4=B8=AD=E7=9A=84=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=92=8C=E9=93=BE=E6=8E=A5=E6=A0=BC=E5=BC=8F=20=E2=9C=A8=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E(dailycheckin):=20=E6=B7=BB=E5=8A=A0=E5=A5=A5?= =?UTF-8?q?=E6=8B=89=E6=98=9F=E7=AD=BE=E5=88=B0=E5=8A=9F=E8=83=BD=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=20=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D(imaotai/main.py):?= =?UTF-8?q?=20=E6=94=B9=E7=94=A8JSON=E5=93=8D=E5=BA=94=E4=B8=AD=E7=9A=84su?= =?UTF-8?q?ccessDesc=E5=AD=97=E6=AE=B5=20=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?(smzdm/main.py):=20=E4=BC=98=E5=8C=96=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E5=A5=96=E5=8A=B1=E4=BF=A1=E6=81=AF=E7=9A=84=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=85=B7=E4=BD=93=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=9B=BF=E4=BB=A3=E6=95=B4=E4=B8=AA=E5=93=8D=E5=BA=94=E8=BE=93?= =?UTF-8?q?=E5=87=BA=20=E2=99=BB=EF=B8=8F=20=E9=87=8D=E6=9E=84(dailychecki?= =?UTF-8?q?n/=5F=5Fversion=5F=5F.py):=20=E6=9B=B4=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E8=87=B324.2.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +- dailycheckin/__version__.py | 2 +- dailycheckin/aolaxing/__init__.py | 0 dailycheckin/aolaxing/main.py | 94 +++++++++++++++++++++++++++++++ dailycheckin/imaotai/main.py | 6 +- dailycheckin/smzdm/main.py | 24 +++++--- 6 files changed, 117 insertions(+), 15 deletions(-) create mode 100755 dailycheckin/aolaxing/__init__.py create mode 100755 dailycheckin/aolaxing/main.py diff --git a/README.md b/README.md index cc91489ad..950dd1472 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
- +

DailyCheckIn

@@ -90,7 +90,7 @@ This project is [MIT](./LICENSE) licensed. [github-issues-shield]: https://img.shields.io/github/issues/sitoi/dailycheckin?color=ff80eb&labelColor=black&style=flat-square [github-license-link]: https://github.com/sitoi/dailycheckin/blob/main/LICENSE [github-license-shield]: https://img.shields.io/github/license/sitoi/dailycheckin?labelColor=black&style=flat-square -[github-stars-link]: https://github.com/sitoi/dailycheckin/network/stargazers +[github-stars-link]: https://github.com/sitoi/dailycheckin/stargazers [github-stars-shield]: https://img.shields.io/github/stars/sitoi/dailycheckin?color=ffcb47&labelColor=black&style=flat-square [github-releases-link]: https://github.com/sitoi/dailycheckin/releases [github-releases-shield]: https://img.shields.io/github/v/release/sitoi/dailycheckin?labelColor=black&style=flat-square @@ -101,7 +101,7 @@ This project is [MIT](./LICENSE) licensed. [github-contrib-link]: https://github.com/sitoi/dailycheckin/graphs/contributors [github-contrib-shield]: https://contrib.rocks/image?repo=sitoi%2Fdailycheckin [docker-pull-shield]: https://img.shields.io/docker/pulls/sitoi/dailycheckin?labelColor=black&style=flat-square -[docker-pull-link]: https://hub.docker.com/repository/docker/sitoi/ +[docker-pull-link]: https://hub.docker.com/repository/docker/sitoi/dailycheckin [docker-size-shield]: https://img.shields.io/docker/image-size/sitoi/dailycheckin?labelColor=black&style=flat-square [docker-size-link]: https://hub.docker.com/repository/docker/sitoi/dailycheckin [docker-stars-shield]: https://img.shields.io/docker/stars/sitoi/dailycheckin?labelColor=black&style=flat-square diff --git a/dailycheckin/__version__.py b/dailycheckin/__version__.py index b108e5425..1e0838188 100755 --- a/dailycheckin/__version__.py +++ b/dailycheckin/__version__.py @@ -1 +1 @@ -__version__ = "24.1.20" +__version__ = "24.2.6" diff --git a/dailycheckin/aolaxing/__init__.py b/dailycheckin/aolaxing/__init__.py new file mode 100755 index 000000000..e69de29bb diff --git a/dailycheckin/aolaxing/main.py b/dailycheckin/aolaxing/main.py new file mode 100755 index 000000000..8176fa60d --- /dev/null +++ b/dailycheckin/aolaxing/main.py @@ -0,0 +1,94 @@ +import json +import os +import time + +import requests + +from dailycheckin import CheckIn + + +class AoLaXing(CheckIn): + name = "奥拉星" + + def __init__(self, check_item: dict): + self.check_item = check_item + + def user(self, headers): + url = "http://service.100bt.com/creditmall/my/user_info.jsonp" + user_json = requests.get(url, headers=headers).json() + user_data = user_json["jsonResult"]["data"] + try: + credit = user_data["credit"] + creditHistory = user_data["creditHistory"] + phoneNum = user_data["phoneNum"] + signInTotal = user_data["signInTotal"] + except Exception as e: + return [{"name": "签到", "value": str(e)}] + msgs = [ + {"name": "用户", "value": phoneNum}, + {"name": "当前积分", "value": credit}, + {"name": "总共获得积分", "value": creditHistory}, + {"name": "总签到", "value": signInTotal}, + ] + return msgs + + def practise(self, headers, task_id): + url = f"http://service.100bt.com/creditmall/activity/do_task.jsonp?taskId={task_id}&gameId=2&_=1643440166690" + task_json = requests.get(url, headers=headers).json() + try: + message = task_json["jsonResult"]["message"] + except: + message = "NO" + return message + + def task(self, headers, msg: bool = False): + url = "http://service.100bt.com/creditmall/activity/daily_task_list.jsonp?gameId=2&_=1643437206026" + task_json = requests.get(url, headers=headers).json() + task_data = task_json["jsonResult"]["data"] + task_finish_count = 0 + for task_item in task_data: + name = task_item["name"] + status_desc = task_item["status_desc"] + task_id = task_item["taskID"] + if msg: + if status_desc == "已完成": + task_finish_count += 1 + else: + if status_desc == "未完成": + print(f"开始任务:{name}") + res = self.practise(task_id=task_id, headers=headers) + print(f"返回状态:{res}") + time.sleep(2.5) + msgs = [ + {"name": "今日任务总数", "value": len(task_data)}, + {"name": "今日任务完成数", "value": task_finish_count}, + ] + return msgs + + def main(self): + cookie = self.check_item.get("cookie") + headers = { + "Host": "service.100bt.com", + "Proxy-Connection": "keep-alive", + "Accept": "*/*", + "Referer": "http://www.100bt.com/", + "Accept-Encoding": "gzip, deflate", + "Accept-Language": "zh-CN,zh;q=0.9", + "Cookie": cookie, + } + _ = self.task(headers) + task_msgs = self.task(headers=headers, msg=True) + user_msgs = self.user(headers=headers) + msgs = task_msgs + user_msgs + msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msgs]) + return msg + + +if __name__ == "__main__": + with open( + os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"), + encoding="utf-8", + ) as f: + datas = json.loads(f.read()) + _check_item = datas.get("AOLAXING", [])[0] + print(AoLaXing(check_item=_check_item).main()) diff --git a/dailycheckin/imaotai/main.py b/dailycheckin/imaotai/main.py index 71d096347..98b49c4bd 100755 --- a/dailycheckin/imaotai/main.py +++ b/dailycheckin/imaotai/main.py @@ -250,7 +250,7 @@ def reservation(self, params: dict): ) msg = { "name": "申购结果", - "value": responses.text, + "value": responses.json().get("data", {}).get("successDesc"), } return msg @@ -264,14 +264,14 @@ def getUserEnergyAward(self): "YX_SUPPORT_WEBP": "1", } response = requests.post( - "https://h5.moutai519.com.cn/game/isolationPage/getUserEnergyAward", + url="https://h5.moutai519.com.cn/game/isolationPage/getUserEnergyAward", cookies=cookies, headers=self.headers, json={}, ) return { "name": "小茅运", - "value": response.text, + "value": response.json().get("message"), } def main(self): diff --git a/dailycheckin/smzdm/main.py b/dailycheckin/smzdm/main.py index 797a6f26d..0dfba99c9 100755 --- a/dailycheckin/smzdm/main.py +++ b/dailycheckin/smzdm/main.py @@ -67,7 +67,20 @@ def all_reward(self, headers, data): url2 = "https://user-api.smzdm.com/checkin/all_reward" resp = requests.post(url=url2, headers=headers, data=data) result = resp.json() - return result + normal_reward = result["data"]["normal_reward"] + msgs = [] + if normal_reward: + msgs = [ + { + "name": "签到奖励", + "value": normal_reward["reward_add"]["content"], + }, + { + "name": "连续签到", + "value": normal_reward["sub_title"], + }, + ] + return msgs def active(self, cookie): zdm_active_id = ["ljX8qVlEA7"] @@ -164,13 +177,8 @@ def main(self): token = self.robot_token(headers) error_msg, data = self.sign(headers, token) msg.append({"name": "签到结果", "value": error_msg}) - result = self.all_reward(headers, data) - msg.append( - { - "name": "什么值得买", - "value": json.dumps(result["data"], ensure_ascii=False), - }, - ) + reward_msg = self.all_reward(headers, data) + msg += reward_msg msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg]) return msg