Created
October 25, 2021 19:53
-
-
Save phwelo/5efe5433e003456a673d090050dc7321 to your computer and use it in GitHub Desktop.
Random Curseforge Modpack Chooser, Static Minecraft Version 17.1, static pages count of 10
This file contains 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 | |
import requests | |
import json | |
import random | |
import webbrowser | |
import sys | |
# This is a query for 1.17.1 modpacks | |
base_searchpage = "https://www.modpackindex.com/api/v1/minecraft/version/71/modpacks?limit=100&page=" | |
def get_page(page_num, url): | |
full_url = url + str(page_num) | |
result = requests.get(full_url).text | |
return json.loads(result)["data"] | |
mods_list = [] | |
# Grab the first 10 pages :shrug: | |
for num in range(1, 11): | |
result = get_page(num, base_searchpage) | |
mods_list = mods_list + result | |
choice = random.choice(mods_list) | |
webbrowser.open(choice["url"], new=0, autoraise=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment