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