-
Notifications
You must be signed in to change notification settings - Fork 69
/
星抖短剧.py
289 lines (268 loc) · 11.2 KB
/
星抖短剧.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# --------------------------------注释区--------------------------------
# 入口:https://www.xingdouduanju.com/pages/register/index.html?invite_code=351449 走个头谢谢
# 变量:yuanshen_xddj 多号@
# 抓取Authorization的值填入
# corn: 八小时一次 22 8-23/8 * * *
exchange = True #是否自动兑换猪 开启True 关闭False
# --------------------------------一般不动区--------------------------------
# _ooOoo_
# o8888888o
# 88" . "88
# (| -_- |)
# O\ = /O
# ____/`---'\____
# . ' \\| |// `.
# / \\||| : |||// \
# / _||||| -:- |||||- \
# | | \\\ - /// | |
# | \_| ''\---/'' | |
# \ .-\__ `-` ___/-. /
# ___`. .' /--.--\ `. . __
# ."" '< `.___\_<|>_/___.' >'"".
# | | : `- \`.;`\ _ /`;.`/ - ` : | |
# \ \ `-. \_ __\ /__ _/ .-` / /
# ======`-.____`-.___\_____/___.-`____.-'======
# `=---='
#
# .............................................
# 佛祖保佑 永无BUG
# 佛祖镇楼 BUG辟邪
#佛曰:
# 写字楼里写字间,写字间里程序员;
# 程序人员写程序,又拿程序换酒钱。
# 酒醒只在网上坐,酒醉还来网下眠;
# 酒醉酒醒日复日,网上网下年复年。
# 但愿老死电脑间,不愿鞠躬老板前;
# 奔驰宝马贵者趣,公交自行程序员。
# 别人笑我忒疯癫,我笑自己命太贱;
# 不见满街漂亮妹,哪个归得程序员?
#
# --------------------------------代码区--------------------------------
import requests
import json
import time
import os
import random
import hashlib
def version():
txt = requests.get("https://gitee.com/HuaJiB/yuanshen34/raw/master/pubilc.txt").text
print(txt)
class yuanshen():
def __init__(self,cookie):
self.url = "https://api.xingdouduanju.com"
self.key = "kjKjb8WRmfb77U6IMqsVtIuIFQCvab4JBqABNqSp"
self.cookie = cookie
self.header = {
"Authorization": f"{self.cookie}",
"X-Version-Code": "126",
"X-Platform": "android",
"X-System": "13",
"X-Brand": "Redmi",
"Content-Type": "application/json; charset=utf-8",
"Host": "api.xingdouduanju.com",
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip",
"User-Agent": "okhttp/4.9.2"
}
def _md5(self,s):
md5 = hashlib.md5()
md5.update(s.encode('utf-8'))
return md5.hexdigest()
def _nonce(self,length=16):
nonce = os.urandom(length)
return nonce.hex()
def _time(self):
return (int(time.time() * 1000))
def gold_task(self,id,name):
url = f"https://api.xingdouduanju.com/api/gold_tasks/{id}/complete"
self.nonce = self._nonce()
self.time = self._time()
if id == 11 or id == 1:
self.sign = self._md5(f"{id}&{self.time}&{self.nonce}&{self.key}&true")
else:
self.sign = self._md5(f"{self.time}&{id}&{self.nonce}&{self.key}&true")
data = {
"timestamp": f"{self.time}",
"nonce": f"{self.nonce}",
"id": f"{id}",
"done":True,
"sign": f"{self.sign}"
}
r = requests.post(url,headers=self.header,json=data).json()
if r["code"] == 200001:
if id == 11:
print(f"✅做任务[{id}][{name}]成功,获得现金[{r['data']['reward']}]")
else:
print(f"✅做任务[{id}][{name}]成功,获得金币[{r['data']['reward']}]")
if id == 1:
time.sleep(random.randint(10,30))
elif id == 5:
time.sleep(random.randint(61,63))
elif id == 6:
time.sleep(random.randint(34,60))
else:
time.sleep(random.randint(10,20))
else:
print(f"❌️做任务[{id}][{name}]失败,错误信息:{r}")
time.sleep(random.randint(5,15))
def daily_task(self):
url = f"{self.url}/api/gold_tasks"
r = requests.get(url,headers=self.header).json()
do_id_list = [1,5,6,11]
if r["code"] == 200001:
print("🎉️获取任务列表成功!")
for dataa in r["data"]["tasks"]:
rjson = json.loads(json.dumps(dataa))
if rjson['id'] in do_id_list:
do_time = rjson['times'] - rjson['completedCount']
print(f"✅开始执行任务[{rjson['name']}],共执行[{do_time}]次")
for i in range(do_time):
self.gold_task(rjson['id'],rjson['name'])
else:
print(f"❌️跳过任务[{rjson['name']}]")
else:
print(f"❌️获取任务失败,错误信息:{r}")
def get_gold(self):
url = f"{self.url}/api/gold_pigs/info"
r = requests.get(url,headers=self.header).json()
if r["code"] == 200001:
print("🎉️获取金块信息成功!")
global pigcount
pigcount = r["data"]["goldPigCount"]
url = "https://api.xingdouduanju.com/api/gold_pigs/collect_all_bullion"
self.time = self._time()
self.nonce = self._nonce()
self.sign = self._md5(f"{self.time}&{self.nonce}&{self.key}&true")
data ={
"timestamp": f"{self.time}",
"nonce": f"{self.nonce}",
"hasWatchAd": True,
"sign": f"{self.sign}"
}
r = requests.post(url,headers=self.header,json=data).json()
if r["code"] == 200001:
print(f"✅一键领取金块成功")
time.sleep(random.randint(3,8))
else:
print(f"❌️一键领取金块失败,错误信息:{r}")
time.sleep(random.randint(3,8))
def userinfo(self):
if exchange:
while True:
url = f"{self.url}/api/gold_pigs/gold_exchange"
self.nonce = self._nonce()
self.time = self._time()
self.sign = self._md5(f"{self.time}&{self.nonce}&{self.key}")
data = json.dumps({
"timestamp": f"{self.time}",
"nonce": f"{self.nonce}",
"sign": f"{self.sign}"
})
r = requests.post(url,headers=self.header,data=data).json()
if r["code"] == 200001:
print(f"✅兑换猪仔成功 [{r['message']}]")
time.sleep(random.randint(5,10))
else:
print(f"❌️兑换猪仔失败,错误信息 [{r['message']}]")
break
else:
print("❌️跳过兑换猪仔")
url = f"{self.url}/api/user/profile"
r = requests.get(url,headers=self.header).json()
if r["code"] == 200001:
print("=========================================")
print("查询用户信息成功")
print(f"🎉️当前金币 [{r['data']['walletGold']['balance']}]")
print(f"🎉️当前金块 [{r['data']['walletBullion']['balance']}]")
print(f"🎉️当前猪仔 [{pigcount}]")
else:
print(f"❌️查询用户信息失败,错误信息:{r}")
def get_gold_tuandui(self):
url = f"{self.url}/api/user_bonus_bullions/info"
r = requests.get(url,headers=self.header).json()
if r["code"] == 200001:
print(f"🎉️获取团队金块信息成功 可领取[{r['data']['bullionTotal']}]")
if r['data']['bullionTotal'] == 0:
print("🎉️没有可领取的团队金块")
return
url = f"{self.url}/api/user_bonus_bullions/collect"
self.time = self._time()
self.nonce = self._nonce()
self.sign = self._md5(f"{self.time}&{self.nonce}&{self.key}")
data = {
"timestamp": f"{self.time}",
"nonce": f"{self.nonce}",
"sign": f"{self.sign}"
}
r = requests.post(url,headers=self.header,json=data).json()
if r["code"] == 200001:
print(f"✅领取团队金块成功 [{r['message']}]")
else:
print(f"❌️领取团队金块失败,错误信息:{r}")
else:
print(f"❌️获取团队金块信息失败,错误信息:{r}")
def steal_gold(self):
i = 1
while True:
url = f"{self.url}/api/user/friends?level={i}&curor=2&keyword="
r = requests.get(url,headers=self.header).json()
if r["code"] == 200001:
print(f"🎉️获取好友信息成功")
for dataa in r["data"]:
rjson = json.loads(json.dumps(dataa))
if rjson['canCollectBullion']:
url = f"{self.url}/api/user_friend_bullions/collect"
self.time = self._time()
self.nonce = self._nonce()
self.sign = self._md5(f"{self.time}&{rjson['id']}&{self.nonce}&{self.key}")
data = json.dumps({
"timestamp": f"{self.time}",
"nonce": f"{self.nonce}",
"friendId": f"{rjson['id']}",
"sign": f"{self.sign}"
})
r = requests.post(url,headers=self.header,data=data).json()
if r["code"] == 200001:
print(f"✅领取好友[{rjson['nickname']}]金块成 获得[{r['data']['amount']}]金块")
else:
print(f"❌️领取好友[{rjson['nickname']}]金块失败,错误信息:{r}")
time.sleep(random.randint(1,3))
else:
print(f"❌️好友[{rjson['nickname']}]没有可领取的金块")
time.sleep(1)
else:
print(f"❌️获取好友信息失败,错误信息:{r}")
break
i += 1
if i == 3:
break
def task(self):
print("🎉️开始执行[日常任务]")
self.daily_task()
print("===========================")
print("🎉️开始执行[领取金块]")
self.get_gold()
print("===========================")
self.get_gold_tuandui()
print("===========================")
self.steal_gold()
print("===========================")
print("🎉️开始执行[兑换猪仔&查询信息]")
self.userinfo()
if __name__ == '__main__':
version()
cookie = ''
if not cookie:
cookie = os.getenv("yuanshen_xddj")
if not cookie:
print("请设置环境变量:yuanshen_xddj")
exit()
cookies = cookie.split("@")
print(f"一共获取到{len(cookies)}个账号")
i = 1
for cookie in cookies:
print(f"\n--------开始第{i}个账号--------")
main = yuanshen(cookie)
main.task()
print(f"--------第{i}个账号执行完毕--------")
i += 1