与Beautifulsoup的空标签内容

时间:2016-11-18 21:35:14

标签: python html beautifulsoup

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

http://www.oddsportal.com/soccer/france/ligue-1/results/

为了提取位于此处的标记“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")

我在标签div id =“tournamentTable”中没有得到任何结果。我无法获取表中的数据:class =“table-main”。

如果您有解决方案,请告诉我。

谢谢!

1 个答案:

答案 0 :(得分:0)

http://fb.oddsportal.com/ajax-sport-country-tournament-archive/1/OO2KUIR8/X0/1/0/2/?_=1479516929965

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