以下の内容はhttps://takuya-1st.hatenablog.jp/entry/2015/10/22/225350より取得しました。


curl でURLを一気に処理して、存在しないURLを探す。

特定のURLがいっぱいあるときに、まとめて、チェックしたい

ruby でurl つくって、open-uri/mechanizeなどで処理するのすら煩わしい。昔書いたブロク記事から使えそうな物をピックアップ

bashで連番作る

for n in {1..100}; do printf "http://example.com/%03d.jpg\n" $n ;done;

特定のHTTPヘッダを出力

curl -I -s -o /dev/null http://example.com/100.jpg -w "%{http_code}"

合わせて戦う。

たとえば、404 を無視し、200 だけをダウンロード

for n in {1..620};
do
  URL=$(printf "http://example.com/%03d.jpg" $n );
  # printf "$URL : "
  ret=$( curl -I -s -o /dev/null $URL -w "%{http_code}" )
  if [ $ret = 200  ] ; then
    curl -O   $URL;
  fi
done;

一括ダウンロードは、まぁマナー違反かもしれないけどね。

404 ページを調べるのは役に立と思うわ.curl 便利。

関連資料

takuya-1st.hatenablog.jp

takuya-1st.hatenablog.jp

takuya-1st.hatenablog.jp




以上の内容はhttps://takuya-1st.hatenablog.jp/entry/2015/10/22/225350より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14