Youtube parsing

This commit is contained in:
aewens 2018-11-15 18:04:35 -05:00
parent 110e580911
commit d2c623e8de
1 changed files with 4 additions and 1 deletions

5
bot.py
View File

@ -7,7 +7,10 @@ PUBLIC_COMMANDS = ["sotd","listsotd"]
SOTDS = datastore.DataStore("sotd.json")
def get_title(link):
return str(urlopen(link).read()).split("<title>", 1)[1].split("</title>", 1)[0];
title = str(urlopen(link).read()).split("<title>", 1)[1].split("</title>", 1)[0]
if "YouTube" in title:
return title.split(" - Youtube", 1)[0]
return title
class SOTDBot(teambot.Handler,teambot.CommandHandlerMixin):
def __init__(self,*args):