Python 带有Beautifulsoup的空标记内容

Python 带有Beautifulsoup的空标记内容,python,html,beautifulsoup,Python,Html,Beautifulsoup,我正在尝试解析以下HTML网页: 为了提取位于此处的标记“div id=tournamentTable”内的数据: body > div class="wrap" > div id="mother-main" > div id="mother > div id="wrap" > div id="box-top" > div id="box-bottom" > div id="main" > div id="col-left" > div i

我正在尝试解析以下HTML网页:

为了提取位于此处的标记“div id=tournamentTable”内的数据:

body > div class="wrap" > div id="mother-main" > div id="mother > div id="wrap" > div id="box-top" > div id="box-bottom" > div id="main" > div id="col-left" > div id="col-content" > div id="tournamentTable"
但是,当我运行以下代码时:

f=urllib.request.urlopen("http://www.oddsportal.com/soccer/france/ligue-1/results/") 
html = f.read()
soup = BeautifulSoup.BeautifulSoup(html, "html.parser")
soup.find_all("div",id="tournamentTable")
我在tag div id=“tournamentTable”中什么也没有得到。我无法获取表中的数据:class=“Table main”

如果你有解决办法,请告诉我

谢谢

您可以在这个链接中找到您的数据,它使用javascript获取日期,您应该试试selenium


您可以在这个链接中找到您的数据,它使用javascript获取日期,您应该试试selenium

浏览器使用JavaScript动态加载数据,而不是直接在初始源HTML中加载。使用selenium。扩展Alex所说的内容,如果您转到该页面并点击Ctrl-U查看源代码,您将看到html本身的div中没有任何内容。数据由浏览器使用JavaScript动态加载,而不是直接加载到初始源html中。使用selenium。扩展Alex所说的内容,如果您转到该页面并点击Ctrl-U查看源代码,您将看到html本身的div中没有任何内容。