Created
October 25, 2021 19:53
-
-
Save phwelo/5efe5433e003456a673d090050dc7321 to your computer and use it in GitHub Desktop.
Revisions
-
phwelo created this gist
Oct 25, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #!/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)