Wget将网站下载到本地


使用wget可以将在线的网站下载到本地。如下实例下载在线的电子书http://web2py.com/books/default/chapter/29到本地目录C:\D\web2pybooken。

 

1) wget下载网站

set LOCAL-DIR=C:\D\web2pybooken

set WEBSITE-URL=http://web2py.com/books/default/chapter/29
wget --mirror --page-requisites --convert-links --no-host-directories  --html-extension -P %LOCAL-DIR% %WEBSITE-URL%

 

wget帮助:

wget -h.

-m,  --mirror             shortcut for -N -r -l inf --no-remove-listing. 

-r,  --recursive          specify recursive download.
-l,  --level=NUMBER       maximum recursion depth (inf or 0 for infinite).
-N,  --timestamping            don't re-retrieve files unless newer than local. 

--no-remove-listing     don't remove `.listing' files. 

-p,  --page-requisites    get all images, etc. needed to display HTML page. 

-P,  --directory-prefix=PREFIX  save files to PREFIX/...

-k,  --convert-links      make links in downloaded HTML point to local files.

-E,  --html-extension        save HTML documents with `.html' extension.

-nH, --no-host-directories      don't create host directories. 

 

 

2)将下载的网站放到httpserver上

如下为在本地通过python2.7启动httpserver,当然你也可以使用其他的httpserver。 

cd %LOCAL-DIR%

python -m SimpleHTTPServer 8080

 

3) 在ie中打开本地的网站

http://your-local-machine-ip:8080/*****

 

完! 

posted @   iTech  阅读(2939)  评论(1编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
历史上的今天:
2011-02-18 多用途互联网邮件扩展MIME
点击右上角即可分享
微信分享提示