Fixed word of the day plugin
This commit is contained in:
parent
5797979014
commit
664b67c5c0
1 changed files with 6 additions and 7 deletions
|
@ -1,19 +1,18 @@
|
||||||
import re
|
import re
|
||||||
from util import hook, http
|
from util import hook, http, misc
|
||||||
from BeautifulSoup import BeautifulSoup
|
from BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def wordu(inp, say=False, nick=False):
|
def word(inp, say=False, nick=False):
|
||||||
".word -- gets the word of the day
|
".word -- gets the word of the day"
|
||||||
return "true"
|
|
||||||
page = http.get('http://merriam-webster.com/word-of-the-day')
|
page = http.get('http://merriam-webster.com/word-of-the-day')
|
||||||
|
|
||||||
soup = BeautifulSoup(page)
|
soup = BeautifulSoup(page)
|
||||||
|
|
||||||
word = soup.find('strong', {'class' : 'main_entry_word'})
|
word = soup.find('strong', {'class' : 'main_entry_word'}).renderContents()
|
||||||
function = soup.find('p', {'class' : 'word_function'})
|
function = soup.find('p', {'class' : 'word_function'}).renderContents()
|
||||||
|
|
||||||
#definitions = re.findall(r'<span class="ssens"><strong>:</strong>'
|
#definitions = re.findall(r'<span class="ssens"><strong>:</strong>'
|
||||||
# r' *([^<]+)</span>', content)
|
# r' *([^<]+)</span>', content)
|
||||||
|
|
||||||
say("(%s) The word of the day is: \x02%s\x02 (%s)" % (nick, word, function))
|
say("(%s) The word of the day is: \x02%s\x02 (%s)" % (nick, word, function))
|
||||||
|
|
Reference in a new issue