2012-03-27 23:20:18 -04:00
|
|
|
#!/usr/bin/python3
|
|
|
|
"""
|
|
|
|
linx.py - linx.li tools
|
2012-09-24 21:55:58 -04:00
|
|
|
author: andreim <andreim@andreim.net>
|
|
|
|
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
|
2012-03-27 23:20:18 -04:00
|
|
|
"""
|
|
|
|
|
2012-06-02 01:17:09 -04:00
|
|
|
from tools import GrumbleError
|
2017-02-11 01:52:53 -05:00
|
|
|
import requests
|
2012-03-27 23:20:18 -04:00
|
|
|
import json
|
|
|
|
|
2012-06-21 19:29:31 -04:00
|
|
|
|
2012-08-30 01:43:05 -04:00
|
|
|
def linx(phenny, input, short=False):
|
|
|
|
""".linx <url> - Upload a remote URL to linx.li."""
|
2012-03-27 23:20:18 -04:00
|
|
|
|
|
|
|
url = input.group(2)
|
|
|
|
if not url:
|
2017-02-11 01:52:53 -05:00
|
|
|
phenny.reply("No URL provided")
|
2012-03-27 23:20:18 -04:00
|
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
2017-02-11 01:52:53 -05:00
|
|
|
url = url.replace(".onion/", ".onion.to/")
|
|
|
|
|
|
|
|
r = requests.get("https://linx.vtluug.org/upload?", params={"url": url}, headers={"Accept": "application/json"})
|
|
|
|
if "url" in r.json():
|
|
|
|
phenny.reply(r.json()["url"])
|
|
|
|
else:
|
|
|
|
phenny.reply(r.json()["error"])
|
|
|
|
|
|
|
|
except Exception as exc:
|
|
|
|
raise GrumbleError(exc)
|
2012-03-27 23:20:18 -04:00
|
|
|
|
|
|
|
linx.rule = (['linx'], r'(.*)')
|
|
|
|
|
|
|
|
|