python - 爬虫在运行一段时间后开始不断获得504的StatusCode,是否是对方站点的反爬虫策略导致?有何回避策略?
巴扎黑
巴扎黑 2017-04-17 17:25:54
0
6
999

最近初学用Python写网页爬虫视图扒取一个站点上的特定数据。

最近碰到的一个现象是,当爬虫运行了一段时间后(根据Fiddler抓包的结果来看,大概是发送了将近3万个http请求后),爬虫的获取的http响应的StatusCode骤然都变成了 504, 之后就再也获取不到200的响应了。

想请教一下各位大神,这种现象是否是由于扒取对象的站点的反爬虫策略造成的?

如果是的话,有什么常用的回避策略么?

P.S.
还注意到一个现象,不知与上述现象是否有关,一并描述:
即当爬虫的响应变成504之后,发现我的浏览器的代理选项被自动勾上了,如下所示:

巴扎黑
巴扎黑

reply all(6)
Ty80

The proxy option is checked, which is caused by fiddler. In the past, I often used fiddler to capture packets. After a period of time, I could not access the network. Uncheck the proxy option and the problem was solved

左手右手慢动作

You can pay attention to an open source component I wrote, set up a proxy server pool to prevent the blocking of anti-crawler strategies, and automatically adjusted the request frequency, handled abnormal requests, and prioritized agents with fast responses. https://github.com/letcheng/ProxyPool

洪涛

1.Agent

2. Simulate a complete request

3. Reasonable intervals

4.adsl disconnection and redial

PHPzhong

Method:
Change the IP and use a proxy IP. There are many free and paid ones on the Internet
Free IP: http://www.uuip.net/
Paid IP: http://www.daili666.net/

迷茫

Try accessing through a proxy

Peter_Zhu

Why is the answer to this question like this? The 50x error lies in the website itself

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!