描述
我正在抓取网站:bjx.com,所有代码都可以在本地运行。然后我将代码放在亚马逊服务上并运行,它失败了。
我做了什么
我想也许网站阻止服务器,我尝试了一些方法:
1)curl http://guangfu.bjx.com.cn/xtgc/List.aspx?classid=583
2)wget http://guangfu.bjx.com.cn/xtgc/List.aspx?classid=583
错误消息如下:
Resolving news.bjx.com.cn (news.bjx.com.cn)... 114.113.145.103
Connecting to news.bjx.com.cn (news.bjx.com.cn)|114.113.145.103|:80... failed: Connection timed out.
Retrying.
--2019-04-23 05:45:00-- (try: 2) http://news.bjx.com.cn/list
Connecting to news.bjx.com.cn (news.bjx.com.cn)|114.113.145.103|:80...
一些参考:
https://serverfault.com/questions/124952/testing-a-website-from-linux-command-line
我的问题 :
如何确认网站是否阻止我,如果被阻止,我该怎么做才能解决问题并抓取网站,谢谢
如何通过特定的超时设置使程序失败?
例如,如果在10秒内无法获得响应,则使卷曲失败
卷曲 - 10
而且,为了解决这些问题,您可以尝试使用VPN网络代理运行蜘蛛