added puu.sh filename support
This commit is contained in:
parent
c22ee5ee37
commit
8d171ffdbe
|
@ -8,10 +8,28 @@ from html.parser import HTMLParser
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from module import hook
|
from module import hook, url_callback
|
||||||
|
|
||||||
HEADERS = {"User-Agent": "bix nood gimme the title", "Range": "bytes=0-4096"}
|
HEADERS = {"User-Agent": "bix nood gimme the title", "Range": "bytes=0-4096"}
|
||||||
|
|
||||||
|
@url_callback('puu.sh/')
|
||||||
|
def get_puush_fname(bot, url):
|
||||||
|
"""
|
||||||
|
Callback puu.sh links. Gets the filename and displays it.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
res = requests.head(url)
|
||||||
|
except requests.exceptions.RequestException:
|
||||||
|
return
|
||||||
|
|
||||||
|
fname = res.headers.get('Content-Disposition', '')
|
||||||
|
fname = re.search(r'\"(.*)\"', fname).group(1)
|
||||||
|
if not fname:
|
||||||
|
return
|
||||||
|
|
||||||
|
bot.msg(f"[ \x0310puu.sh \x03] - \x0304{fname}")
|
||||||
|
|
||||||
|
|
||||||
@hook(True)
|
@hook(True)
|
||||||
def title_auto(bot, trigger):
|
def title_auto(bot, trigger):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user