下载网页和依赖关系,包括css图像 [英] download webpage and dependencies, including css images
问题描述
通常我需要下载一个网页,然后离线编辑。
我已经尝试了几个工具,他们缺少的主要功能是下载CSS文件中引用的图像。
Often I need to download a webpage and then edit it offline. I have tried a few tools and the main feature they lack is downloading images referenced in the CSS files.
是否有一个工具(适用于Linux)下载一切,使网页呈现相同的离线状态(不包括AJAX)?
Is there a tool (for Linux) that will download everything so that the webpage will render the same offline (excluding AJAX)?
推荐答案
wget --page-requisites http://example.com/your/page.html
此选项导致Wget下载所有正确显示给定html页面所需的文件。这包括内联图像,声音和引用样式表等内容。
This option causes Wget to download all the files that are necessary to properly display a given html page. This includes such things as inlined images, sounds, and referenced stylesheets.
编辑:meder是对的:stock wget不解析和下载css图像。但是,有一个补丁添加了这个功能:[ 1 , 2 ]
meder is right: stock wget does not parse and download css images. There is, however, a patch that adds this feature: [1, 2]
更新:上面提到的补丁已被合并到wget 1.12 ,2009年9月22日发布:
UPDATE: The patch mentioned above has been merged into wget 1.12, released 22-Sep-2009:
** Added support for CSS. This includes:
- Parsing links from CSS files, and from CSS content found in HTML
style tags and attributes.
- Supporting conversion of links found within CSS content, when
--convert-links is specified.
- Ensuring that CSS files end in the ".css" filename extension,
when --convert-links is specified.
这篇关于下载网页和依赖关系,包括css图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!