我无法使用beautifulsoup
删除span类<div class="team-1-name">
"
India
"
<span class="innings-1-score innings-current">120/1 (40.0 ov)</span>
</div>
soup.prettify()甚至没有显示span类。
print(soup2.prettify())
输出:
<div class="team-2-name">
India
</div>
team1_soup=soup2.find(class_="team-1-name")
print(team1_soup.find("span"))
None
请帮助
答案 0 :(得分:0)
您尝试抓取的网站使用JavaScript(http://www.espncricinfo.com/navigation/cricinfo/ci/scorecard/js/min/templates.js?1453894715)添加标记<span class="innings-1-score innings-current">
。您还必须使用Selenium,PhantomJS或Splash等无头浏览器来查看它。
例如,请参阅:scraping dynamic updates of temperature sensor data from a website