利用wget下载文件和网页
source link: https://blog.51cto.com/u_12076261/5488107
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
利用wget下载文件和网页
原创wget命令可以下载网页或者远程文件。
--2018-05-17 21:28:27-- https://baidu.com/
正在解析主机 baidu.com (baidu.com)... 220.181.57.216, 123.125.115.110
正在连接 baidu.com (baidu.com)|220.181.57.216|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Moved Temporarily
位置:http://www.baidu.com/ [跟随至新的 URL]
--2018-05-17 21:28:27-- http://www.baidu.com/
正在解析主机 www.baidu.com (www.baidu.com)... 115.239.210.27, 115.239.211.112
正在连接 www.baidu.com (www.baidu.com)|115.239.210.27|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2381 (2.3K) [text/html]
正在保存至: “index.html”
100%[======================================>] 2,381 --.-K/s 用时 0s
2018-05-17 21:28:27 (326 MB/s) - 已保存 “index.html” [2381/2381])
你也可以从多个URL地址进行下载
利用选项-O可以指定输出的文件名。
利用选项-t我们可以指定重试的次数,一旦下载中断,wget还会继续尝试。
利用--limit-rate选项我们可以限制下载速度
利用-c我们可以进行断点续传
wget有一个极为有用的选项--mirror,顾名思义,这是用来镜像站点的。
当然,你不能真的完全镜像百度,所以你可以使用--quota或者-Q来限制下载配额。
如果你需要对镜像网站做更精确的控制:
-r是递归选项,-N允许对文件使用时间戳,-l指定遍历的页面级数。
如果你所要下载的网页或者文件需要认证,可以使用--user和--password来提供用户名和密码。
- 赞
- 收藏
- 评论
- 分享
- 举报
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK