This repository has been archived by the owner on Jun 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 170
/
Copy pathstorm.py
51 lines (49 loc) · 1.96 KB
/
storm.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
import requests
import time
cookies = ''
token = ''
tokenlist = [token]
cookielist = [cookies]
def storm():
roomid = []
try:
for g in range(1, 11):
url = 'http://api.live.bilibili.com/room/v1/room/get_user_recommend?page=' + str(g)
response = requests.get(url,timeout=1)
for i in range(0, 30):
temp = response.json()['data'][i]['roomid']
roomid.append(temp)
except:
pass
try:
for i in roomid:
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36',
'cookie': cookies,
}
try:
url = 'http://api.live.bilibili.com/lottery/v1/Storm/check?roomid=' + str(i)
response = requests.get(url, headers=headers)
temp = response.json()
print(temp)
except:
pass
check = len(temp['data'])
if check != 0 and temp['data']['hasJoin'] != 1:
id = temp['data']['id']
roomid = temp['data']['roomid']
for c in range(len(cookielist)):
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36',
'cookie': cookielist[c],
'referer': 'http://live.bilibili.com/' + str(roomid)
}
storm_url = 'http://api.live.bilibili.com/lottery/v1/Storm/join'
payload = {"id": id, "color": "16772431", "captcha_token": "", "captcha_phrase": "", "token": "",
"csrf_token":tokenlist[c]}
response1 = requests.post(storm_url, data=payload, headers=headers,timeout=2)
print(response1.json())
except:
pass
while 1:
storm()