mirror of
https://github.com/Ytong825/mao.git
synced 2025-12-16 23:10:06 +08:00
推送
This commit is contained in:
106
达美乐.py
Normal file
106
达美乐.py
Normal file
@@ -0,0 +1,106 @@
|
||||
'''
|
||||
老登须知
|
||||
达美乐,开一把游戏抓取openid的值。
|
||||
一定要在我的奖品那绑定好手机号!
|
||||
变量名1:dmlck,多账号用@隔开。备注信息用#隔开 如openid的值#老登
|
||||
变量名2:pzid 填活动id 这次是 abalone(活动ID自己抓)
|
||||
url = f"https://game.dominos.com.cn/{pzid}/game/gameDone"
|
||||
'''
|
||||
|
||||
import os
|
||||
import time
|
||||
import requests
|
||||
import json
|
||||
|
||||
# 初始化消息和推送配置
|
||||
message = ''
|
||||
wx_app_token = os.getenv('WX_PUSHER_APP_TOKEN') # 从环境变量读取WxPusher Token
|
||||
wx_uids = os.getenv('WX_PUSHER_UID', '') # 接收通知的用户UID,多个用逗号分隔
|
||||
|
||||
# 获取账号和活动ID
|
||||
accounts = os.getenv('dmlck')
|
||||
pzid = os.getenv('pzid')
|
||||
|
||||
def send_wxpusher(title, content):
|
||||
"""发送消息到WxPusher"""
|
||||
if not wx_app_token or not wx_uids:
|
||||
print("未配置WxPusher环境变量,跳过推送")
|
||||
return False
|
||||
url = "http://wxpusher.zjiecode.com/api/send/message"
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
data = {
|
||||
"appToken": wx_app_token,
|
||||
"content": content,
|
||||
"summary": title,
|
||||
"contentType": 1,
|
||||
"uids": wx_uids.split(',')
|
||||
}
|
||||
try:
|
||||
response = requests.post(url, json=data, headers=headers).json()
|
||||
if response.get('code') == 1000:
|
||||
print("推送成功")
|
||||
return True
|
||||
else:
|
||||
print(f"推送失败:{response.get('msg')}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"推送异常:{str(e)}")
|
||||
return False
|
||||
|
||||
if not accounts:
|
||||
print('你没有填入dmlck,咋运行?')
|
||||
exit()
|
||||
|
||||
accounts_list = accounts.split('@')
|
||||
num_accounts = len(accounts_list)
|
||||
print(f"获取到 {num_accounts} 个账号")
|
||||
|
||||
for i, account in enumerate(accounts_list, start=1):
|
||||
values = account.split('#')
|
||||
openid = values[0]
|
||||
remark = values[1] if len(values) > 1 else f"账号{i}" # 备注信息用于推送区分
|
||||
print(f"\n=======开始执行{remark}=======")
|
||||
|
||||
# 固定参数
|
||||
url = f"https://game.dominos.com.cn/{pzid}/game/gameDone"
|
||||
headers = {
|
||||
'User-Agent': "Mozilla/5.0 (iPod; U; CPU iPhone OS 4_2 like Mac OS X; sd-PK) AppleWebKit/535.42.7 (KHTML, like Gecko) Version/4.0.5 Mobile/8B111 Safari/6535.42.7",
|
||||
'Content-Type': "application/x-www-form-urlencoded",
|
||||
'Referer': "https://servicewechat.com/wx887bf6ad752ca2f3/63/page-frame.html"
|
||||
}
|
||||
payload = f"openid={openid}&score=t5%2Bhzvt2h6jpwH7D%2BJkNWvT%2Fb6J2mWDStIgcC4ZSrhkqPEqXtcDrCC9LVFvQLRtGkeVQ7z0W6RYqcXxmeXi9596r4HZ1Pt0E5PpRLYWZZL%2BXQXEpyc0WX8c4ewMqQymjBgGMcSRFp3aaLTDNaRLvLcnnh2t5PpL70pW%2B7LcM8tnhtP1J2rLaTe0Dno7%2B9Qf32LuHUS%2BUXCgQ6YbCJwj%2BWrmhP1zbFvGthkH6HB9lkI9mS%2F%2BY9582WQeFREMF9OflJpRVjgPd1%2FPWFRWKWrl%2F7VGztrHpQLZvLQ9HRINK99cN4FBBvPVkkHxyACadINkuFwxgC9ODPYInHXXpn5iElg%3D%3D"
|
||||
|
||||
# 处理分享任务
|
||||
shrurl = f"https://game.dominos.com.cn/{pzid}/game/sharingDone"
|
||||
payload_share = f"openid={openid}&from=1&target=0"
|
||||
while True:
|
||||
res = requests.post(shrurl, data=payload_share, headers=headers).json()
|
||||
if res.get('errorMessage') == "今日分享已用完,请明日再来":
|
||||
print(f'{remark} 分享已达上限,开始抽奖')
|
||||
break
|
||||
|
||||
# 抽奖逻辑
|
||||
account_msg = f"{remark} 抽奖结果:\n"
|
||||
while True:
|
||||
response = requests.post(url, data=payload, headers=headers).json()
|
||||
if response.get("statusCode") == 0:
|
||||
prize = response.get('content', {}).get('name', '未知奖品')
|
||||
print(f"抽中:{prize}")
|
||||
account_msg += f" - {prize}\n"
|
||||
time.sleep(1)
|
||||
else:
|
||||
err = response.get('errorMessage', '未知错误')
|
||||
print(f"抽奖失败:{err}")
|
||||
account_msg += f" - 错误:{err}\n"
|
||||
break
|
||||
|
||||
message += account_msg + "\n"
|
||||
|
||||
# 汇总推送
|
||||
try:
|
||||
if message:
|
||||
send_wxpusher("达美乐抽奖通知", message.strip())
|
||||
else:
|
||||
print("无有效结果,跳过推送")
|
||||
except Exception as e:
|
||||
print(f"推送失败:{str(e)}")
|
||||
110
达美乐1.py
110
达美乐1.py
@@ -1,110 +0,0 @@
|
||||
'''
|
||||
author:你的jige
|
||||
2024 10.15更新
|
||||
优化查券功能,简化推送。五等奖跟六等奖一样,不用管,只看一等奖。
|
||||
达美乐,开一把游戏抓取openid的值。
|
||||
每次活动更新一定要在我的奖品那重新绑定好手机号!
|
||||
变量名1:dmlck,多账号用@隔开。备注信息用#隔开 如openid的值#大帅比
|
||||
变量名2:pzid 填活动id。自己抓吧
|
||||
|
||||
'''
|
||||
import os
|
||||
import time
|
||||
import requests
|
||||
import json
|
||||
import notify
|
||||
message = ''
|
||||
# from dotenv import load_dotenv
|
||||
# load_dotenv()
|
||||
accounts = os.getenv('dmlck')
|
||||
pzid = os.getenv('pzid')
|
||||
|
||||
if accounts is None:
|
||||
print('你没有填入ck,咋运行?')
|
||||
else:
|
||||
accounts_list = os.environ.get('dmlck').split('@')
|
||||
|
||||
num_of_accounts = len(accounts_list)
|
||||
|
||||
print(f"获取到 {num_of_accounts} 个账号")
|
||||
|
||||
for i, account in enumerate(accounts_list, start=1):
|
||||
|
||||
values = account.split('#')
|
||||
Cookie = values[0]
|
||||
account_no = values[1] if len(values) > 1 else ""
|
||||
print(f"\n=======开始执行账号{i} {account_no}=======")
|
||||
url = f"https://game.dominos.com.cn/{pzid}/game/gameDone"
|
||||
payload = f"openid={Cookie}&score=t5%2Bhzvt2h6jpwH7D%2BJkNWvT%2Fb6J2mWDStIgcC4ZSrhkqPEqXtcDrCC9LVFvQLRtGkeVQ7z0W6RYqcXxmeXi9596r4HZ1Pt0E5PpRLYWZZL%2BXQXEpyc0WX8c4ewMqQymjBgGMcSRFp3aaLTDNaRLvLcnnh2t5PpL70pW%2B7LcM8tnhtP1J2rLaTe0Dno7%2B9Qf32LuHUS%2BUXCgQ6YbCJwj%2BWrmhP1zbFvGthkH6HB9lkI9mS%2F%2BY9582WQeFREMF9OflJpRVjgPd1%2FPWFRWKWrl%2F7VGztrHpQLZvLQ9HRINK99cN4FBBvPVkkHxyACadINkuFwxgC9ODPYInHXXpn5iElg%3D%3D"
|
||||
headers = {
|
||||
'User-Agent': "Mozilla/5.0 (iPod; U; CPU iPhone OS 4_2 like Mac OS X; sd-PK) AppleWebKit/535.42.7 (KHTML, like Gecko) Version/4.0.5 Mobile/8B111 Safari/6535.42.7",
|
||||
'Accept-Encoding': "gzip,compress,br,deflate",
|
||||
'Content-Type': "application/x-www-form-urlencoded",
|
||||
'charset': "utf-8",
|
||||
'Referer': "https://servicewechat.com/wx887bf6ad752ca2f3/63/page-frame.html"
|
||||
}
|
||||
|
||||
while True:
|
||||
shrurl = f"https://game.dominos.com.cn/{pzid}/game/sharingDone"
|
||||
payload2 = f"openid={Cookie}&from=1&target=0"
|
||||
res = requests.post(shrurl, data=payload2, headers=headers).json()
|
||||
if res['errorMessage'] == "今日分享已用完,请明日再来":
|
||||
print(f'账号{i}分享已达上限,开始抽奖\n')
|
||||
break
|
||||
message += f"\n账号{i}:"
|
||||
while True:
|
||||
response = requests.post(url, data=payload, headers=headers)
|
||||
response = response.json()
|
||||
if response["statusCode"] == 0:
|
||||
prize = response['content']['name']
|
||||
print(f"{prize}")
|
||||
time.sleep(1)
|
||||
|
||||
if response["statusCode"] != 0:
|
||||
print(response)
|
||||
err = response['errorMessage']
|
||||
message += f'\n {err}'
|
||||
break
|
||||
#查询优惠券
|
||||
checkurl = "https://game.dominos.com.cn/bulgogi//game/myPrize"
|
||||
params = {
|
||||
'openid': Cookie
|
||||
}
|
||||
checkresponse = requests.get(checkurl, params=params, headers=headers)
|
||||
json_data = checkresponse.json()
|
||||
prize_mapping = {
|
||||
"001": "一等奖",
|
||||
"002": "二等奖",
|
||||
"003": "三等奖",
|
||||
"004": "四等奖",
|
||||
"005": "五等奖",
|
||||
"006": "六等奖"
|
||||
}
|
||||
|
||||
# 初始化计数器
|
||||
prize_count = {
|
||||
"一等奖": 0,
|
||||
"二等奖": 0,
|
||||
"三等奖": 0,
|
||||
"四等奖": 0,
|
||||
"五等奖": 0,
|
||||
"六等奖": 0
|
||||
}
|
||||
|
||||
# 遍历 content 列表并统计每个奖项的获奖次数
|
||||
for item in json_data["content"]:
|
||||
id_value = item["id"]
|
||||
if id_value in prize_mapping:
|
||||
prize_name = prize_mapping[id_value]
|
||||
prize_count[prize_name] += 1
|
||||
|
||||
# 输出每个奖项的获奖次数
|
||||
for prize, count in prize_count.items():
|
||||
mes = (f"\n{prize}: {count}张")
|
||||
message += mes
|
||||
|
||||
try:
|
||||
notify.send('达美乐',message)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print('推送失败')
|
||||
68
达美乐2.py
68
达美乐2.py
@@ -1,68 +0,0 @@
|
||||
'''
|
||||
达美乐,开一把游戏抓取openid的值。
|
||||
一定要在我的奖品那绑定好手机号!
|
||||
变量名1:dmlck,多账号用@隔开。备注信息用#隔开 如openid的值#大帅比
|
||||
变量名2:pzid 填活动id 这次是 abalone(活动ID自己抓)
|
||||
'''
|
||||
import os
|
||||
import time
|
||||
import requests
|
||||
import json
|
||||
import notify
|
||||
message = ''
|
||||
# from dotenv import load_dotenv
|
||||
# load_dotenv()
|
||||
accounts = os.getenv('dmlck')
|
||||
pzid = os.getenv('pzid')
|
||||
if accounts is None:
|
||||
print('你没有填入ck,咋运行?')
|
||||
else:
|
||||
accounts_list = os.environ.get('dmlck').split('@')
|
||||
|
||||
num_of_accounts = len(accounts_list)
|
||||
|
||||
print(f"获取到 {num_of_accounts} 个账号")
|
||||
|
||||
for i, account in enumerate(accounts_list, start=1):
|
||||
|
||||
values = account.split('#')
|
||||
Cookie = values[0]
|
||||
account_no = values[1] if len(values) > 1 else ""
|
||||
print(f"\n=======开始执行账号{i} {account_no}=======")
|
||||
url = f"https://game.dominos.com.cn/{pzid}/game/gameDone"
|
||||
payload = f"openid={Cookie}&score=t5%2Bhzvt2h6jpwH7D%2BJkNWvT%2Fb6J2mWDStIgcC4ZSrhkqPEqXtcDrCC9LVFvQLRtGkeVQ7z0W6RYqcXxmeXi9596r4HZ1Pt0E5PpRLYWZZL%2BXQXEpyc0WX8c4ewMqQymjBgGMcSRFp3aaLTDNaRLvLcnnh2t5PpL70pW%2B7LcM8tnhtP1J2rLaTe0Dno7%2B9Qf32LuHUS%2BUXCgQ6YbCJwj%2BWrmhP1zbFvGthkH6HB9lkI9mS%2F%2BY9582WQeFREMF9OflJpRVjgPd1%2FPWFRWKWrl%2F7VGztrHpQLZvLQ9HRINK99cN4FBBvPVkkHxyACadINkuFwxgC9ODPYInHXXpn5iElg%3D%3D"
|
||||
headers = {
|
||||
'User-Agent': "Mozilla/5.0 (iPod; U; CPU iPhone OS 4_2 like Mac OS X; sd-PK) AppleWebKit/535.42.7 (KHTML, like Gecko) Version/4.0.5 Mobile/8B111 Safari/6535.42.7",
|
||||
'Accept-Encoding': "gzip,compress,br,deflate",
|
||||
'Content-Type': "application/x-www-form-urlencoded",
|
||||
'charset': "utf-8",
|
||||
'Referer': "https://servicewechat.com/wx887bf6ad752ca2f3/63/page-frame.html"
|
||||
}
|
||||
|
||||
while True:
|
||||
shrurl = f"https://game.dominos.com.cn/{pzid}/game/sharingDone"
|
||||
payload2 = f"openid={Cookie}&from=1&target=0"
|
||||
res = requests.post(shrurl, data=payload2, headers=headers).json()
|
||||
if res['errorMessage'] == "今日分享已用完,请明日再来":
|
||||
print(f'账号{i}分享已达上限,开始抽奖')
|
||||
break
|
||||
message +=f"账号{i}"
|
||||
while True:
|
||||
response = requests.post(url, data=payload, headers=headers)
|
||||
response = response.json()
|
||||
if response["statusCode"] == 0:
|
||||
prize = response['content']['name']
|
||||
print(f"\n{prize}")
|
||||
message += f"\n {prize}"
|
||||
time.sleep(1)
|
||||
|
||||
if response["statusCode"] != 0:
|
||||
print(response)
|
||||
err = response['errorMessage']
|
||||
message += f'\n账号{i}\n {err}'
|
||||
break
|
||||
try:
|
||||
notify.send('达美乐',message)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print('推送失败')
|
||||
Reference in New Issue
Block a user