gol*_*cks 15
如果服务器阻止 wget,它很可能根据 http 标头的“User-agent:”字段执行此操作,因为这是它首先知道的唯一方法。它也可能会阻止您的 IP,在这种情况下使用不同的软件将无济于事,或者某些基于一组请求的速度来识别自动化的方案(因为真实的人不会在 3.2 秒内浏览 100 个页面) . 我没有听说有人这样做,但这是可能的。
我也没有听说过减慢 wget 速度的方法,但是有一种方法可以欺骗用户代理字段:
wget --user-agent=""
Run Code Online (Sandbox Code Playgroud)
将根据手册页完全删除“用户代理:”,因为它不是强制性的。如果服务器不喜欢那样,请尝试--user-agent="Mozilla/5.0"
哪个应该足够好。
当然,如果您能更好地解释为什么“认为服务器正在阻止它”,那将会有所帮助。wget 会说什么,还是只是超时?
我通常httrack
用于从站点下载/镜像 Web 内容。
$ httrack http://2011.example.com -K -w -O . -%v --robots=0 -c1 %e0
Run Code Online (Sandbox Code Playgroud)
运行后,您将获得一个本地且可浏览的目录结构。例如:
$ ls -l
total 304
-rw-r--r-- 1 saml saml 4243 Aug 17 10:20 backblue.gif
-rw-r--r-- 1 saml saml 828 Aug 17 10:20 fade.gif
drwx------ 3 saml saml 4096 Aug 17 10:20 hts-cache
-rw-rw-r-- 1 saml saml 233 Aug 17 10:20 hts-in_progress.lock
-rw-rw-r-- 1 saml saml 1517 Aug 17 10:20 hts-log.txt
-rw------- 1 saml saml 271920 Aug 17 10:22 hts-nohup.out
-rw-r--r-- 1 saml saml 5141 Aug 17 10:20 index.html
drwxr-xr-x 10 saml saml 4096 Aug 17 10:21 2011.example.com
Run Code Online (Sandbox Code Playgroud)
下载时,您将看到以下类型的输出:
Bytes saved: 21,89KiB Links scanned: 12/45 (+4)
Time: 2s Files written: 4
Transfer rate: 2,65KiB/s (2,65KiB/s) Files updated: 1
Active connections: 1 Errors: 7
Current job: parsing HTML file (57%)
request - 2011.example.com/cgi-bin/hostnames.pl 0B / 8,00KiB
Run Code Online (Sandbox Code Playgroud)
它可以被后台处理和/或中止,然后再恢复。就其功能而言,这只是冰山一角。还有一个 GUI 可用于设置下载并在下载过程中对其进行监控。
httrack
网站上和谷歌搜索有大量文档。
归档时间: |
|
查看次数: |
14425 次 |
最近记录: |