From 0c19c15d38285cd2eeb995d6fe37e3f07870ce2e Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 9 Oct 2019 19:44:02 +0200 Subject: [PATCH] miglioramenti scraper vcrypt --- lib/unshortenit.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/unshortenit.py b/lib/unshortenit.py index cd1c82bf..f43637b7 100644 --- a/lib/unshortenit.py +++ b/lib/unshortenit.py @@ -491,18 +491,22 @@ class UnshortenIt(object): headers = { "Cookie": hashlib.md5(ip+day).hexdigest() + "=1" } - uri = uri.replace('sb/','sb1/') - uri = uri.replace('akv/','akv1/') - uri = uri.replace('wss/','wss1/') - uri = uri.replace('wsd/','wsd1/') + uri = uri.replace('sb/', 'sb1/') + uri = uri.replace('akv/', 'akv1/') + uri = uri.replace('wss/', 'wss1/') + uri = uri.replace('wsd/', 'wsd1/') r = httptools.downloadpage(uri, timeout=self._timeout, headers=headers, follow_redirects=False) - uri = r.headers['location'] + if 'Wait 1 hour' in r.data: + uri = '' + logger.info('IP bannato da vcrypt, aspetta un ora') + else: + uri = r.headers['location'] if "4snip" in uri: if 'out_generator' in uri: uri = re.findall('url=(.*)$', uri)[0] - else: - uri = decrypt(uri) + elif '/decode/' in uri: + uri = decrypt(uri.split('/')[-1]) return uri, r.code if r else 200