]> Sergey Matveev's repositories - feeder.git/blobdiff - cmd/download-warcs.zsh
encs/warcs destination is optional
[feeder.git] / cmd / download-warcs.zsh
index ac9e589779d1028214230893ef75fed7477e6e61..0198ca25c744d6aacd9e2f8bf272064430590b34 100755 (executable)
@@ -3,6 +3,8 @@ set -e
 fpath=($0:h:a/functions.zsh $fpath)
 dst=$2:a
 cd $1
+[[ -n "$dst" ]] || { dst=warcs ; dst=$dst:a }
+mkdir -p $dst
 autoload url-to-filename
 zmodload -F zsh/datetime b:strftime
 setopt EXTENDED_GLOB
@@ -27,7 +29,7 @@ for new (new/*(N)) {
             wget_opts=(--output-document=$tmp $wget_opts)
         }
         fn=$(url-to-filename $url)-$(strftime %Y%m%d-%H%M%S)
-        wget $wget_opts --output-file=warc.log --warc-file=$dst/$fn $url
-        print $fn
+        wget $wget_opts --output-file=warcs.log --warc-file=$dst/$fn $url
+        print $dst/$fn.warc
     done < $new
 }