代码循环浏览页面,但并未完全遍历整个页面,通常会在比赛的会议中停止在第6或第7场比赛。任何人都可以提出BS为什么会在这里失败。是url http://www.gbgb.org.uk/resultsMeeting.aspx?id=135549无法抓取整个页面
from urllib import urlopen
from bs4 import BeautifulSoup
baseURL = 'http://www.gbgb.org.uk/resultsMeeting.aspx?id=135549'
html = urlopen(baseURL)
bsObj = BeautifulSoup(html, 'lxml')
nameList = bsObj.findAll("div", {"class": "resultsBlockHeader"})
for i in nameList:
nameList1 = i.findAll("div", {"class": "track"})
for j in nameList1:
print(j.get_text())
nameList1 = i.findAll("div", {"class": "date"})
for j in nameList1:
print(j.get_text())
nameList1 = i.findAll("div", {"class": "datetime"})
for j in nameList1:
print(j.get_text())
nameList1 = i.findAll("div", {"class": "grade"})
for j in nameList1:
print(j.get_text())
nameList1 = i.findAll("div", {"class": "distance"})
for j in nameList1:
print(j.get_text())
nameList1 = i.findAll("div", {"class": "prizes"})
for j in nameList1:
print(j.get_text())
nameList = bsObj.findAll("div", {"class": "resultsBlock"})
for i in nameList:
nameList2 = i.findAll("li", {"class": "trap"})
for j in nameList2:
print(j.get_text())
nameList2 = i.findAll("li", {"class": "first essential fin"})
for j in nameList2:
print(j.get_text())
nameList2 = i.findAll("li", {"class": "essential greyhound"})
for j in nameList2:
print(j.get_text())
nameList2 = i.findAll("li", {"class": "sp"})
for j in nameList2:
print(j.get_text())
nameList2 = i.findAll("li", {"class": "timeSec"})
for j in nameList2:
print(j.get_text())
nameList2 = i.findAll("li", {"class": "timeDistance"})
for j in nameList2:
print(j.get_text())
蟒蛇网络刮BS4
问题是与您的连接性,尝试使用更高的速度互联网 –