Better version than previous
This commit is contained in:
parent
d30e059234
commit
110e580911
5
bot.py
5
bot.py
|
@ -1,5 +1,5 @@
|
|||
import teambot, time, datastore
|
||||
import lxml.html
|
||||
from urllib.request import urlopen
|
||||
|
||||
USAGE = dict(admin="Stop trying to use this command!",sotd="{}sotd <link> <name>",listsotd="{}listsotd")
|
||||
PUBLIC_COMMANDS = ["sotd","listsotd"]
|
||||
|
@ -7,8 +7,7 @@ PUBLIC_COMMANDS = ["sotd","listsotd"]
|
|||
SOTDS = datastore.DataStore("sotd.json")
|
||||
|
||||
def get_title(link):
|
||||
page = lxml.html.parse(link)
|
||||
return page.find(".//title").text
|
||||
return str(urlopen(link).read()).split("<title>", 1)[1].split("</title>", 1)[0];
|
||||
|
||||
class SOTDBot(teambot.Handler,teambot.CommandHandlerMixin):
|
||||
def __init__(self,*args):
|
||||
|
|
Reference in New Issue