From babaa9fb9fc6eaf060510fe56a2284ed4c623c87 Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Mon, 12 Dec 2011 01:55:10 -0500 Subject: [PATCH] linx.li uploader --- modules/linx.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 modules/linx.py diff --git a/modules/linx.py b/modules/linx.py new file mode 100644 index 0000000..c742b4a --- /dev/null +++ b/modules/linx.py @@ -0,0 +1,32 @@ +#!/usr/bin/python3 +""" +linx.py - linx.li uploader +author: mutantmonkey +""" + +from urllib.error import HTTPError +import web +import json + +def linx(phenny, input): + """.linx - Upload a URL to linx.li.""" + + url = input.group(2) + + try: + req = web.post("http://linx.li/vtluug", {'url': url}) + except (HTTPError, IOError): + phenny.say("THE INTERNET IS FUCKING BROKEN. Please try again later.") + return + + data = json.loads(req) + if len(data) <= 0 or not data['success']: + phenny.reply('Sorry, upload failed.') + return + + phenny.reply(data['url']) +linx.rule = (['linx'], r'(.*)') + +if __name__ == '__main__': + print(__doc__.strip()) +