我抓住cricbuzz网站查看分数和其他详细信息..它将每30秒显示一些详细信息...如果cricbuzz网站中的分数通过ajax更改,如何自动更新...是否有任何模块?
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
import time
while True:
html = urlopen("http://www.cricbuzz.com/live-cricket-scores/16478/aus-vs-nz-1st-odi-new-zealand-tour-of-australia-2016")
bsObj= BeautifulSoup(html,"html5lib")
#print(bsObj.prettify())
players=[]
detail=[]
scores =bsObj.find("span",{"class":"cb-font-20 text-bold"})
print(scores.get_text())
detail.append(scores.get_text())
status=bsObj.find("div",{"class":{"cb-text-inprogress","cb-text-lunch","cb-text-stump","cb-text-innings break","cb-text-tea"}})
print("Status: ")
print(status.get_text())
detail.append(status.get_text())
for link in bsObj.find('div', {"class":"cb-min-inf cb-col-100"}).find("div").next_siblings:
if link.a.get_text() not in players:
players.append(link.a.get_text())
players.append(link.find('div',{"class":"cb-col cb-col-10 ab text-right"}).string)
print("Players: ")
for i in players:
print(i)
detail.append(players)
print(detail)
print("-----------------------------------------------------------------------------------")
time.sleep(30)