#!/bin/sh

set -eu

readonly name="${1}"; shift

mkdir -p "${name}" && cd "${name}"

readonly user_agent="Mozilla/5.0 ..."
wget \
    --page-requisites \
    --convert-links \
    --adjust-extension \
    --restrict-file-names=ascii \
    --span-hosts \
    --random-wait \
    --execute robots=off \
    --recursive \
    --timestamping \
    -l inf \
    --no-remove-listing \
    --no-parent \
    --user-agent "${user_agent}" \
    --reject '*.woff*,*.ttf,*.eot,*.js' \
    --tries 10 \
    "$@"