制作镜像网站

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
flyinflash
帖子: 2376
注册时间: 2006-09-21 14:28

制作镜像网站

#1

帖子 flyinflash » 2008-08-21 21:21

我尝试了google “wget 镜像”出来的前二页结果不起作用。

目标是
http://www.w3school.com.cn

理想结果是可以本地浏览,有图像,有样式。

请问如果做?
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#2

帖子 BigSnake.NET » 2008-08-21 21:22

这个网站很巨型的说。。
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
flyinflash
帖子: 2376
注册时间: 2006-09-21 14:28

#3

帖子 flyinflash » 2008-08-23 17:37

容量根本不是要考虑的问题……


该死的猫,学EE,答问题从来不答到点子上来……
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#4

帖子 BigSnake.NET » 2008-08-23 18:40

我抓网页用 ScrapBook
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
xiaomao101
帖子: 474
注册时间: 2006-04-05 18:12
联系:

#5

帖子 xiaomao101 » 2008-08-23 20:05

貌似css或者图片文件的路径有问题,在前面都加了一个“/”,我刚才试着改回去就好了,不过要是全部手工改。。。
头像
xiaomao101
帖子: 474
注册时间: 2006-04-05 18:12
联系:

#6

帖子 xiaomao101 » 2008-08-23 20:26

刚才又试了一下,如果在apache里面,也就是自己架一个apache,然后把下载的整站放到里面就好使 了,但是如果在本地用firefox打开还是会出现找不到图片的问题。
问题的起因就是每个文件前面的“/”(看源代码)!!!
我估计这个就是作网站时候为了防止别人下载整站用的,可是还应该有解决办法的,但是不是用wget
写个脚本作批量替换就好了,把
="/
替换成
="./
就好了
头像
xiaomao101
帖子: 474
注册时间: 2006-04-05 18:12
联系:

#7

帖子 xiaomao101 » 2008-08-23 20:38

又发现了一个解决办法:
刚才忽然发现/其实就是linux下根目录的意思,也就是说可以把index.html同级的文件全部放到根目录下(貌似有点疯狂)
其实就是把html源代码里面的/c3.css这样的结构理解成了linux下的根目录下的c3.css的意思。
flyinflash
帖子: 2376
注册时间: 2006-09-21 14:28

#8

帖子 flyinflash » 2008-08-24 11:32

楼上的,请写个实用脚本吧
头像
HuntXu
帖子: 5776
注册时间: 2007-09-29 3:09

#9

帖子 HuntXu » 2008-08-24 12:15

xiaomao101 写了:又发现了一个解决办法:
刚才忽然发现/其实就是linux下根目录的意思,也就是说可以把index.html同级的文件全部放到根目录下(貌似有点疯狂)
其实就是把html源代码里面的/c3.css这样的结构理解成了linux下的根目录下的c3.css的意思。
本来目录就是这样分层的啊...
HUNT Unfortunately No Talent...
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#10

帖子 BigSnake.NET » 2008-08-24 13:31

xiaomao101 写了:刚才又试了一下,如果在apache里面,也就是自己架一个apache,然后把下载的整站放到里面就好使 了,但是如果在本地用firefox打开还是会出现找不到图片的问题。
问题的起因就是每个文件前面的“/”(看源代码)!!!
我估计这个就是作网站时候为了防止别人下载整站用的,可是还应该有解决办法的,但是不是用wget
写个脚本作批量替换就好了,把
="/
替换成
="./
就好了
这个不是防止别人下载整站的,因为此根非彼根
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#11

帖子 BigSnake.NET » 2008-08-24 13:38

代码: 全选

       --convert-links
           After the download is complete, convert the links in the document
           to make them suitable for local viewing.  This affects not only the
           visible hyperlinks, but any part of the document that links to
           external content, such as embedded images, links to style sheets,
           hyperlinks to non-HTML content, etc.

           Each link will be changed in one of the two ways:

           *   The links to files that have been downloaded by Wget will be
               changed to refer to the file they point to as a relative link.

               Example: if the downloaded file /foo/doc.html links to
               /bar/img.gif, also downloaded, then the link in doc.html will
               be modified to point to ../bar/img.gif.  This kind of transfor-
               mation works reliably for arbitrary combinations of directo-
               ries.

           *   The links to files that have not been downloaded by Wget will
               be changed to include host name and absolute path of the loca-
               tion they point to.

               Example: if the downloaded file /foo/doc.html links to
               /bar/img.gif (or to ../bar/img.gif), then the link in doc.html
               will be modified to point to http://hostname/bar/img.gif.

           Because of this, local browsing works reliably: if a linked file
           was downloaded, the link will refer to its local name; if it was
           not downloaded, the link will refer to its full Internet address
           rather than presenting a broken link.  The fact that the former
           links are converted to relative links ensures that you can move the
           downloaded hierarchy to another directory.

           Note that only at the end of the download can Wget know which links
           have been downloaded.  Because of that, the work done by -k will be
           performed at the end of all the downloads.
用 k 参数了么
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
flyinflash
帖子: 2376
注册时间: 2006-09-21 14:28

#12

帖子 flyinflash » 2008-08-24 20:06

用了k。

你在几分种内想到的可能,我都试过了。

google出来的结果,有一个是一个会一点python写了一个脚本,也是针对一个垃圾ASP网站制镜像的,但是那个脚本我运行出错,我不会python,暂时也没空学。
头像
xiaomao101
帖子: 474
注册时间: 2006-04-05 18:12
联系:

#13

帖子 xiaomao101 » 2008-08-24 21:16

flyinflash 写了:楼上的,请写个实用脚本吧
呵呵,我不会 shell 阿,要不 早就 写了。
头像
xiaomao101
帖子: 474
注册时间: 2006-04-05 18:12
联系:

#14

帖子 xiaomao101 » 2008-08-24 21:21

要不 lz自己 架一个轻量级的http把
头像
Stupid kid
帖子: 416
注册时间: 2006-10-18 12:57

#15

帖子 Stupid kid » 2008-08-25 0:45

可能的话还是备份http://www.w3schools.com/吧^_^
http://twitter.com/nothining
Mail: bjdfzster@gmail.com
南京的开源活动几乎是0,希望能有人组织下(也可以拉我入伙^_^)
最近在从零开始学习Linux程序设计,加油……
回复