在抓取网站时无法找到我需要的数据来源

时间:2017-09-18 07:38:44

标签: python web-crawler

我正在用python编写一个web爬虫。当我试图找出我需要的数据来源时,我遇到了一个问题。

我抓取的网站是:https://www.whoscored.com/Regions/252/Tournaments/2/England-Premier-League,我想要的数据如下:

enter image description here

我可以在页面被firefox加载后浏览页面源找到这些数据:

DataStore.prime('standings', {  stageId:15151, idx:0, field: 'overall'},     [[15151,32,'Manchester United',1,5,4,1,0,16,2,14,13,1,3,3,0,0,10,0,10,9,7,2,1,1,0,6,2,4,4,[[0,1190179,4,0,2,252,'England',2,'Premier League','2017/2018',32,29,'Manchester United','West Ham','Manchester United','West Ham',4,0,'w'] ......

我认为应该通过ajax请求这些数据,但是我没有通过使用Web控制台检测到这样的请求。

然后,我模拟了需要html页面的浏览器行为(设置标题和cookie):

<html>
<head>
<META NAME="robots" CONTENT="noindex,nofollow">
<script src="/_Incapsula_Resource?SWJIYLWA=2977d8d74f63d7f8fedbea018b7a1d05">
</script>
<script>
(function() { 
var z="";var     b="7472797B766172207868723B76617220743D6E6577204461746528292E67657454696D6528293B7661722073746174757......";for (var i=0;i<b.length;i+=2){z=z+parseInt(b.substring(i, i+2), 16)+",";}z =   z.substring(0,z.length-1); eval(eval('String.fromCharCode('+z+')'));})();
</script></head>
<body>
<iframe style="display:none;visibility:hidden;" src="//content.incapsula.com/jsTest.html" id="gaIframe"></iframe>
</body></html>

我用上面的内容创建了一个.html文件,并用firefox打开它,但似乎脚本没有执行。现在,我不知道该怎么做,我需要一些帮助,谢谢!

0 个答案:

没有答案