From 81a76d3e3ba249dd92e9d2dcca546d77225cf1c5 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 17 Sep 2024 21:37:45 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=90=9B:bug:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=87=AA=E8=A1=8C=E5=AE=9A=E4=B9=89=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E7=9A=84=E6=96=B9=E5=BC=8F=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeChatPublicNumberPushInformation.py | 40 ++++++++++++++++------------ 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/WeChatPublicNumberPushInformation.py b/WeChatPublicNumberPushInformation.py index 1966e71..68388b8 100644 --- a/WeChatPublicNumberPushInformation.py +++ b/WeChatPublicNumberPushInformation.py @@ -4,7 +4,9 @@ # @author Echo # @EditTime 2024/9/14 import datetime +import os import random +import re import time import httpx from typing import Text, Optional, List, Dict @@ -33,25 +35,29 @@ from typing import Text, Optional, List, Dict """ 设置配置常量 """ -API_KEY = "" # 天聚数行密钥 -APP_ID = "" # 微信公众号appid -APP_SECRET = "" # 微信公众号appsecret -WECHAT_USER_IDS = [] # 要推送的微信用户ID -TEMPLATE_ID = "" # 模板ID -CITY_NAME = "" # 城市 -AREA = "" # 区县 -EXAMINATION_DATE = "" # 考研日期 -USER = "" # 对象称呼 -BIRTHDAY = "" # 对象生日 -STAR_SIGN = "" # 对象星座 -LOVE_DATE = "" # 恋爱开始日期 +CONFIG = { + "API_KEY": "", # 天聚数行密钥 + "APP_ID": "", # 微信公众号appid + "APP_SECRET": "", # 微信公众号appsecret + "TEMPLATE_ID": "", # 模板ID + "CITY_NAME": "", # 城市 + "AREA": "", # 区县 + "EXAMINATION_DATE": "", # 考研日期 + "USER": "", # 对象称呼 + "BIRTHDAY": "", # 对象生日 + "STAR_SIGN": "", # 对象星座 + "LOVE_DATE": "" # 恋爱开始日期 +} +# 从环境变量中获取配置,如果环境变量不存在则使用默认值 +for key in CONFIG: + CONFIG[key] = os.environ.get(key, CONFIG[key]) -# if 'tian_api_key' in os.environ: -# api_key = re.split("@|&", os.environ.get("tian_api_key")) -# else: -# api_key = [] -# print("未查找到tian_api_key变量.") +# 特殊处理 WECHAT_USER_IDS,因为它需要被分割 +WECHAT_USER_IDS = re.split("@|&", os.environ.get("WECHAT_USER_IDS", "")) if "WECHAT_USER_IDS" in os.environ else [] + +# 使用全局变量 +globals().update(CONFIG) def time_diff(time1: Text, time2: Text, format) -> int: From bab84d06a15d5b9dcab2d895139f724418fa499a Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 17 Sep 2024 22:13:03 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9C=A8:sparkles:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=88=B1=E5=BF=83=E6=97=8B=E8=BD=AC=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeChatPublicNumberPushInformation.py | 2 +- heartSpin.html | 84 ++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 heartSpin.html diff --git a/WeChatPublicNumberPushInformation.py b/WeChatPublicNumberPushInformation.py index 68388b8..cd84c94 100644 --- a/WeChatPublicNumberPushInformation.py +++ b/WeChatPublicNumberPushInformation.py @@ -265,7 +265,7 @@ class WeChatPushMessage: "touser": user, "template_id": TEMPLATE_ID, - "url": "http://www.baidu.com", + "url": "heartSpin.html", "topcolor": "#FF0000", "data": { "today": {"value": time_, "color": self.get_color()}, # 当前时间 diff --git a/heartSpin.html b/heartSpin.html new file mode 100644 index 0000000..1d6a74d --- /dev/null +++ b/heartSpin.html @@ -0,0 +1,84 @@ + + + + + + + Document + + + + +
+ + + + + + +
+
+
+
+ + +
+ + + + + + \ No newline at end of file From a4518e40498420a20c9087652ca1a5e64a6c60e9 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 20 Sep 2024 23:22:18 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E2=9C=A8:sparkles:=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A5=BD=E6=B8=B8=E5=BF=AB=E7=88=86=E7=AD=BE=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hykb.py | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 hykb.py diff --git a/hykb.py b/hykb.py new file mode 100644 index 0000000..fa45305 --- /dev/null +++ b/hykb.py @@ -0,0 +1,184 @@ +# -*- coding=UTF-8 -*- +# @Project QL_TimingScript +# @fileName hykb.py +# @author Echo +# @EditTime 2024/9/20 +import os +import re + +import requests +import random +import datetime + +if 'Hykb_cookie' in os.environ: + Hykb_cookie = re.split("@|&", os.environ.get("Hykb_cookie")) +else: + Hykb_cookie = [] + print("未查找到Hykb_cookie变量.") + + +class HaoYouKuaiBao(): + """好游快爆签到 + """ + + def __init__(self): + self.cookie = Hykb_cookie + self.url = "https://huodong3.3839.com/n/hykb/{}/ajax{}.php" + self.data = "ac={}&r=0.{}&scookie={}" + self.headers = { + "Origin": "https://huodong3.i3839.com", + "Referer": "https://huodong3.3839.com/n/hykb/cornfarm/index.php?imm=0", + "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", + "User-Agent": "Mozilla/5.0 (Linux; Android 13; M2012K11AC Build/TKQ1.220829.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/115.0.5790.166 Mobile Safari/537.36Androidkb/1.5.7.005(android;M2012K11AC;13;1080x2320;WiFi);@4399_sykb_android_activity@" + } + + def plant(self) -> int: + """播种 + """ + url = self.url.format("cornfarm", "_plant") + data = self.data.format("Plant", random.randint(1000000000000000, 8999999999999999), self.cookie) + try: + response = requests.post(url, headers=self.headers, data=data).json() + if response['key'] == 'ok': + print("好游快爆-播种成功") + return 1 + else: + if response['seed'] == 0: + print("好游快爆-种子已用完") + return -1 + else: + print("好游快爆-播种失败") + return 0 + except Exception as e: + print(f"好游快爆-播种出现错误:{e}") + return False + + def harvest(self) -> bool: + """收获 + """ + url = self.url.format("cornfarm", "_plant") + data = self.data.format("Harvest", random.randint(1000000000000000, 8999999999999999), self.cookie) + try: + response = requests.post(url, headers=self.headers, data=data).json() + if response['key'] == 'ok': + print("好游快爆-收获成功") + return True + else: + print("好游快爆-收获失败") + return False + except Exception as e: + print(f"好游快爆-收获出现错误:{e}") + return False + + def login(self): + """登录 + """ + url = self.url.format("cornfarm", "") + data = self.data.format("login", random.randint(100000000000000, 8999999999999999), self.cookie) + response = requests.post(url, headers=self.headers, data=data) + try: + response = response.json() + return response + except Exception as e: + print("好游快爆-登录出现错误:{}".format(e)) + # response = response.text + # return response + + def watering(self): + """浇水 + """ + url = self.url.format("cornfarm", "_sign") + data = self.data.format("Sign&verison=1.5.7.005&OpenAutoSign=", + random.randint(100000000000000, 8999999999999999), self.cookie) + try: + response = requests.post(url, headers=self.headers, data=data).json() + if response['key'] == 'ok': + print("好游快爆-浇水成功") + return 1, response['add_baomihua'] + elif response['key'] == '1001': + print("好游快爆-今日已浇水") + return 0, 0 + else: + print("好游快爆-浇水出现错误:{}".format(response)) + return -1, 0 + except Exception as e: + print("好游快爆-浇水出现错误:{}".format(e)) + return -1, 0 + + # def buyseeds(self): + # """购买种子 + # """ + # url = self.url.format("bmhstore2/inc/virtual", "Virtual") + # print(url) + # ac = "exchange&t=" + datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + "&goodsid=14565" + # data = self.data.format(ac, random.randint(100000000000000, 8999999999999999), self.cookie) + # print(data) + # response = requests.post(url, headers=self.headers, data=data) + # print(response.json()) + + def sgin(self): + info = "" + # 登录 + data = self.login() + if data['key'] == 'ok': + if data['config']['csd_jdt'] == "100%": + # 收获 + if self.harvest(): + info = info + "收获成功\n" + # 播种 + b = self.plant() + if b == -1: + info = info + "播种失败,没有种子\n" + elif b == 1: + info = info + "播种成功\n" + # 浇水 + data = self.watering() + if data[0] == 1: + info = info + f"浇水成功,获得{data[1]}爆米花\n" + elif data[0] == 0: + info = info + f"今日已浇水\n" + else: + info = info + f"浇水失败\n" + else: + info = info + "播种失败\n" + else: + info = info + "收获失败\n" + + elif data['config']['grew'] == '-1': + # 播种 + b = self.plant() + if b == -1: + info = info + "播种失败,没有种子\n" + elif b == 1: + info = info + "播种成功\n" + # 浇水 + data = self.watering() + if data[0] == 1: + info = info + f"浇水成功,获得{data[1]}爆米花\n" + elif data[0] == 0: + info = info + f"今日已浇水\n" + else: + info = info + f"浇水失败\n" + else: + info = info + "播种失败\n" + + else: + # 浇水 + data = self.watering() + if data[0] == 1: + info = info + f"浇水成功,获得{data[1]}爆米花\n" + elif data[0] == 0: + info = info + f"今日已浇水\n" + else: + info = info + f"浇水失败\n" + else: + info = info + "登录失败\n" + + return info + + +if __name__ == '__main__': + for cookie_ in Hykb_cookie: + hykb = HaoYouKuaiBao() + hykb.sgin() + del hykb From 8a0efb31a5fcbbd473b09214771e7aacffae458b Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 20 Sep 2024 23:47:40 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9C=A8:art:=20=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E4=B8=8D=E8=83=BD=E6=8C=87=E5=AE=9A=E4=B8=80?= =?UTF-8?q?=E4=B8=AAuser-agent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hykb.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hykb.py b/hykb.py index fa45305..32401ee 100644 --- a/hykb.py +++ b/hykb.py @@ -21,15 +21,15 @@ class HaoYouKuaiBao(): """好游快爆签到 """ - def __init__(self): - self.cookie = Hykb_cookie + def __init__(self, cookie, user_agent): + self.cookie = cookie self.url = "https://huodong3.3839.com/n/hykb/{}/ajax{}.php" self.data = "ac={}&r=0.{}&scookie={}" self.headers = { "Origin": "https://huodong3.i3839.com", "Referer": "https://huodong3.3839.com/n/hykb/cornfarm/index.php?imm=0", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", - "User-Agent": "Mozilla/5.0 (Linux; Android 13; M2012K11AC Build/TKQ1.220829.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/115.0.5790.166 Mobile Safari/537.36Androidkb/1.5.7.005(android;M2012K11AC;13;1080x2320;WiFi);@4399_sykb_android_activity@" + "User-Agent": user_agent } def plant(self) -> int: @@ -178,7 +178,11 @@ class HaoYouKuaiBao(): if __name__ == '__main__': - for cookie_ in Hykb_cookie: - hykb = HaoYouKuaiBao() + user_agents = [ + "Mozilla/5.0 (Linux; Android 13; M2012K11AC Build/TKQ1.220829.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/115.0.5790.166 Mobile Safari/537.36Androidkb/1.5.7.005(android;M2012K11AC;13;1080x2320;WiFi);@4399_sykb_android_activity@", + "Mozilla/5.0 (Linux; Android 12; Redmi K30 Pro Build/SKQ1.211006.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/96.0.4664.104 Mobile Safari/537.36Androidkb/1.5.7.507(android;Redmi K30 Pro;12;1080x2356;WiFi);@4399_sykb_android_activity@" + ] + for cookie_, user_agent in zip(Hykb_cookie, user_agents): + hykb = HaoYouKuaiBao(cookie_, user_agent) hykb.sgin() del hykb From 963ca657f2324413513739b92d9e56b0b6cb4344 Mon Sep 17 00:00:00 2001 From: echo Date: Sat, 21 Sep 2024 12:10:43 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E2=9C=A8:art:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hykb.py | 10 +++++++++- sendNotify.py | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hykb.py b/hykb.py index 32401ee..8729f4f 100644 --- a/hykb.py +++ b/hykb.py @@ -5,10 +5,11 @@ # @EditTime 2024/9/20 import os import re +from datetime import datetime import requests import random -import datetime +from sendNotify import send_notification_message if 'Hykb_cookie' in os.environ: Hykb_cookie = re.split("@|&", os.environ.get("Hykb_cookie")) @@ -41,13 +42,16 @@ class HaoYouKuaiBao(): response = requests.post(url, headers=self.headers, data=data).json() if response['key'] == 'ok': print("好游快爆-播种成功") + send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), "好游快爆-播种成功") return 1 else: if response['seed'] == 0: print("好游快爆-种子已用完") + send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), "好游快爆-种子已用完") return -1 else: print("好游快爆-播种失败") + send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), "好游快爆-播种失败") return 0 except Exception as e: print(f"好游快爆-播种出现错误:{e}") @@ -62,9 +66,11 @@ class HaoYouKuaiBao(): response = requests.post(url, headers=self.headers, data=data).json() if response['key'] == 'ok': print("好游快爆-收获成功") + send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), "好游快爆-收获成功") return True else: print("好游快爆-收获失败") + send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), "好游快爆-收获失败") return False except Exception as e: print(f"好游快爆-收获出现错误:{e}") @@ -94,9 +100,11 @@ class HaoYouKuaiBao(): response = requests.post(url, headers=self.headers, data=data).json() if response['key'] == 'ok': print("好游快爆-浇水成功") + send_notification_message(title="好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), content="好游快爆-浇水成功") return 1, response['add_baomihua'] elif response['key'] == '1001': print("好游快爆-今日已浇水") + send_notification_message(title="好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), content="好游快爆-今日已浇水") return 0, 0 else: print("好游快爆-浇水出现错误:{}".format(response)) diff --git a/sendNotify.py b/sendNotify.py index b19235e..ce9201a 100644 --- a/sendNotify.py +++ b/sendNotify.py @@ -472,5 +472,12 @@ def main(): send('title', 'content') +def send_notification_message(title, content): + try: + dingding_bot(title, content) + except Exception as e: + print("发送通知消息失败") + + if __name__ == '__main__': main()