-
-
Save fjtawork/43aa59369f2c0fc74676fcc54ecf18d6 to your computer and use it in GitHub Desktop.
指定したURLから再帰的にURLを取ってくるスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: fetch_urls.sh "URL" | |
# Example: fetch_urls.sh "https://example.com/" | tee urls.txt | |
# https://example.com/ に再帰的にアクセスして、 urls.txt にURL一覧を書き出す | |
# Requirements: wget perl | |
# wget が入ってない場合、 brew install wget などでインストールして下さい。 | |
_url="$1" | |
( | |
wget -nd -nH --spider --recursive --level=inf --no-verbose --execute robots=off "$_url" 2>&1 | |
) | perl -ne '$| = 1; if (/URL: *([^ ]+) /) { print "$1\n"; }' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment