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
trap "rm -f $tmp" HUP PIPE INT QUIT TERM EXIT
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
+ fn=$(strftime %Y%m%d-%H%M%S)-$(url-to-filename $url)
+ wget $wget_opts --output-file=warcs.log --warc-file=$dst/$fn $url
+ print $dst/$fn.warc
done < $new
}