-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathQLaolastart.py
177 lines (162 loc) · 6.73 KB
/
QLaolastart.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
File: QLaolastart.py(奥拉星积分商店签到)
Author: Hennessey
Date: 2023/7/3 11:40
cron: 30 6 * * *
new Env('奥拉星积分商店签到');
Update: 2023/7/3 上线青龙
"""
import requests,json,time,os,random,sys
#from DingBotSend import Dingbot
weizhi = os.path.dirname(os.path.abspath(__file__))
class aola():
def set(Cookie):
global hand
uatxt = open(weizhi+'/ua.js',encoding='UTF-8')
ua_lin = uatxt.readlines()
urlits = []
for UA in ua_lin:
temp=UA.replace('\n','')
urlits.append(temp)
UAt = random.choice(urlits)
hand = {
"Host": "service.100bt.com",
"Proxy-Connection": "keep-alive",
"User-Agent": UAt,
"Accept": "*/*",
"Referer": "http://www.100bt.com/",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9",
"Cookie":Cookie
}
def user():
url = "http://service.100bt.com/creditmall/my/user_info.jsonp"
user = requests.get(url,headers=hand)
user_json = json.loads(user.text)
user_data = user_json['jsonResult']['data']
try:
credit = user_data['credit']
creditHistory = user_data['creditHistory']
phoneNum = user_data['phoneNum']
signInTotal = user_data['signInTotal']
jsonResultname = user_data['name']
except:
credit = "errow"
return credit,None,None,None,None
print(f"用户:{phoneNum}\n当前积分:{credit} 总共获得积分:{creditHistory}\n总签到:{signInTotal} 天")
return credit,creditHistory,phoneNum,signInTotal,jsonResultname
def task():
url = "http://service.100bt.com/creditmall/activity/daily_task_list.jsonp?gameId=2&_=1643437206026"
task = requests.get(url,headers=hand)
task_json = json.loads(task.text)
task_data = task_json['jsonResult']['data']
task_len = len(task_data)
for shu in range(task_len):
name = task_data[shu]['name']
status_desc = task_data[shu]['status_desc']
taskID = task_data[shu]['taskID']
print(f"\n任务:{name} 状态:{status_desc}")
if status_desc == "已完成":
continue
if status_desc == "未完成":
print(f"开始任务:{name}")
zhixing = aola.practise(taskID)
print(f"返回状态:{zhixing}")
time.sleep(2.5)
task_len1,task_surr = aola.task_jian()
return task_len1,task_surr
def task_jian():
url = "http://service.100bt.com/creditmall/activity/daily_task_list.jsonp?gameId=2&_=1643437206026"
task = requests.get(url,headers=hand)
task_json = json.loads(task.text)
task_data = task_json['jsonResult']['data']
task_len = len(task_data)
task_surr = 0
for shu in range(task_len):
status_desc = task_data[shu]['status_desc']
if status_desc == "已完成":
task_surr+=1
print(f"今日任务总数:{task_len},完成数:{task_surr}")
return task_len,task_surr
def practise(taskID):
url = f"http://service.100bt.com/creditmall/activity/do_task.jsonp?taskId={taskID}&gameId=2&_=1643440166690"
task = requests.get(url,headers=hand)
task_json = json.loads(task.text)
try:
message = task_json['jsonResult']['message']
except:
message = "NO"
return message
def start(Cookie):
print("首次获得用户信息")
credit,creditHistory,phoneNum,signInTotal,jsonResultname = aola.user()
if credit == "errow":
return "Cookie失效"
task_len,task_surr = aola.task()
print("再次获得用户信息")
now_credit,now_creditHistory,now_phoneNum,now_signInTotal,jsonResultname = aola.user()
jifen = now_credit - credit
Send = (f"\n\n【用户】🆔{now_phoneNum}\n【今日总任务数】{task_len},成功数量:{task_surr} 个\n【本次获得积分】{jifen}\n【当前积分】{now_credit}\n【总共签到】{now_signInTotal} 天")
return Send
def Cookie():
CookieJDs = []
if 'AOLA_COOKIE' in os.environ:
if '&' in os.environ['AOLA_COOKIE']:
CookieJDs = os.environ['AOLA_COOKIE'].split('&')
elif '\n' in os.environ['AOLA_COOKIE']:
CookieJDs = os.environ['AOLA_COOKIE'].split('\n')
else:
CookieJDs = [os.environ['AOLA_COOKIE']]
CookieJDs = list(set(filter(None, CookieJDs)))
#print(f'\n====================共{len(CookieJDs)}个奥拉星账户Cookie=================\n')
return CookieJDs
def zhu():
Cookie_list_H = aola.Cookie()
Cookie_list_Len = len(Cookie_list_H)
print(f"用户数量:{Cookie_list_Len}")
#Cookie_list_Len 有多少个元素就执行多少次
siji = 0
Send_zhong_Send = ""
for Cookie_list in Cookie_list_H:
siji = 1
aola.set(Cookie_list)
Send_zhong = aola.start(Cookie_list)
if Send_zhong == "Cookie失效":
print("账户:",Cookie_list,"\nCookie失效")
Send_zhong_Send += f"\n{str(Send_zhong)}"
if siji >= 1:
pass
else:
print("====================未检测到用户Cookie,结束运行====================")
return "没有检测到可以使用的用户Cookie"
Send_tou = ("奥拉星积分商城活动")
Send_wei = ("\n\n活动地址\nhttp://www.100bt.com/m/creditMall/?gameId=2#task\n仅供个人使用,不构成任何商业性质")
Send = Send_tou+Send_zhong_Send+Send_wei
#Dingbot.Send(Send)
return Send
# 加载通知服务
def load_send():
cur_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(cur_path)
if os.path.exists(cur_path + "/sendNotify.py"):
try:
from sendNotify import send
return send
except Exception as e:
print(f"加载通知服务失败:{e}")
return None
else:
print("加载通知服务失败")
return None
if __name__ == "__main__":
#from dotenv import load_dotenv
#load_dotenv()
import datetime
now_riqi = datetime.datetime.now().strftime('[%Y/%m/%d, %H:%M:%S]')
print(f"==================程序执行- 北京时间(UTC+8):{now_riqi} PM=====================\n")
contents = aola.zhu()
send_notify = aola.load_send()
if send_notify:
send_notify("奥拉星活动助手",contents)