我是Python和Scrapy的新手,我一直在刮walmart.com,取得了一些积极的结果。
它工作了一周,甚至25个小时前,但昨晚我开始收到这个回复,它并不是在刮伤中出现错误--这是通过txt文件刮回来的。
<!doctype html>
<html lang="en-US" itemscope itemtype="http://schema.org/WebPage">
<head>
<title>Omnivore Walmart</title>
</head>
<body id="WalmartBodyId" class="WalmartMainBody SimpleMode">
<!-- SiteCatalyst code version: H.23.3
Copyright 1996-2009 Adobe, Inc. All Rights Reserved
More info available at http://www.omniture.com
-->
<script language="JavaScript" type="text/javascript">
var s_account="walmartcom";
</script>
<script language="JavaScript" type="text/javascript" src=" https://secure.walmartimages.com/webanalytics/wmStat/wmStat.jsp"></script>
<script language="JavaScript" type="text/javascript">
var omni = {
"adid" : s_omni.getQueryParam('adid'),
"fbref" : s_omni.getQueryParam('fb_ref'),
"sourceid" : s_omni.getQueryParam('sourceid'),
"povid" : s_omni.getQueryParam('povid'),
"findingMethod" : s_omni.getQueryParam('findingMethod'),
getCampaignId : function() {
if(this.adid) { return this.adid; }
else if (this.fbref) { return this.fbref.split('_')[1]; }
else if (this.sourceid){ return this.sourceid; }
else { return ''; }
}
};
s_omni.pageName="Akamai Error 500:https://www.walmart.com/ip/Pringles-Loaded-Baked-Potato-Potato-Crisps-5-5-oz-Canister/144650857";
s_omni.channel="Walmart.com";
s_omni.campaign=omni.getCampaignId();
s_omni.prop1="Akamai Error";
s_omni.prop2="Akamai Error 500";
s_omni.prop48="Akamai 500:Generic Error - AKAMAI REFERENCE ERROR NO:3.1be3ab42.1510509312.48a15f11";
var s_code=s_omni.t();if(s_code) document.write(s_code);
</script>
<br>
<table>
<tr>
<td>Error Page</td>
</tr>
</table>
<br>
<table>
<tr>
<td>Could not connect to server</td>
</tr>
</table>
</body>
</html>
我已经研究过了,而且大多数人认为500意味着被封杀/被禁止是很罕见的,我是否有可能调整了一些东西或者可以调整一些东西来再次产生结果呢?
任何帮助都将是非常感谢的,我已经在WM.com上尝试了不同的产品,并得到了同样的,我可以通过浏览器达到它没有任何问题。
发布于 2017-11-12 18:44:20
您的刮刀可能已经被禁止在网站上,因为您要么被检测到刮擦,要么在其他方面恶意(例如,每分钟发送太多请求,而不是遵循robots.txt)。
因为你说它在几个小时前仍然有效,我想禁令是基于IP的。现在您可以执行以下操作:
https://www.walmart.com/ip/Pringles-Loaded-Baked-Potato-Potato-Crisps-5-5-oz-Canister/144650857
,但是使用相同的IP (如果它在服务器上,则可以使用curl
或wget
,或者创建从本地PC到服务器的SSH隧道) USER_AGENT
并查看它是否再次工作
接下来,你应该降低爬行率。我猜你爬得太猛了。在大多数情况下,只需降低爬行率就足够了。然而,对于沃尔玛,我也可以相信他们有更先进的方法,比如从URL访问模式中检测机器人等等(我的意思是,如果您只需要每分钟请求,沃尔玛甚至可以检测到您)。
规避禁止问题的一些想法:
DOWNLOAD_DELAY
或AUTOTHROTTLE_*
设置降低爬行速度
脚注
1是,每分钟。在正常的网络爬行中,对于大多数网站,我们尝试延迟几秒钟。有些人在有礼貌地爬行时使用公式factor * response-time-of-website
,因为这里的因素略有不同,但总是大于1。这意味着,根据这个公式,延迟时间通常也将是>1秒,我甚至听说过30左右的因素,这意味着延迟时间可能是15秒或更长。
https://stackoverflow.com/questions/47252234
复制相似问题