Created
May 28, 2023 12:17
-
-
Save oxodao/ae85d0ebdfe1ba09398f3aec1e8fcbbc to your computer and use it in GitHub Desktop.
Download curseforge modpacks without account nor the stupid launcher
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
import requests | |
import json | |
api = 'https://api.curse.tools/v1/cf' | |
s = requests.Session() | |
# Download the zip file from curseforge and get the manifest.json in it | |
with open('manifest.json', 'r') as f: | |
data = json.loads(f.read()) | |
for f in data['files']: | |
r = requests.get(f"{api}/mods/{f['projectID']}/files/{f['fileID']}/download-url") | |
r.raise_for_status() | |
url = r.json()['data'] | |
filename = url.split('/')[-1] | |
with requests.get(url, stream=True) as req: | |
req.raise_for_status() | |
with open(filename, 'wb') as f: | |
for chunk in req.iter_content(8192): | |
f.write(chunk) | |
print(f'Downloaded {filename}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment