import urllib,urllib2
import json,time
def POST(pyload,num):
url = r'https://api.bilibili.com/x/activity/bnj2020/hotpot/increase'
headers = {
'Content-Type': 'text/plain',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0',
'Accept':' */*',
'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
'Accept-Encoding': 'gzip, deflate, br',
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': 'https://www.bilibili.com',
'Connection': 'keep-alive',
'Referer':'https://www.bilibili.com/blackboard/xianxing2020bnj.html?bsource=2020bnjdd&anchor=game',
'Cookie':"这里填写你的Cookie",
}
data = urllib.urlencode(pyload)
request = urllib2.Request(url,data,headers=headers)
try:
response = urllib2.urlopen(request)
json_data = json.loads(response.read())
if(json_data['data']):
print " num = "+str(num)+"\n"
print json_data['data']['id']
print json_data['data']['name']
except urllib2.URLError,e:
print e.reason
payload = {
'count':1,
'csrf':'这里填写你的参数值'
}
num = 0
while True:
num+=1
POST(payload,num)
time.sleep(0)