7th-saga/scripts/scrape.sh

29 lines
594 B
Bash
Executable File

#!/usr/bin/env bash
readonly thisDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly rootDir="$(dirname "${thisDir}")"
main() {
local baseUrl=http://localhost:18000
local urls=("index.html" "spells.html" "items.html" "weapons.html" "armor.html" "accessories.html" "exp.html" "levels.html")
local scrapedDir="${rootDir}/scraped"
rm -rf "${scrapedDir}"
mkdir -p "${scrapedDir}"
cp -R "${rootDir}/web/static" "${scrapedDir}"
SECONDS=0
for url in "${urls[@]}"; do
wget -O "${scrapedDir}/${url}" "${baseUrl}/${url}" &
done
wait
echo "done in ${SECONDS}s"
}
main "$@"