Created
September 8, 2020 13:52
-
-
Save Scrxtchy/800f299734cea9950d2e9203f14d4a11 to your computer and use it in GitHub Desktop.
Revisions
-
Scrxtchy created this gist
Sep 8, 2020 .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,38 @@ from bs4 import BeautifulSoup as bs4 import requests import pickle #checkpoints = {"Tonberry":[], "Cactuar":[]} ## run these at some point to init datastorage #pickle.dump(checkpoints, open("xiv.prog", "wb")) ## imaging spending time automating setup instead of gaming x = requests.get('https://eu.finalfantasyxiv.com/lodestone/ishgardian_restoration/builders_progress_report') soup = bs4(x.text, 'html.parser') worlds = ["Tonberry", "Cactuar"] checkpoints = pickle.load(open("xiv.prog", "rb")) def sendMessage(message): # Write your own notification processor return def getWorld(name): return soup.find_all("span", attrs={"class":"world_name"}, string=name)[0].parent def getPhase(node): return node.find("p").text def getProg(node): return float(node.find("div", attrs={"class":"bar"}).span["style"][:-1][7:]) for world in worlds: worldNode = getWorld(world) if getPhase(worldNode) not in checkpoints[world]: prog = getProg(worldNode) if prog > 90: checkpoints[world].append(phase) sendMessage("{} is at {}%".format(world, prog)) pickle.dump(checkpoints, open("xiv.prog", "wb")) from sys import exit exit(0)