Skip to content

Instantly share code, notes, and snippets.

@FluxLemur
Last active September 13, 2015 20:32
Show Gist options
  • Save FluxLemur/3a82eb09cfc2b8ad441e to your computer and use it in GitHub Desktop.
Save FluxLemur/3a82eb09cfc2b8ad441e to your computer and use it in GitHub Desktop.
Python Script to Download Final Fantasy XII Soundtrack
from os import mkdir
from requests import get
# example: http://www.ffextreme.com/media/ff12/music/mp3/cd1/01.mp3
base_url = 'http://www.ffextreme.com/media/ff12/music/mp3/'
print 'from {} ...'.format(base_url)
disks = {'cd1':30, 'cd2':25, 'cd3':24, 'cd4':21} # tracks per disk
for disk in sorted(disks.keys()):
mkdir(disk)
for i in range(1, disks[disk]+1):
s = '{}/{}.mp3'.format(disk, str(i).zfill(2))
url = base_url + s
loc = s
with open(loc, 'wb') as sound_file:
print 'downloading',s
resp = get(url)
if not resp.ok:
'error downloading', url
sound_file.write(resp.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment