#!/bin/bash

set -eu

mkdir -p KGS
cd KGS

wget -O - http://www.u-go.net/gamerecords/ | \
    egrep 'href="https://dl.u-go.net/gamerecords/.*\.tar\.bz2' | \
    sed 's/^.*"\([^"]*\)".*$/\1/' | \
    while read \url
    do
        wget "$url"
    done