diff --git a/lib/unshortenit.py b/lib/unshortenit.py index 93947025..3ca16285 100644 --- a/lib/unshortenit.py +++ b/lib/unshortenit.py @@ -488,7 +488,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: @@ -564,7 +564,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 @@ -576,8 +576,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] @@ -668,7 +668,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) @@ -688,22 +688,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" } ] },