-
-
Save jasalt/b94980f18006d9ce131411df0b97ce06 to your computer and use it in GitHub Desktop.
Simple Break Beat Paradise downloader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Download all zip files from a single bbp page eg: | |
# ./djbb.py http://www.breakbeat-paradise.com/samplesite/bb_synth.php | |
import requests | |
import re | |
import shutil | |
import sys | |
def download(id): | |
try: | |
r = requests.get("http://www.breakbeat-paradise.com/bb_download.php?sampleid={}".format(id)) | |
html = r.text | |
url = re.search('http://.+\.zip', html).group(0) | |
except Exception: | |
print("fail") | |
return | |
filename = url.split('/')[-1] | |
response = requests.get(url, stream=True) | |
with open(filename, 'wb') as out_file: | |
shutil.copyfileobj(response.raw, out_file) | |
del response | |
def getIds(url): | |
r = requests.get(url) | |
html = r.text | |
ids = re.findall("(?<=sampleid=)\d+", html) | |
return ids | |
def main(page): | |
for id in getIds(page): | |
print("Downloading pack #{}".format(id)) | |
download(id) | |
if __name__ == '__main__': | |
main(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment