我已经试过把所有的球员数据从
https://www.easports.com/madden-nfl/player-ratings?i=1&s=ovr_rating:DESC&v=true&=undefined
用靓汤: 博客.py你知道吗
import requests
from bs4 import BeautifulSoup
from csv import writer
response = requests.get('https://www.easports.com/madden-nfl/player-ratings/?i=1&s=ovr_rating:DESC&v=true&=undefined')
soup = BeautifulSoup(response.text, 'html.parser')
posts = soup.find_all(class_='player_rating-value')
print(posts)
但它给了我一个空列表,或者如果我尝试使用
posts = soup.find_all(class_='ratings-hub_database')
print(posts)
它只会给我力量之前的数据
我读过其他的解决方案,上面说我需要从“网络”选项卡获取XHR数据,但我不知道如何获取
打开“网络”选项卡,然后按F5刷新页面。然后按Ctrl+F打开搜索框,输入玩家姓名,然后按enter。查看返回的结果,您将发现以下以json的形式返回统计信息
您可以写入csv(请注意,您需要添加自己的头排序)
使用csv
相关问题 更多 >
编程相关推荐