✨✨ 增加购买种子功能
This commit is contained in:
parent
67b47964f8
commit
d9b548fd47
41
hykb.py
41
hykb.py
@ -11,16 +11,13 @@ import urllib.parse
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
import requests
|
|
||||||
|
|
||||||
from sendNotify import send_notification_message
|
from sendNotify import send_notification_message
|
||||||
|
|
||||||
if 'Hykb_cookie' in os.environ:
|
if 'Hykb_cookie' in os.environ:
|
||||||
Hykb_cookie = re.split("@", os.environ.get("Hykb_cookie"))
|
Hykb_cookie = re.split("@", os.environ.get("Hykb_cookie"))
|
||||||
else:
|
else:
|
||||||
Hykb_cookie = [
|
Hykb_cookie = []
|
||||||
"1|0|128421985|5b+r54iG55So5oi3MTI4NDIxOTg1|kbA25014349F11473F467DC6FF5C89E9D6|plcAoJ6jITDlGvEnGl80IlfuoREWIlVjITZOpv6U7WI=%1|5312899df0a922f9707df9a5ad8dee37"
|
|
||||||
]
|
|
||||||
print("未查找到Hykb_cookie变量.")
|
print("未查找到Hykb_cookie变量.")
|
||||||
|
|
||||||
|
|
||||||
@ -179,32 +176,11 @@ class HaoYouKuaiBao():
|
|||||||
"""
|
"""
|
||||||
# 获取种子商品id
|
# 获取种子商品id
|
||||||
goods_id, goods_name = self.get_goods()
|
goods_id, goods_name = self.get_goods()
|
||||||
print(goods_id, goods_name)
|
l_response = self.client.post(
|
||||||
headers = {
|
url="https://huodong3.3839.com/n/hykb/bmhstore2/inc/virtual/ajaxVirtual.php",
|
||||||
# 'User-Agent': "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@",
|
content=f"ac=checkExchange&gid={goods_id}&t={datetime.now().strftime('%Y-%m-%d %H:%M:%S')}&r=0.{random.randint(100000000000000000, 899999999999999999)}&scookie={urllib.parse.quote(self.cookie)}&device=kbA25014349F11473F467DC6FF5C89E9D6"
|
||||||
# 'Accept': "application/json, text/javascript, */*; q=0.01",
|
|
||||||
# 'Accept-Encoding': "gzip, deflate",
|
|
||||||
# 'X-Requested-With': "XMLHttpRequest",
|
|
||||||
'Content-Type': "application/x-www-form-urlencoded; charset=UTF-8",
|
|
||||||
'Origin': "https://huodong3.3839.com",
|
|
||||||
# 'Sec-Fetch-Site': "same-origin",
|
|
||||||
# 'Sec-Fetch-Mode': "cors",
|
|
||||||
# 'Sec-Fetch-Dest': "empty",
|
|
||||||
# 'Referer': "https://huodong3.3839.com/n/hykb/bmhstore2/inc/virtual/index.php?gid=14403&jtype=1",
|
|
||||||
# 'Accept-Language': "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
||||||
# 'Cookie': "cornfarm_iback_v5=ok; Hm_lvt_f1fb60d2559a83c8fa1ee6125a352bd7=1726835084; HMACCOUNT=A31622759CFC8814; friend_iback_v5=ok; cornfarm_shop_v1=ok; Birthday_btn_v1=ok; UM_distinctid=1921fb977e97c-0d88697ab29ace-6c074671-53c31-1921fb977ea7e; cornfarm_moren_btn_v1=ok; Hm_lpvt_f1fb60d2559a83c8fa1ee6125a352bd7=1727595549"
|
|
||||||
}
|
|
||||||
url = "https://huodong3.3839.com/n/hykb/bmhstore2/inc/virtual/ajaxVirtual.php"
|
|
||||||
# payload = f"ac=login&gid=14403&t=2024-09-29+15%3A39%3A33&r=0.4950858317265687&scookie={urllib.parse.quote(self.cookie)}&device=kbA25014349F11473F467DC6FF5C89E9D6"
|
|
||||||
payload = "ac=login&gid=14403&t=2024-09-29+15%3A39%3A33&r=0.4950858317265687&scookie=1%7C0%7C128421985%7C5b%2Br54iG55So5oi3MTI4NDIxOTg1%7CkbA25014349F11473F467DC6FF5C89E9D6%7CplcAoJ6jITDlGvEnGl80IlfuoREWIlVjITZOpv6U7WI%3D%251%7C5312899df0a922f9707df9a5ad8dee37&device=kbA25014349F11473F467DC6FF5C89E9D6"
|
|
||||||
l_response = requests.post(
|
|
||||||
url=url,
|
|
||||||
headers=headers,
|
|
||||||
data=payload,
|
|
||||||
verify=False
|
|
||||||
# content=f"ac=login&t={datetime.now().strftime('%Y-%m-%d %H:%M:%S')}&r=0.{random.randint(100000000000000000, 899999999999999999)}&gid={goods_id}&scookie={urllib.parse.quote(self.cookie)}&device=kbA25014349F11473F467DC6FF5C89E9D6"
|
|
||||||
).json()
|
).json()
|
||||||
if l_response['key'] != "ok":
|
if l_response['key'] != "200" and l_response['msg'] != "验证通过":
|
||||||
print("好游快爆-购买种子出现错误:{}".format(l_response))
|
print("好游快爆-购买种子出现错误:{}".format(l_response))
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
@ -215,11 +191,10 @@ class HaoYouKuaiBao():
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
j_response = response.json()
|
j_response = response.json()
|
||||||
print(j_response)
|
|
||||||
if j_response['key'] == 200:
|
if j_response['key'] == 200:
|
||||||
print(f"好游快爆-用户【{self.user_name}】购买了【{goods_name}】")
|
print(f"好游快爆-用户【{self.user_name}】购买了【{goods_name}】,还剩下🍿爆米花{j_response['bmh']}个")
|
||||||
send_notification_message(title="好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"),
|
send_notification_message(title="好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"),
|
||||||
content=f"好游快爆-用户【{self.user_name}】购买了【{goods_name}】")
|
content=f"好游快爆-用户【{self.user_name}】购买了【{goods_name}】,还剩下🍿爆米花{j_response['bmh']}个")
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
print("好游快爆-购买种子失败:{}".format(j_response))
|
print("好游快爆-购买种子失败:{}".format(j_response))
|
||||||
@ -294,7 +269,7 @@ if __name__ == '__main__':
|
|||||||
threads = []
|
threads = []
|
||||||
for cookie_ in Hykb_cookie:
|
for cookie_ in Hykb_cookie:
|
||||||
hykb = HaoYouKuaiBao(cookie_)
|
hykb = HaoYouKuaiBao(cookie_)
|
||||||
thread = threading.Thread(target=hykb.buy_seeds)
|
thread = threading.Thread(target=hykb.sgin)
|
||||||
threads.append(thread)
|
threads.append(thread)
|
||||||
thread.start()
|
thread.start()
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user