Skip to content

Instantly share code, notes, and snippets.

@menjoo
Created January 4, 2019 19:26
Show Gist options
  • Save menjoo/4cd5de162ee294cbb63b4b5fe6770c46 to your computer and use it in GitHub Desktop.
Save menjoo/4cd5de162ee294cbb63b4b5fe6770c46 to your computer and use it in GitHub Desktop.
Bash script to download all SNES roms from emuparadise.me
#!/bin/bash
# emuparadise.me SNES roms start at id 32787 and ends with 36466, loop through the ids:
for i in {32787..36466}
do
# Define emuparadise rom ID to be downloaded
gameId=$i
# The url where to start
url="https://www.emuparadise.me/roms/get-download.php?gid=${gameId}&test=true"
# Needed cookie to please referal protection
cookie='_ga=GA1.2.312033907.1546609825; _gid=GA1.2.1610492985.1546609825; OX_plg=pm; __gads=ID=c721805b270b1676:T=1546609828:S=ALNI_MZFHHvKIhTO5Q04HAiU6bpSlfg-UQ; refexception=1'
# Get the url of the zip
location=$(curl -s -I -X GET $url -H "cookie: ${cookie}" -b "${cookie}" | grep -o -E 'location:.*$' | sed -e 's/location://')
# Extract the filename
filename="${location##*/}"
# Remove unwanted line endings
filename=${filename//[$'\t\r\n ']}
# Download zip as filename
curl -s -L -o $filename -X GET $url -H "cookie: ${cookie}" -b "${cookie}"
# Unzip it
unzip $filename
# Remove the zip
rm $filename
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment