forked from smallfawn/decode_action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
output.py
65 lines (65 loc) · 2.57 KB
/
output.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
#2024-06-29 12:30:57
import requests
import os
import time
import random
import hashlib
class yuanshen():
def __init__(self,cookie):
self.cookie=cookie
self.h={"Host":"app.zhuanbang.net","accept":"application/json, image/webp","user-agent":"Mozilla/5.0 (Linux; Android 12; M2104K10AC Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/96.0.4664.104 Mobile Safari/537.36 HuoNiuFusion/1.25.0_231652","x-requested-with":"XMLHttpRequest","sec-fetch-site":"same-origin","sec-fetch-mode":"cors","sec-fetch-dest":"empty","referer":"https://app.zhuanbang.net/assist/activity/47","accept-language":"zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7","accept-encoding":"gzip","Cookie":f"NiuToken={self.cookie}"}
def sign_(self):
d=f"{self.csrftoken}#{self.sessionId}#{self.time}"
byte_string=d.encode('utf-8')
sha1=hashlib.sha1()
sha1.update(byte_string)
sign=sha1.hexdigest()
return sign
def video(self,key):
i=0
while True:
i+=1
url=f"https://app.zhuanbang.net/{key}/launch?_random={int(time.time() * 1000)}&type=slide"
r=requests.get(url,headers=self.h).json()
if r['code']==0:
print(f"第[{i}]个红包获取信息成功")
self.csrftoken=r['data']['extArgs']['csrfToken']
self.sessionId=r['data']['extArgs']['sessionId']
self.time=int(time.time())
url=f"https://app.zhuanbang.net/{key}/award/grant?_t={self.time}"
data={"csrfToken":f"{self.csrftoken}","deviceId":f"{self.sessionId}","timestamp":f"{self.time}","sign":f"{self.sign_()}"}
r=requests.post(url,headers=self.h,data=data).json()
if r['code']==0:
print(f"第[{i}]个红包领取成功,获得[{r['data']['awardMoney']}]元")
else:
print(f"第[{i}]个红包领取失败---[{r['msg']}]")
break
else:
print(f"第[{i}]个获取红包信息失败---[{r['msg']}]")
break
if i>=21:
break
time.sleep(random.randint(20,48))
def main(self):
print("===========开始执行快手刷视频===========")
self.video("kwai_video")
print("===========快手刷视频执行完毕===========")
print("===========开始执行抖音刷视频===========")
self.video("pangle_video")
print("===========抖音刷视频执行完毕===========")
if __name__=='__main__':
cookie=''
if not cookie:
cookie=os.getenv("yuanshen_zb")
if not cookie:
print("⛔️请设置环境变量:yuanshen_zb")
exit()
cookies=cookie.split("@")
print(f"一共获取到{len(cookies)}个账号")
i=1
for cookie in cookies:
print(f"\n--------开始第{i}个账号--------")
main=yuanshen(cookie)
main.main()
print(f"--------第{i}个账号执行完毕--------")
i+=1