Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scrape Ishgard Restoration for Progress Alerts
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment