第七关ajax动态加载数据的爬取

点击查看代码
import requests

url = 'https://www.spiderbuf.cn/playground/iplist'
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
}
resp = requests.get(url=url, headers=headers)
resp.encoding = 'utf-8'
print(resp.text)
resp_json = resp.json()
for i in resp_json:
    ip = i['ip']
    mac = i['mac']
    name = i['name']
    type = i['type']
    os = i['manufacturer']
    port = i['ports']
    online = i['status']
    print(ip, mac, name, type, os, port, online)


posted @ 2024-10-08 15:30  神仙不在  阅读(21)  评论(0)    收藏  举报