找回密码
 用户注册

QQ登录

只需一步,快速开始

查看: 3187|回复: 0

Wget将网站下载到本地

[复制链接]
发表于 2012-3-5 11:05:10 | 显示全部楼层 |阅读模式

使用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/*****

完!

本文链接

您需要登录后才可以回帖 登录 | 用户注册

本版积分规则

Archiver|手机版|小黑屋|ACE Developer ( 京ICP备06055248号 )

GMT+8, 2024-5-4 14:29 , Processed in 0.017193 second(s), 6 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表