diff --git a/bot.py b/bot.py index 669c64f..a70f57e 100644 --- a/bot.py +++ b/bot.py @@ -7,10 +7,14 @@ PUBLIC_COMMANDS = ["sotd","listsotd"] SOTDS = datastore.DataStore("sotd.json") def get_title(link): - title = str(urlopen(link).read()).split("", 1)[1].split("", 1)[0] - if "YouTube" in title: - return title.split(" - YouTube", 1)[0] - return title + try: + title = str(urlopen(link).read()).split("", 1)[1].split("", 1)[0] + if "YouTube" in title: + return title.split(" - YouTube", 1)[0] + return title + except: + print(e) + return link class SOTDBot(teambot.Handler,teambot.CommandHandlerMixin): def __init__(self,*args):