Added the neat Horoscope plugin by @infinitylabs from infinitylabs/UguuBot

This commit is contained in:
Luke Rogers 2013-08-02 00:16:16 +12:00
parent 52a1e58db1
commit 272ba283e9

21
plugins/horoscope.py Normal file
View file

@ -0,0 +1,21 @@
# Plugin by Infinity - <https://github.com/infinitylabs/UguuBot>
from util import hook, http
@hook.command
def horoscope(inp):
"horoscope <sign> -- Get your horoscope."
url = "http://my.horoscope.com/astrology/free-daily-horoscope-%s.html" % inp
soup = http.get_soup(url)
title = soup.find_all('h1', {'class': 'h1b'})[1]
horoscope = soup.find('div', {'class': 'fontdef1'})
result = "\x02%s\x02 %s" % (title, horoscope)
result = http.strip_html(result)
#result = unicode(result, "utf8").replace('flight ','')
if not title:
return "Could not get the horoscope for %s." % inp
return result