我希望从winmasters.com快速获得当天的投注率。
这就是我现在所拥有的:
from lxml import html
import requests
page = requests.get('http://winmasters.com/')
tree = html.fromstring(page.text)
team = tree.xpath('//div["class="display-table"]/text()')
odds = tree.xpath('//span[@class="ng-binding ng-scope"]/text()')
print 'Team: ', team
print 'odds: ', odds
THX
答案 0 :(得分:0)
该网址会将您带到首页,但不会给出任何值。
您需要确定要转到的页面,即http://www.winmasters.com/en/sports/#/category/2/
答案 1 :(得分:0)
我找到了正确的目的地,我对代码进行了一些更改,但我仍然无法收到赔率
import urllib
import requests
from bs4 import BeautifulSoup
htmltext = urllib.urlopen("https://io.winmasters.com/Feeds/api/event/277255?lang=el").$read()
data = htmltext
soup = BeautifulSoup(data)
for pre in soup.find_all('odds'):
print rate.text