如何以编程方式保存网页? [英] How do I save a web page, programmatically?

查看:148
本文介绍了如何以编程方式保存网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式保存网页.

I would like to save a web page programmatically.

我的意思不是只保存HTML.我还想自动存储所有关联的文件(图像,CSS文件,也许是嵌入式SWF等),并希望重写用于本地浏览的链接.

I don't mean merely save the HTML. I would also like automatically to store all associated files (images, CSS files, maybe embedded SWF, etc), and hopefully rewrite the links for local browsing.

预期用途是个人书签应用程序,其中链接内容被缓存,以防原始副本被删除.

The intended usage is a personal bookmarks application, in which link content is cached in case the original copy is taken down.

推荐答案

看看 wget ,特别是-p标志

−p  −−page−requisites
This option causes Wget to download all the files
that are necessary to properly display
a givenHTML  page. Thisincludes such
things as inlined images, sounds, and
referenced stylesheets.

以下命令:

wget -p http://<site>/1.html

将下载page.html及其所需的所有文件.

Will download page.html and all files it requires.

这篇关于如何以编程方式保存网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆