-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathskyblockCustomSearch.py
More file actions
47 lines (36 loc) · 1.64 KB
/
skyblockCustomSearch.py
File metadata and controls
47 lines (36 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import requests
import json
import concurrent
from concurrent.futures import ThreadPoolExecutor
root = "https://api.hypixel.net/skyblock/auctions?page="
# grabs the JSON data from the Hypixel API and returns it as a python dictionary
def getPageData(currentPage):
pageContent = requests.get(f"{root}{str(currentPage)}").text
return json.loads(pageContent)
# checks if the auction is a good flip
def checkAuction(auctionToCheck):
hotPotatoBooked = "§e(+20)" in auctionToCheck["item_lore"] and "§e(+10)" not in auctionToCheck["item_lore"]
fumingPotatoBooked = "§e(+30)" in auctionToCheck["item_lore"]
recombobulated = "§k" in auctionToCheck["item_lore"]
if "Fishing Speed" in auctionToCheck["item_lore"] and "Attribute Shard" in auctionToCheck["item_name"]:
return True
else:
return False
# get the total number of pages from
firstPageData = getPageData("0")
totalPages = firstPageData["totalPages"]
print(totalPages)
# create list to contain all auction data
auctions = []
# iterates through every page and adds the auction data to the auction data list
with ThreadPoolExecutor(max_workers=totalPages) as executor:
future1 = {executor.submit(getPageData, page)
for page in range(0, totalPages)}
for future in concurrent.futures.as_completed(future1):
fullPageData = future.result()
auctions.extend(fullPageData["auctions"])
for auction in auctions:
binAuction = auction["bin"]
if checkAuction(auction):
print(f"item: {auction['item_name']} /viewauction {auction['uuid']} cost = {auction['starting_bid']}")
print("done")