代碼循環瀏覽頁面,但並未完全遍歷整個頁面,通常會在比賽的會議中停止在第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
問題是與您的連接性,嘗試使用更高的速度互聯網 –