Skip to content

Instantly share code, notes, and snippets.

@Scrxtchy
Created September 8, 2020 13:52
Show Gist options
  • Select an option

  • Save Scrxtchy/800f299734cea9950d2e9203f14d4a11 to your computer and use it in GitHub Desktop.

Select an option

Save Scrxtchy/800f299734cea9950d2e9203f14d4a11 to your computer and use it in GitHub Desktop.

Revisions

  1. Scrxtchy created this gist Sep 8, 2020.
    38 changes: 38 additions & 0 deletions firmamentProg.py
    Original 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)