python - 浏览器代码和beautifulsoup集合不同
问题描述
我尝试解析soccerstand首页足球比赛但失败了,因为我通过BeautifulSoup获得的项目与我在浏览器中看到的项目完全不同。我的代码目前很简单:
import urllib.request
from bs4 import BeautifulSoup
with urllib.request.urlopen('https://soccerstand.com/') as response:
url_data = response.read()
soup = BeautifulSoup(url_data, 'html.parser')
print(soup.find_all('div.event__match'))
所以我尝试了这个,但失败了。当我检查汤变量时,结果发现根本不包含这样的 div,所以我从 BS 得到的结果与我通过检查网站上的代码所看到的不同。
这是什么原因?有什么解决方法吗?
解决方案
推荐阅读
- sqlite - 如何在 Pandas 数据框中读取多个 SQLite 表?
- r - 基于 cv.glmnet 中 type.measure 参数的不同结果
- javascript - 使用 axios 检索数据---得到 404 错误
- php - 如何在单击时获取复选框的值
- r - R - IMDb 数据集未加载
- r - 为什么 tidyverse 安装在 Ubuntu 上找不到包?
- php - 如何显示数据库中多行的表格
- r - 如何在多列上循环或应用具有 2 个条件的 ifelse 语句?
- doctrine - 如何从 DefaultController 中的教义数据库中获取所有数据,然后将该数据转发到 Symfony4 中的树枝模板
- c# - 如何在 C# MVC 中获取每个列表项验证错误