Spectrus
05-17-2012, 10:12 AM
I was bored. Pulls online status of all chars in names list. I'll be using this to write the online status of my chars to a file so that I can have conky (Linux equivalent to Rainmeter) pull the information from the file and display it on my desktop. If anyone else finds a use for it, that's great!
import urllib.request
url = 'http://www.tibia.com/community/?subtopic=characters&name='
names = ['Raedys','Sairu']
for name in names :
response = urllib.request.urlopen(url+name)
text = response.read().decode("utf-8")
if name and "CLASS=green" in text : #"CLASS=green" is only used on online status
print(name +": online")
else :
print(name +": offline")
There are some pretty glaring bugs in it. For instance, I'm not sure how it will handle names with 2 words, also if they are online on a different character it will show as online, also if their character is hidden, it will show as offline. Doesn't matter for any of my chars so I won't fix it for now.
import urllib.request
url = 'http://www.tibia.com/community/?subtopic=characters&name='
names = ['Raedys','Sairu']
for name in names :
response = urllib.request.urlopen(url+name)
text = response.read().decode("utf-8")
if name and "CLASS=green" in text : #"CLASS=green" is only used on online status
print(name +": online")
else :
print(name +": offline")
There are some pretty glaring bugs in it. For instance, I'm not sure how it will handle names with 2 words, also if they are online on a different character it will show as online, also if their character is hidden, it will show as offline. Doesn't matter for any of my chars so I won't fix it for now.