forked from wd210010/only_for_happly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zgfc.py
92 lines (88 loc) · 4.24 KB
/
zgfc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/python3
# -- coding: utf-8 --
# -------------------------------
# @Author : github@wd210010 https://github.com/wd210010/only_for_happly
# @Time : 2024/1/15 9:23
# -------------------------------
# cron "0 0 8 * * *" script-path=xxx.py,tag=匹配cron用
# const $ = new Env('福彩抽奖')
import requests,json,os,random,time
from urllib.parse import quote
#活动路径 中国福彩公众号 右下角新年活动
#手机号登录后 抓取https://ssqcx-serv.cwlo.com.cn域名下的请求头的Authorization 放入青龙变量或者放入config.sh 变量名为zgfcau 放在config.sh的话 多账号用&分割 放在青龙变量就多建几个变量
zgfcaulist =os.getenv("zgfcau").split('&')
#推送加 token
plustoken =os.getenv("plustoken")
def Push(contents):
# plustoken推送
headers = {'Content-Type': 'application/json'}
json = {"token": plustoken, 'title': '中国福彩抽奖', 'content': contents.replace('\n', '<br>'), "template": "json"}
resp = requests.post(f'http://www.pushplus.plus/send', json=json, headers=headers).json()
print('push+推送成功' if resp['code'] == 200 else 'push+推送失败')
wish = ['财运亨通','事业有成','身体健康','家庭和睦','笑口常开','步步高升','心想事成','万事如意','龙马精神','福禄双全']
wishidlist =[]
for i in range(len(zgfcaulist)):
print(f'账号{i+1}')
headers ={
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.45(0x18002d2a) NetType/WIFI Language/zh_CN',
'Authorization': zgfcaulist[i],
}
data = random.choice(wish)
params = quote(data)
print('**开始发送愿望**')
try:
for j in range(3):
resp = requests.post('https://ssqcx-serv.cwlo.com.cn/api/wish/send',headers=headers,data=f'wish={params}')
result = json.loads(resp.text)
print(result['msg'])
if j == 0:
wish_id = result['data']['wish_id']
wishidlist.append(wish_id)
except:
print('该Authorization可能无效!')
print('**开始抽奖**')
try:
for i in range(3):
resp2 = requests.post('https://ssqcx-serv.cwlo.com.cn/api/lottery/start', headers=headers)
result2 = json.loads(resp2.text)
# print(result2)
success = result2['msg']
if success =='成功' and len(result2['data']['lottery_sn'])>0:
massage = f'账号{i+1}中奖了!请自行查看'
print(massage)
Push(contents=massage)
elif success =='成功' and len(result2['data']['lottery_sn'])==0:
print('未中奖')
else:
print(success)
time.sleep(2)
except:
print('该Authorization可能无效!')
print(wishidlist)
print('**开始点赞**')
for a in range(len(wishidlist)):
for b in range(len(zgfcaulist)):
headers2 = {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.45(0x18002d2a) NetType/WIFI Language/zh_CN',
'Authorization': zgfcaulist[b],
}
resp3 = requests.post('https://ssqcx-serv.cwlo.com.cn/api/wish/zan',headers=headers2,data=f'wish_id={wishidlist[a]}')
result3 = json.loads(resp3.text)
print(result3)
for c in range(len(zgfcaulist)):
headers3 = {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.45(0x18002d2a) NetType/WIFI Language/zh_CN',
'Authorization': zgfcaulist[c],
}
resp4 = requests.post('https://ssqcx-serv.cwlo.com.cn/api/user/prize', headers=headers3)
try:
result4 = json.loads(resp4.text)['data']['prize']
print(f'账号{c+1}获取已经获得奖品:')
print(f'获得奖品数量:{str(len(result4))}')
for d in range(len(result4)):
print(result4[d]['prize_title'])
except:
print('*****')