From d59034f6c938047aad13c8aa9b6fbe3c3a644ea0 Mon Sep 17 00:00:00 2001 From: marco Date: Sun, 13 Sep 2020 18:03:57 +0200 Subject: [PATCH] migliorato unshortenit e fix akvideo --- lib/unshortenit.py | 46 ++++++++++++++++++++++---------------------- servers/akvideo.json | 12 ++++-------- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/lib/unshortenit.py b/lib/unshortenit.py index 4301d2ac..8ef21dae 100644 --- a/lib/unshortenit.py +++ b/lib/unshortenit.py @@ -491,7 +491,7 @@ class UnshortenIt(object): def _unshorten_vcrypt(self, uri): - uri = uri.replace('.net','.pw') + uri = uri.replace('.net', '.pw') try: headers = {} if 'myfoldersakstream.php' in uri or '/verys/' in uri: @@ -566,7 +566,7 @@ class UnshortenIt(object): elif '/speedx/' in uri: uri = uri.replace('http://linkup.pro/speedx', 'http://speedvideo.net') else: - r = httptools.downloadpage(uri, follow_redirect=True, timeout=self._timeout, cookies=False) + r = httptools.downloadpage(uri, follow_redirects=True, timeout=self._timeout, cookies=False) uri = r.url link = re.findall("]*src=\\'([^'>]*)\\'[^<>]*>", r.data) # fix by greko inizio @@ -578,8 +578,8 @@ class UnshortenIt(object): if short: uri = short[0] if not r: - r = httptools.downloadpage(uri, follow_redirect=True, timeout=self._timeout, cookies=False) - uri = r.url + r = httptools.downloadpage(uri, follow_redirects=False, timeout=self._timeout, cookies=False) + uri = r.headers['location'] if "4snip" in uri: if 'out_generator' in uri: uri = re.findall('url=(.*)$', uri)[0] @@ -670,7 +670,7 @@ def unshorten_only(uri, type=None, timeout=10): def unshorten(uri, type=None, timeout=10): unshortener = UnshortenIt() - uri, status = unshortener.unwrap_30x(uri, timeout=timeout) + # uri, status = unshortener.unwrap_30x(uri, timeout=timeout) uri, status = unshortener.unshorten(uri, type=type) if status == 200: uri, status = unshortener.unwrap_30x(uri, timeout=timeout) @@ -690,22 +690,22 @@ def findlinks(text): text += '\n' + unshorten(matches[0])[0] elif matches: # non threaded for webpdb - # for match in matches: - # sh = unshorten(match)[0] - # text += '\n' + sh - import sys - if sys.version_info[0] >= 3: - from concurrent import futures - else: - from concurrent_py2 import futures - with futures.ThreadPoolExecutor() as executor: - unshList = [executor.submit(unshorten, match) for match in matches] - for link in futures.as_completed(unshList): - if link.result()[0] not in matches: - links = link.result()[0] - if type(links) == list: - for l in links: - text += '\n' + l - else: - text += '\n' + str(link.result()[0]) + for match in matches: + sh = unshorten(match)[0] + text += '\n' + sh + # import sys + # if sys.version_info[0] >= 3: + # from concurrent import futures + # else: + # from concurrent_py2 import futures + # with futures.ThreadPoolExecutor() as executor: + # unshList = [executor.submit(unshorten, match) for match in matches] + # for link in futures.as_completed(unshList): + # if link.result()[0] not in matches: + # links = link.result()[0] + # if type(links) == list: + # for l in links: + # text += '\n' + l + # else: + # text += '\n' + str(link.result()[0]) return text \ No newline at end of file diff --git a/servers/akvideo.json b/servers/akvideo.json index 337ca196..2a8fa07e 100644 --- a/servers/akvideo.json +++ b/servers/akvideo.json @@ -4,16 +4,12 @@ "ignore_urls": ["http://akvideo.stream/video", "http://akvideo.stream/video/api"], "patterns": [ { - "pattern": "akvideo\\.stream/((?:api/vcmod/fastredirect/streaming\\.php\\?id=|swembedid/)[$0-9]+)", - "url": "http://akvideo.stream/\\1" + "pattern": "https?://(?:akvideo\\.stream|akvi\\.club)/[^\\s]+[/=]([$0-9]+)(?:[\\s<]|$|\\.html)", + "url": "http://akvideo.stream/swembedid/\\1" }, { - "pattern": "(https://akvideo\\.stream/api/vcmod/fastredirect/embed_ak\\.php\\?id=[0-9]+)", - "url": "\\1" - }, - { - "pattern": "akvideo.stream/(?:video/|video\\.php\\?file_code=)?(?:embed-)?([a-zA-Z0-9]+)", - "url": "http://akvideo.stream/video/\\1" + "pattern": "https?://(?:akvideo\\.stream|akvi\\.club)/(?:embed-|video\\.php\\?file_code=)?([a-z0-9]+)(?:[\\s<]|$|\\.html)", + "url": "http://akvi.club/embed-\\1.html" } ] },