2

Linux 如何使用 wget 下载整个网站 – Doggy的博客 – CSDN博客

 2 years ago
source link: https://leejarod.wordpress.com/2019/09/29/linux-%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-wget-%e4%b8%8b%e8%bd%bd%e6%95%b4%e4%b8%aa%e7%bd%91%e7%ab%99-doggy%e7%9a%84%e5%8d%9a%e5%ae%a2-csdn%e5%8d%9a%e5%ae%a2/
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.

Linux 如何使用 wget 下载整个网站 – Doggy的博客 – CSDN博客

Linux 如何使用 wget 下载整个网站近期要去缅甸呆半个月,想顺便把 W3SCHOOL.COM 上面的 HTML/CSS/JS/PHP 教程温习一遍。但是有一个问题,缅甸的网速很慢,我们住的酒店 wifi 不稳定,今年 1 月份和 6 月份我也在缅甸胶漂岛呆过,特别怀念我国的 4g 网络。所以,这次无论如何我要把 W3SCHOOL.COM 的内容离线下载下来。wget 是用于从网站下载资源的 linux 命令,基本用法是 wget url:wget http://www.w3schools.com/ 1一般来说,网站的页面会有很多链接,点击之后可以链接到其他页面,其他页面也可能有链接,就这样一级一级链接下去,如果要把这些所有关联的页面都下载下来,用法是:wget -r http://www.w3schools.com/ 1但是大部分网站不允许你下载所有网站的内容,如果网站检测不到浏览器标识,会拒绝你的下载连接或者给你发送回一个空白网页。这个时候在 wget 后面加上 user-agent 就可以:wget -r -p -U Mozilla http://www.w3schools.com/ 1为了避免被网站加入黑名单,我们可以限制下载的速度以及两次下载之间的等待时间:wget –wait=20 –limit-rate=20K -r -p -U Mozilla http://www.w3schools.com/ 1如何只是想下载特定文件夹下的网页,使用 –no-parent://只下载 `/js` 下的所有页面wget –wait=20 –limit-rate=20K –no-parent -r -p -U Mozilla http://www.w3schools.com/js/default.asp 1 2更多内容请参考 GNU Wget Manual

来源: Linux 如何使用 wget 下载整个网站 – Doggy的博客 – CSDN博客

举报此广告

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK