LoginSignup
4
4

More than 5 years have passed since last update.

webサイトを再帰的にダウンロードして、ローカルでも閲覧できるようにする

Last updated at Posted at 2018-01-26

まあ端的に言えば以下です。

$ wget -rkp -linf -H example.com

wgetを使って再帰的にダウンロードしています。また、絶対リンクはすべて相対リンクに置き換えてくれます。
ただ、あまりにも多すぎると永遠に終わらないので、-lで階層を指定しましょう。
また、-Hを外すと、違うドメインの場合はダウンロードしないようになります。

ちなみに、シェル芸でクロールする裏技もあります。

$ curl -Ss http://www5a.biglobe.ne.jp/~todoroki/nct.htm|rg data|rg pdf|sed -e 's/.*[href|HREF]=\"//'|sed -e 's/pdf\".*$/pdf/'|while read name;do echo http://www5a.biglobe.ne.jp/~todoroki/$name;done|xargs wget
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4