# -*- coding: utf-8 -*- import requests url='https://douyu.com/gapi/rknc/directory/yzRec/1' headers={ 'user-agent':'Mozilla/5.0 (Windows NT 6.1; ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4068.4 Safari/537.36', } #查看自己的header #.转数据json #.取数据,就是套女朋友衣服,从最外层向内,从{开始算 response=requests.get(url,headers=headers).json() data=response["data"]["rl"] #除数据--遍历 for i in data: #print(i) #print(i["av"]) rn=i['rn']#主播房间名 nn=i['nn']#主播名 print(nn)
python爬斗鱼主播信息(读json范例)
阅读:3431 输入:2020-03-15 08:24:15