Add fml module

master
Casey Link 2011-07-30 01:51:10 -04:00
parent d77fc7a8b0
commit 569862a227
1 changed files with 30 additions and 0 deletions

30
modules/fml.py Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/python2
"""
fml.py - fuck my life retrieval
author: Ramblurr <unnamedrambler@gmail.com>
"""
import random
from urllib import quote as urlquote
from urllib2 import urlopen, HTTPError
import lxml.html
def fml(phenny, input):
""".fml"""
try:
req = urlopen("http://www.fmylife.com/random")
except HTTPError:
phenny.say("THE INTERNET IS FUCKING BROKEN. Please try again later.")
return
doc = lxml.html.parse(req)
quote = doc.getroot().find_class('article')[0][0].text_content()
phenny.say(quote)
fml.commands = ['fml']
if __name__ == '__main__':
print __doc__.strip()