#! /bin/bash

for LINE in $(cat ./urls)
do
    GAMENAME=$(wget -q -O ./foo $LINE && grep -ohP "GAME_K-GD.*(?=\.tar)" ./foo | head -1) && mkdir ./$GAMENAME && wget -O /dev/stdout $LINE/download | tar -xf - -C ./$GAMENAME
done
