def extracturl(msg): if "PRIVMSG" not in msg: return False url = re.search("(?P<url>https?://[^\s]+)", msg) if url is not None: link = url.group("url") return urlclean.unshorten(link) else: return False
def render_GET(self, request): if request.args and len(request.args.get('u')): try: kwargs={'proxyhost': cfg.get('proxy','host'), 'proxyport': cfg.get('proxy','port')} except: kwargs={} return unshorten(request.args.get('u')[0], ua=RandomAgent(cfg.get('resolver','db')).get_agent, cache=self.cache, **kwargs) return "Error: try appending ?u=<URL>"