创建一个网页上的UNIX命令行静态副本/ shell脚本 [英] Creating a static copy of a web page on UNIX commandline / shell script

查看:192
本文介绍了创建一个网页上的UNIX命令行静态副本/ shell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个shell脚本来创建一个网页的静态副本(全媒体资源,如CSS,图像和JS在内)。此副本应该在任何浏览器中打开的下线。

I need to create a static copy of a web page (all media resources, like CSS, images and JS included) in a shell script. This copy should be openable offline in any browser.

有些浏览器也有类似的功能(另存为...网页,全部),它从一个网页创建一个文件夹,这个文件夹中改写外部资源为相对静态资源。

Some browsers have a similar functionality (Save As... Web Page, complete) which create a folder from a page and rewrite external resources as relative static resources in this folder.

什么是方法来实现和完成这项在Linux命令行给定的URL?

What's a way to accomplish and automatize this on Linux command line to a given URL?

推荐答案

您可以使用的wget 是这样的:

wget --recursive --convert-links --domains=example.org http://www.example.org

此命令将递归在www.example.org从网页下载任何页面访问由超不按example.org域之外的链接。

this command will recursively download any page reachable by hyperlinks from the page at www.example.org not following links outside the example.org domain.

检查的wget 用于控制递归更多的选择手册页。

Check wget manual page for more options for controlling recursion.

这篇关于创建一个网页上的UNIX命令行静态副本/ shell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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