标签:info 图片 requests 一个 orm erer rom abc 技术
headers={ ‘Content-Type‘:‘application/x-www-form-urlencoded‘, ‘Origin‘: ‘https://live.bilibili.com‘, ‘Referer‘:‘https://live.bilibili.com/5225369?spm_id_from=333.334.b_62696c695f6c697665.5‘, ‘User-Agent‘: ‘Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36‘, }
data={ ‘roomid‘: ‘7734200‘, #房间号 ‘csrf_token‘: ‘fa56950667934cf5a3479ca94abc1f9a‘, ‘csrf‘: ‘fa56950667934cf5a3479ca94abc1f9a‘, ‘visit_id‘: ‘‘, }
import requests import time
#请求头 headers={ ‘Content-Type‘:‘application/x-www-form-urlencoded‘, ‘Origin‘: ‘https://live.bilibili.com‘, ‘Referer‘:‘https://live.bilibili.com/5225369?spm_id_from=333.334.b_62696c695f6c697665.5‘, ‘User-Agent‘: ‘Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36‘, }
#请求体 data={ ‘roomid‘: ‘7734200‘, ‘csrf_token‘: ‘fa56950667934cf5a3479ca94abc1f9a‘, ‘csrf‘: ‘fa56950667934cf5a3479ca94abc1f9a‘, ‘visit_id‘: ‘‘, } url=‘https://api.live.bilibili.com/ajax/msg‘
#实时请求数据 while True: time.sleep(2) response=requests.post(url=url,headers=headers,data=data) dic_data=response.json() # print(type(dic_data)) content=[item[‘text‘] for item in dic_data[‘data‘][‘room‘]] print(content)
标签:info 图片 requests 一个 orm erer rom abc 技术
原文地址:https://www.cnblogs.com/angle6-liu/p/10579983.html