diff --git a/modules/fml.py b/modules/fml.py new file mode 100755 index 0000000..c0d1c92 --- /dev/null +++ b/modules/fml.py @@ -0,0 +1,30 @@ +#!/usr/bin/python2 +""" +fml.py - fuck my life retrieval +author: Ramblurr +""" + +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() +