2011-09-01 09:40:25 -04:00
|
|
|
#!/usr/bin/python2
|
|
|
|
"""
|
|
|
|
mylife.py - various commentary on life
|
|
|
|
author: Ramblurr <unnamedrambler@gmail.com>
|
2011-09-02 17:11:12 -04:00
|
|
|
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
|
2011-09-01 09:40:25 -04:00
|
|
|
"""
|
|
|
|
|
|
|
|
import random
|
|
|
|
|
|
|
|
from urllib import quote as urlquote
|
2011-09-21 20:43:05 -04:00
|
|
|
from urllib2 import HTTPError
|
|
|
|
import web
|
2011-09-01 09:40:25 -04:00
|
|
|
import lxml.html
|
|
|
|
|
|
|
|
def fml(phenny, input):
|
2011-09-02 00:56:55 -04:00
|
|
|
""".fml"""
|
|
|
|
try:
|
2011-09-21 20:43:05 -04:00
|
|
|
req = web.get("http://www.fmylife.com/random")
|
2011-09-21 20:54:47 -04:00
|
|
|
except HTTPError, IOError:
|
2011-09-02 00:57:40 -04:00
|
|
|
phenny.say("I tried to use .fml, but it was broken. FML")
|
2011-09-02 00:56:55 -04:00
|
|
|
return
|
2011-09-01 09:40:25 -04:00
|
|
|
|
2011-09-21 20:43:05 -04:00
|
|
|
doc = lxml.html.fromstring(req)
|
|
|
|
quote = doc.find_class('article')[0][0].text_content()
|
2011-09-02 00:56:55 -04:00
|
|
|
phenny.say(quote)
|
2011-09-01 09:40:25 -04:00
|
|
|
fml.commands = ['fml']
|
|
|
|
|
|
|
|
def mlia(phenny, input):
|
2011-09-02 00:56:55 -04:00
|
|
|
""".mlia - My life is average."""
|
|
|
|
try:
|
2011-09-21 20:43:05 -04:00
|
|
|
req = web.get("http://mylifeisaverage.com/")
|
2011-09-21 20:54:47 -04:00
|
|
|
except HTTPError, IOError:
|
2011-09-02 00:56:55 -04:00
|
|
|
phenny.say("I tried to use .mlia, but it wasn't loading. MLIA")
|
|
|
|
return
|
2011-09-01 09:40:25 -04:00
|
|
|
|
2011-09-21 20:43:05 -04:00
|
|
|
doc = lxml.html.fromstring(req)
|
|
|
|
quote = doc.find_class('story')[0][0].text_content()
|
2011-09-02 00:56:55 -04:00
|
|
|
quote = quote.strip()
|
|
|
|
phenny.say(quote)
|
2011-09-01 09:40:25 -04:00
|
|
|
mlia.commands = ['mlia']
|
|
|
|
|
2011-09-02 00:56:55 -04:00
|
|
|
def mliarab(phenny, input):
|
|
|
|
""".mliarab - My life is Arabic."""
|
|
|
|
try:
|
2011-09-21 20:43:05 -04:00
|
|
|
req = web.get("http://mylifeisarabic.com/random/")
|
2011-09-21 20:54:47 -04:00
|
|
|
except HTTPError, IOError:
|
2011-09-02 00:56:55 -04:00
|
|
|
phenny.say("The site you requested, mylifeisarabic.com, has been banned \
|
|
|
|
in the UAE. You will be reported to appropriate authorities")
|
|
|
|
return
|
|
|
|
|
2011-09-21 20:43:05 -04:00
|
|
|
doc = lxml.html.fromstring(req)
|
|
|
|
quotes = doc.find_class('entry')
|
2011-09-02 17:11:12 -04:00
|
|
|
quote = random.choice(quotes)[0].text_content()
|
2011-09-02 00:56:55 -04:00
|
|
|
quote = quote.strip()
|
|
|
|
phenny.say(quote)
|
2011-09-02 17:11:12 -04:00
|
|
|
mliarab.commands = ['mliar', 'mliarab']
|
2011-09-02 00:56:55 -04:00
|
|
|
|
2011-09-02 01:16:19 -04:00
|
|
|
def mlib(phenny, input):
|
|
|
|
""".mlib - My life is bro."""
|
2011-09-02 00:56:55 -04:00
|
|
|
try:
|
2011-09-21 20:43:05 -04:00
|
|
|
req = web.get("http://mylifeisbro.com/random")
|
2011-09-21 20:54:47 -04:00
|
|
|
except HTTPError, IOError:
|
2011-09-02 01:16:19 -04:00
|
|
|
phenny.say("MLIB is out getting a case of Natty. It's chill.")
|
2011-09-02 00:56:55 -04:00
|
|
|
return
|
2011-09-01 09:40:25 -04:00
|
|
|
|
2011-09-21 20:43:05 -04:00
|
|
|
doc = lxml.html.fromstring(req)
|
|
|
|
quote = doc.find_class('storycontent')[0][0].text_content()
|
2011-09-02 00:56:55 -04:00
|
|
|
phenny.say(quote)
|
2011-09-02 01:16:19 -04:00
|
|
|
mlib.commands = ['mlib']
|
2011-09-01 09:40:25 -04:00
|
|
|
|
2011-09-17 21:46:42 -04:00
|
|
|
def mlic(phenny, input):
|
|
|
|
""".mlic - My life is creepy."""
|
|
|
|
try:
|
2011-09-21 20:43:05 -04:00
|
|
|
req = web.get("http://mylifeiscreepy.com/random")
|
2011-09-21 20:54:47 -04:00
|
|
|
except HTTPError, IOError:
|
2011-09-17 21:46:42 -04:00
|
|
|
phenny.say("Error: Have you checked behind you?")
|
|
|
|
return
|
|
|
|
|
2011-09-21 20:43:05 -04:00
|
|
|
doc = lxml.html.fromstring(req)
|
|
|
|
quote = doc.find_class('oldlink')[0].text_content()
|
2011-09-17 21:46:42 -04:00
|
|
|
quote = quote.strip()
|
|
|
|
phenny.say(quote)
|
|
|
|
mlic.commands = ['mlic']
|
|
|
|
|
2011-09-02 01:16:19 -04:00
|
|
|
def mlid(phenny, input):
|
|
|
|
""".mlib - My life is Desi."""
|
2011-09-02 00:56:55 -04:00
|
|
|
try:
|
2011-09-21 20:43:05 -04:00
|
|
|
req = web.get("http://www.mylifeisdesi.com/random")
|
2011-09-21 20:54:47 -04:00
|
|
|
except HTTPError, IOError:
|
2011-09-02 01:16:19 -04:00
|
|
|
phenny.say("MLID is busy at the hookah lounge, be back soon.")
|
|
|
|
return
|
|
|
|
|
2011-09-21 20:43:05 -04:00
|
|
|
doc = lxml.html.fromstring(req)
|
|
|
|
quote = doc.find_class('oldlink')[0].text_content()
|
2011-09-02 01:16:19 -04:00
|
|
|
phenny.say(quote)
|
|
|
|
mlid.commands = ['mlid']
|
|
|
|
|
|
|
|
def mlig(phenny, input):
|
|
|
|
""".mlig - My life is ginger."""
|
|
|
|
try:
|
2011-09-21 20:43:05 -04:00
|
|
|
req = web.get("http://www.mylifeisginger.org/random")
|
2011-09-21 20:54:47 -04:00
|
|
|
except HTTPError, IOError:
|
2011-09-02 01:16:19 -04:00
|
|
|
phenny.say("Busy eating your soul. Be back soon.")
|
|
|
|
return
|
|
|
|
|
2011-09-21 20:43:05 -04:00
|
|
|
doc = lxml.html.fromstring(req)
|
|
|
|
quote = doc.find_class('oldlink')[0].text_content()
|
2011-09-02 01:16:19 -04:00
|
|
|
phenny.say(quote)
|
|
|
|
mlig.commands = ['mlig']
|
|
|
|
|
|
|
|
def mlih(phenny, input):
|
|
|
|
""".mlih - My life is ho."""
|
|
|
|
try:
|
2011-09-21 20:43:05 -04:00
|
|
|
req = web.get("http://mylifeisho.com/random")
|
2011-09-21 20:54:47 -04:00
|
|
|
except HTTPError, IOError:
|
2011-09-02 01:16:19 -04:00
|
|
|
phenny.say("MLIH is giving some dome to some lax bros.")
|
2011-09-02 00:56:55 -04:00
|
|
|
return
|
2011-09-01 09:40:25 -04:00
|
|
|
|
2011-09-21 20:43:05 -04:00
|
|
|
doc = lxml.html.fromstring(req)
|
|
|
|
quote = doc.find_class('storycontent')[0][0].text_content()
|
2011-09-02 00:56:55 -04:00
|
|
|
phenny.say(quote)
|
2011-09-02 01:16:19 -04:00
|
|
|
mlih.commands = ['mlih']
|
2011-09-01 09:40:25 -04:00
|
|
|
|
2011-09-17 21:35:08 -04:00
|
|
|
def mlihp(phenny, input):
|
|
|
|
""".mlihp - My life is Harry Potter."""
|
|
|
|
try:
|
2011-09-21 20:43:05 -04:00
|
|
|
req = web.get("http://www.mylifeishp.com/random")
|
2011-09-21 20:54:47 -04:00
|
|
|
except HTTPError, IOError:
|
2011-09-17 21:35:08 -04:00
|
|
|
phenny.say("This service is not available to Muggles.")
|
|
|
|
return
|
|
|
|
|
2011-09-21 20:43:05 -04:00
|
|
|
doc = lxml.html.fromstring(req)
|
|
|
|
quote = doc.find_class('oldlink')[0].text_content()
|
2011-09-17 21:35:08 -04:00
|
|
|
phenny.say(quote)
|
|
|
|
mlihp.commands = ['mlihp']
|
|
|
|
|
2011-09-17 21:31:31 -04:00
|
|
|
def mlit(phenny, input):
|
|
|
|
""".mlit - My life is Twilight."""
|
|
|
|
try:
|
2011-09-21 20:43:05 -04:00
|
|
|
req = web.get("http://mylifeistwilight.com/random")
|
2011-09-21 20:54:47 -04:00
|
|
|
except HTTPError, IOError:
|
2011-09-17 21:31:31 -04:00
|
|
|
phenny.say("Error: Your life is too Twilight. Go outside.")
|
|
|
|
return
|
|
|
|
|
2011-09-21 20:43:05 -04:00
|
|
|
doc = lxml.html.fromstring(req)
|
|
|
|
quote = doc.find_class('fmllink')[0].text_content()
|
2011-09-17 21:31:31 -04:00
|
|
|
phenny.say(quote)
|
|
|
|
mlit.commands = ['mlit']
|
|
|
|
|
2011-09-01 09:40:25 -04:00
|
|
|
if __name__ == '__main__':
|
2011-09-02 00:56:55 -04:00
|
|
|
print __doc__.strip()
|
2011-09-01 09:40:25 -04:00
|
|
|
|