19 lines
466 B
Python
19 lines
466 B
Python
|
from src import ModuleManager, utils
|
||
|
|
||
|
URL = "https://ttm.sh"
|
||
|
|
||
|
class Module(ModuleManager.BaseModule):
|
||
|
def on_load(self):
|
||
|
self.exports.add("shorturl-s-ttmsh", self._shorturl)
|
||
|
def _shorturl(self, url):
|
||
|
if len(url) < 18:
|
||
|
return None
|
||
|
|
||
|
page = utils.http.request(URL, method="POST",
|
||
|
post_data={"shorten": url})
|
||
|
|
||
|
if page and page.data:
|
||
|
return page.decode("utf8").rstrip("\n")
|
||
|
return None
|
||
|
|