Created
October 10, 2019 23:46
-
-
Save bryanheinz/db654407a3168fc764ca244cfcfc0c6e to your computer and use it in GitHub Desktop.
This file contains 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 characters
""" | |
This script is used to check the status of character creation on specific worlds in Final Fantasy XIV. | |
To get a push notification you'll need to use Pushover (https://pushover.net) and include your user | |
and application keys. | |
You'll also want to update the world_name variable with the world you'd like to watch. | |
This script scrapes https://na.finalfantasyxiv.com/lodestone/worldstatus/ which is where you can find | |
the world names. | |
""" | |
import json | |
import requests | |
from pprint import pprint | |
world_name = 'Excalibur' | |
push_user = '' | |
push_token = '' | |
def pushover(msg): | |
url = 'https://api.pushover.net/1/messages.json' | |
data = { | |
'token':push_token, | |
'user':push_user, | |
'message':msg | |
} | |
headers = { | |
'Content-type': 'application/x-www-form-urlencoded', | |
} | |
r = requests.post(url, data=data, headers=headers) | |
#pprint(r.json()) | |
url='https://na.finalfantasyxiv.com/lodestone/worldstatus/' | |
r = requests.get(url) | |
page = r.text | |
content = page.split('\n') | |
index = 0 | |
for line in content: | |
if world_name in line: | |
break | |
index += 1 | |
for line in content[index:]: | |
if 'data-tooltip' in line: | |
raw_status = line.strip() | |
break | |
for i in raw_status.split('"'): | |
if 'Creation' in i: | |
status = i | |
break | |
if 'Creation of New Characters Unavailable' not in status: | |
#print("account creation available.") | |
pushover("Account creation on world {0} is available. Go create your FF XIV account!".format(world_name)) | |
else: | |
print("sadness and hate.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment