【发布时间】:2019-08-14 17:54:06
【问题描述】:
我在这里有一些基础:
from bs4 import BeautifulSoup
from requests_html import HTMLSession
session = HTMLSession()
url = 'https://www.statsinsider.com.au/prediction-results?fbclid=IwAR18wxeCq_ygxLG1v2JEe3YqBNNS6krzNnOQULYp4IZihQY6JMgHwzpIl6o'
r = session.get(url)
soup=BeautifulSoup(r.html.html,'html.parser')
stat_table = soup.find('table')
这会输出以下内容,这似乎不是整个表格。感谢您的帮助,谢谢!
<table>
<tbody>
<tr>
<th>Date</th>
<th class="to-hide">Sport</th>
<th>Team</th>
<th class="to-hide">Bet Type</th>
<th>Odds</th>
<th class="to-hide">Bet</th>
<th>Result</th>
<th>Profit/Loss</th>
</tr>
<tr ng-repeat="match in recentResults">
<td>{{match.Date}}</td>
<td class="to-hide">{{match.Sport}}</td>
<td>{{match.Team}}</td>
<td class="to-hide">{{match.Type}}</td>
<td>${{match.Odds}}</td>
<td class="to-hide">${{match.Bet}}</td>
<td>{{match.Result}}</td>
<td class="green" ng-if="match.Return > 0">${{match.Return}}</td>
<td class="red" ng-if="match.Return < 0">${{match.Return}}</td>
<td ng-if="match.Return == 0"></td>
</tr>
</tbody>
</table>
【问题讨论】:
-
你能详细说明一下它看起来不像我习惯的普通简单表吗? 究竟你不能在这里做什么?
-
@KeyurPotdar 该表似乎没有类,并且有像
ng-repeat="match in recentResults"这样的奇怪属性
标签: python web-scraping beautifulsoup scrapy