wget が失敗しました: 接続がタイムアウトしました

wget が失敗しました: 接続がタイムアウトしました

ウェブサイトをコピーするには次のコマンドを使用します。

sun.com にアクセスしようとしたときに接続がタイムアウトになりました。

wget が次の処理に進むように、sun.com を除外したいと思います。

既存の問題

$ wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows http://pt.jikos.cz/garfield/
.
.
2021-08-09 03:28:28 (19.1 MB/s) - ‘packages.debian.org/robots.txt’ saved [24/24]

2021-08-09 03:28:30 (19.1 MB/s) - ‘packages.debian.org/robots.txt’ saved [24/24]
.


Location: https : //packages. debian. org /robots.txt [following]
--2021-08-09 03:28:33--  https : //packages. debian. org /robots.txt
Connecting to packages.debian.org (packages.debian.org)|128.0.10.50|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24 [text/plain]
Saving to: ‘packages.debian.org/robots.txt’

packages.debian.org 100%[===================>]      24  --.-KB/s    in 0s

2021-08-09 03:28:34 (19.1 MB/s) - ‘packages.debian.org/robots.txt’ saved [24/24]

Loading robots.txt; please ignore errors.
--2021-08-09 03:28:34--  http ://wwws. sun. com/ robots.txt
Resolving wwws.sun.com (wwws.sun.com)... 137.254.16.75
Connecting to wwws.sun.com (wwws.sun.com)|137.254.16.75|:80... failed: Connection timed out.
Retrying.

--2021-08-09 03:28:56--  (try: 2)  http ://wwws. sun. com/ robots.txt
Connecting to wwws.sun.com (wwws.sun.com)|137.254.16.75|:80... failed: Connection timed out.
Retrying.

--2021-08-09 03:29:19--  (try: 3)  http ://wwws. sun. com/ robots.txt
Connecting to wwws.sun.com (wwws.sun.com)|137.254.16.75|:80... failed: Connection timed out.
Retrying.

--2021-08-09 03:29:43--  (try: 4)  http ://wwws. sun. com/ robots.txt
Connecting to wwws.sun.com (wwws.sun.com)|137.254.16.75|:80... failed: Connection timed out.
Retrying.

--2021-08-09 03:30:08--  (try: 5)  http ://wwws. sun. com/ robots.txt
Connecting to wwws.sun.com (wwws.sun.com)|137.254.16.75|:80... failed: Connection timed out.
Retrying.

--2021-08-09 03:30:34--  (try: 6)  http ://wwws. sun. com/ robots.txt
Connecting to wwws.sun.com (wwws.sun.com)|137.254.16.75|:80... failed: Connection timed out.
Retrying.

--2021-08-09 03:31:01--  (try: 7)  http ://wwws. sun. com/ robots.txt
Connecting to wwws.sun.com (wwws.sun.com)|137.254.16.75|:80... failed: Connection timed out.
Retrying.

$wget はタイムアウトなしで Web サイト全体を保存することが期待されますが、タイムアウトが発生した場合、wget はタイムアウトした接続をスキップします。

答え1

--span-hosts ( ) オプションを使用する際の「リスク」-Hと、制限を追加してリスクを制限する方法については、詳細なマニュアルをお読みください。
https://www.gnu.org/software/wget/manual/wget.html#ホストのスパニング

またはオプション--span-hosts-H ホスト スパニングをオンにし、Wget の再帰実行でリンクによって参照される任意のホストにアクセスできるようにします。十分な再帰制限基準が適用されない限り、これらの外部ホストは通常​​、さらに多くのホストにリンクし、Wget が意図したよりもはるかに多くのデータを吸い上げてしまうまで。

...

特定のドメインへのスパンを制限する-D
この-Dオプションを使用すると、追跡するドメインを指定し、これらのドメインに属するホストのみに再帰を制限できます。

...

特定のドメインからダウンロードを禁止する--exclude-domains
特に除外したいドメインがある場合は、 を使用できます。--exclude-domainsは と同じタイプの引数を受け入れます-Dが、リストされているすべてのドメインを除外します。

関連情報