Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Author: kek/bitwise/kyza
- # Utilises wildcards available webAPI to get the current player count on Xbox, Playstation and Mobile.
- # Also displays the amount of banned players per platform (not mobile)
- # Includes top servers per platform (population)
- # python -m pip install urllib3
- # python -m pip uninstall urllib3-secure-extra
- import urllib3, json, time
- from threading import Thread
- from datetime import datetime, date
- from enum import IntEnum
- total = []
- TOTAL = 0
- XBOX = 0
- PSN = 1
- MOBILE = 2
- OFFICIAL = 0
- SMALLS = 1
- NOTEK = 2
- CROSS = 3
- BEGINNER = 4
- SOTF = 5
- ARKPOC = 6
- HARDCORE = 7
- LDL = 8
- PRIMPLUS = 9
- PVE = 10
- UNOFFICIAL = 11
- count = 0
- now = {"day": datetime.now().day, "month": datetime.now().month, "year": datetime.now().year, "hr": datetime.now().hour, "min": datetime.now().minute, "sec": datetime.now().second, "ms": datetime.now().microsecond}
- platformID = [ "xbox", "sotfps4", "mobile" ]
- serverID = [ "official", "smalls", "notek", "cross", "beginner", "sotf", "arkpoc", "hardcore", "LDL", "primplus", "pve", "unofficial" ]
- dayNT = [ "st", "nd", "rd" ]
- class Day(IntEnum):
- Monday = 0
- Tuesday = 1
- Wednesday = 2
- Thursday = 3
- Friday = 4
- Saturday = 5
- Sunday = 6
- @classmethod
- def today(cls):
- return cls(date.today().weekday()).name
- class Month(IntEnum):
- January = 1
- Febuary = 2
- March = 3
- April = 4
- May = 5
- June = 6
- July = 7
- August = 8
- September = 9
- October = 10
- November = 11
- December = 12
- @classmethod
- def today(cls):
- return cls(datetime.now().month).name
- def GetPopulationForPlatform(pL, sID=OFFICIAL):
- population = {"Name":[],"Population":[], "CanHold":[], "Num":0}
- if pL >= XBOX and pL <= MOBILE: JSON = json.loads(urllib3.request("GET",
- f"""http://arkdedicated.com/{platformID[pL] if sID != UNOFFICIAL else platformID[pL].replace("sotfps4", "ps4")}/cache/{"official" if sID != UNOFFICIAL else "unofficial"}serverlist.json""").data.decode("utf-8"))
- else:
- print("Incorrect platform ID\n")
- return -1
- for i in range(len(JSON)-1): # loop through json (all servers)
- if pL < MOBILE:
- name = JSON[i]["Name"] # store server name in local var
- match sID:
- case 0: # OFFICIAL
- if "PVP" in name and "Small" not in name and "legacy" not in name.lower() and "NoTek" \
- not in name and "Cross" not in name and "Beginner" \
- not in name and "SOTF" not in name and "poc" not in \
- name and "Hardcore" not in name and "LDL" not in name and "PrimPlus" not in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 1: # SMALLS
- if "PVP" in name and "Small" in name and "LDL" not in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 2: # NOTEK
- if "PVP" in name and "NoTek" in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 3: # CROSS
- if "PVP" in name and "Cross" in name and "NoTek" not in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 4: # BEGINNER
- if "PVP" in name and "Beginner" in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 5: # SOTF
- if "SOTF" in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 6: # ARKPOC
- if "PVP" in name and "poc" in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 7: # HARDCORE
- if "PVP" in name and "Hardcore" in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 8: # LDL
- if "LDL" in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 9: # PRIMPLUS
- if "PVP" in name and "Prim" in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 10:
- if "PVE" in name:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case 11:
- population["Name"].append(name)
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- case _:
- print("Incorrect session ID\n")
- return -1
- else:
- population["Name"].append(JSON[i]["Name"])
- population["Population"].append(int(JSON[i]["NumPlayers"]))
- population["CanHold"].append(int(JSON[i]["MaxPlayers"]))
- population["Num"] += 1
- print(f'{platformID[pL].upper() if pL != PSN else "PSN"} {serverID[sID]}:\n')
- print(f'\tHighest pop: \n\n\t\t{population["Name"][population["Population"].index(max(population["Population"]))]} with population of {max(population["Population"])}/{population["CanHold"][population["Population"].index(max(population["Population"]))]} players\n\n')
- print(f'\tNumber of Empty Servers: {population["Population"].count(0)}\n')
- return list([sum(population["Population"]), population["Num"]])
- def displayPop(pL, sID=OFFICIAL):
- global TOTAL
- x = GetPopulationForPlatform(pL, sID)
- total.append(x[0])
- TOTAL = x[1]
- return x[0]
- def clearTotal():
- global total, TOTAL
- TOTAL = 0
- total = []
- return "players"
- def getNotation():
- nDay = int(str(now["day"]/10)[2])-1
- if (int(str(now["day"]/10)[0]) == 1 and int(str(now["day"]/10)[2]) < 4) or (nDay+1 > 3 and nDay+1 < 20): # 11th, 12th, 13th, 21st, 22nd, 23rd, 31st and NOT 11rd, 12nd, 13rd, 21th, 22th, 23th, 31th
- return "th"
- return dayNT[nDay]
- def main():
- global count, now
- while True:
- count = 0
- now = {"day": datetime.now().day, "month": datetime.now().month, "year": datetime.now().year, "hr": datetime.now().hour, "min": datetime.now().minute, "sec": datetime.now().second, "ms": datetime.now().microsecond}
- print(f"""
- Number online players as of {Day.today()} {now["day"]}{getNotation()} of {Month.today()} {now["year"]} at {now["hr"]-12 if now["hr"] > 12 else now["hr"]}:{now["min"] if now["min"] >= 10 else f"0{now['min']}"}{"PM" if (now["hr"] >= 12) else "AM"}:
- XBOX:
- OFFICIAL: {displayPop(XBOX, OFFICIAL)} (out of {TOTAL} servers)
- SMALLS: {displayPop(XBOX, SMALLS)} (out of {TOTAL} servers)
- NOTEK: {displayPop(XBOX, NOTEK)} (out of {TOTAL} servers)
- CROSS: {displayPop(XBOX, CROSS)} (out of {TOTAL} servers)
- BEGINNER: {displayPop(XBOX, BEGINNER)} (out of {TOTAL} servers)
- SOTF: {displayPop(XBOX, SOTF)} (out of {TOTAL} servers)
- ARKPOC: {displayPop(XBOX, ARKPOC)} (out of {TOTAL} servers)
- HARDCORE: {displayPop(XBOX, HARDCORE)} (out of {TOTAL} servers)
- LDL: {displayPop(XBOX, LDL)} (out of {TOTAL} servers)
- PRIMPLUS: {displayPop(XBOX, PRIMPLUS)} (out of {TOTAL} servers)
- PVE: {displayPop(XBOX, PVE)} (out of {TOTAL} servers)
- UNOFFICIAL: {displayPop(XBOX, UNOFFICIAL)} (out of {TOTAL} servers)
- TOTAL: {sum(total)} {clearTotal()}
- PSN:
- OFFICIAL: {displayPop(PSN)} (out of {TOTAL} servers)
- SMALLS: {displayPop(PSN, SMALLS)} (out of {TOTAL} servers)
- NOTEK: {displayPop(PSN, NOTEK)} (out of {TOTAL} servers)
- CROSS: {displayPop(PSN, CROSS)} (out of {TOTAL} servers)
- BEGINNER: {displayPop(PSN, BEGINNER)} (out of {TOTAL} servers)
- SOTF: {displayPop(PSN, SOTF)} (out of {TOTAL} servers)
- ARKPOC: {displayPop(PSN, ARKPOC)} (out of {TOTAL} servers)
- HARDCORE: {displayPop(PSN, HARDCORE)} (out of {TOTAL} servers)
- LDL: {displayPop(PSN, LDL)} (out of {TOTAL} servers)
- PRIMPLUS: {displayPop(PSN, PRIMPLUS)} (out of {TOTAL} servers)
- PVE: {displayPop(PSN, PVE)} (out of {TOTAL} servers)
- UNOFFICIAL: {displayPop(PSN, UNOFFICIAL)} (out of {TOTAL} servers)
- TOTAL: {sum(total)} {clearTotal()}
- MOBILE:
- OFFICIAL: {displayPop(MOBILE)} (out of {TOTAL} servers)\n\n""")
- xuidList = urllib3.request("GET", "http://arkdedicated.com/xboxbanlist.txt").data
- psnList = urllib3.request("GET", "http://arkdedicated.com/ps4banlist.txt").data
- pcList = urllib3.request("GET", "http://arkdedicated.com/banlist.txt").data
- sgList = urllib3.request("GET", "http://arkdedicated.com/conquestbanlist.txt").data
- xuidList = str(xuidList).replace("b'", "").replace("'","").split("\\r\\n")
- psnList = str(psnList).replace("b'", "").replace("'","").split("\\r\\n")
- pcList = str(pcList).replace("b'", "").replace("'","").split("\\r\\n")
- sgList = str(sgList).replace("b'", "").replace("'","").split("\\r\\n")
- banMessage = f"""
- Xbox Banned Players: {len(list(xuidList))}
- PSN Banned Players: {len(list(psnList))}
- PC Banned Players (Wildcard): {len(list(pcList))}
- PC Banned Players (Snail Games): {len(list(sgList))}
- Total Banned Players: {len(list(xuidList)) + len(list(psnList))+ len(list(pcList)) + len(list(sgList))}
- """
- print(f"""Number online players as of {Day.today()} {now["day"]}{getNotation()} of {Month.today()} {now["year"]} at {now["hr"]-12 if now["hr"] > 12 else now["hr"]}:{now["min"] if now["min"] >= 10 else f"0{now['min']}"}{"PM" if (now["hr"] >= 12) else "AM"}:\n\n{banMessage}""")
- print(f"Took {count} seconds to complete\n")
- input()
- Thread(target=main).start()
- while True:
- count = count + 1
- time.sleep(1)
Add Comment
Please, Sign In to add comment