server blacklist nei test, migliorato unshortenit (con fix uprotector)
This commit is contained in:
+32
-25
@@ -41,14 +41,15 @@ class UnshortenIt(object):
|
|||||||
_linkhub_regex = r'linkhub\.icu'
|
_linkhub_regex = r'linkhub\.icu'
|
||||||
_swzz_regex = r'swzz\.xyz'
|
_swzz_regex = r'swzz\.xyz'
|
||||||
_stayonline_regex = r'stayonline\.pro'
|
_stayonline_regex = r'stayonline\.pro'
|
||||||
|
_snip_regex = r'[0-9a-z]+snip\.|uprotector\.xyz'
|
||||||
# for services that only include real link inside iframe
|
# for services that only include real link inside iframe
|
||||||
_simple_iframe_regex = r'cryptmango|xshield\.net|vcrypt\.club'
|
_simple_iframe_regex = r'cryptmango|xshield\.net|vcrypt\.club'
|
||||||
# for services that only do redirects
|
# for services that only do redirects
|
||||||
_simple_redirect = r'streamcrypt\.net/[^/]+|uprotector\.xyz'
|
_simple_redirect = r'streamcrypt\.net/[^/]+'
|
||||||
|
|
||||||
listRegex = [_adfly_regex, _linkbucks_regex, _adfocus_regex, _lnxlu_regex, _shst_regex, _hrefli_regex, _anonymz_regex,
|
listRegex = [_adfly_regex, _linkbucks_regex, _adfocus_regex, _lnxlu_regex, _shst_regex, _hrefli_regex, _anonymz_regex,
|
||||||
_shrink_service_regex, _rapidcrypt_regex, _simple_iframe_regex, _vcrypt_regex, _linkup_regex, _linkhub_regex,
|
_shrink_service_regex, _rapidcrypt_regex, _simple_iframe_regex, _vcrypt_regex, _linkup_regex, _linkhub_regex,
|
||||||
_swzz_regex, _stayonline_regex, _simple_redirect]
|
_swzz_regex, _stayonline_regex, _snip_regex, _simple_redirect]
|
||||||
|
|
||||||
_maxretries = 5
|
_maxretries = 5
|
||||||
|
|
||||||
@@ -94,6 +95,8 @@ class UnshortenIt(object):
|
|||||||
uri, code = self._unshorten_swzz(uri)
|
uri, code = self._unshorten_swzz(uri)
|
||||||
if re.search(self._stayonline_regex, uri, re.IGNORECASE):
|
if re.search(self._stayonline_regex, uri, re.IGNORECASE):
|
||||||
uri, code = self._unshorten_stayonline(uri)
|
uri, code = self._unshorten_stayonline(uri)
|
||||||
|
if re.search(self._snip_regex, uri, re.IGNORECASE):
|
||||||
|
uri, code = self._unshorten_snip(uri)
|
||||||
if re.search(self._simple_redirect, uri, re.IGNORECASE):
|
if re.search(self._simple_redirect, uri, re.IGNORECASE):
|
||||||
p = httptools.downloadpage(uri)
|
p = httptools.downloadpage(uri)
|
||||||
uri = p.url
|
uri = p.url
|
||||||
@@ -542,25 +545,6 @@ class UnshortenIt(object):
|
|||||||
logger.error('IP bannato da vcrypt, aspetta un ora')
|
logger.error('IP bannato da vcrypt, aspetta un ora')
|
||||||
else:
|
else:
|
||||||
uri = r.headers['location']
|
uri = r.headers['location']
|
||||||
if "snip." in uri:
|
|
||||||
new_uri = ''
|
|
||||||
if 'out_generator' in uri:
|
|
||||||
uri = re.findall('url=(.*)$', uri)[0]
|
|
||||||
elif '/decode/' in uri:
|
|
||||||
scheme, netloc, path, query, fragment = urlsplit(uri)
|
|
||||||
splitted = path.split('/')
|
|
||||||
splitted[1] = 'outlink'
|
|
||||||
r = httptools.downloadpage(uri, follow_redirects=False, post={'url': splitted[2]})
|
|
||||||
if 'location' in r.headers and r.headers['location']:
|
|
||||||
new_uri = r.headers['location']
|
|
||||||
else:
|
|
||||||
r = httptools.downloadpage(scheme + '://' + netloc + "/".join(splitted) + query + fragment, follow_redirects=False, post={'url': splitted[2]})
|
|
||||||
if 'location' in r.headers and r.headers['location']:
|
|
||||||
new_uri = r.headers['location']
|
|
||||||
if new_uri and new_uri != uri:
|
|
||||||
uri = new_uri
|
|
||||||
# uri = decrypt(uri.split('/')[-1])
|
|
||||||
|
|
||||||
return uri, r.code if r else 200
|
return uri, r.code if r else 200
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
@@ -667,6 +651,26 @@ class UnshortenIt(object):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return uri, str(e)
|
return uri, str(e)
|
||||||
|
|
||||||
|
def _unshorten_snip(self, uri):
|
||||||
|
new_uri = ''
|
||||||
|
if 'out_generator' in uri:
|
||||||
|
uri = re.findall('url=(.*)$', uri)[0]
|
||||||
|
elif '/decode/' in uri:
|
||||||
|
scheme, netloc, path, query, fragment = urlsplit(uri)
|
||||||
|
splitted = path.split('/')
|
||||||
|
splitted[1] = 'outlink'
|
||||||
|
r = httptools.downloadpage(uri, follow_redirects=False, post={'url': splitted[2]})
|
||||||
|
if 'location' in r.headers and r.headers['location']:
|
||||||
|
new_uri = r.headers['location']
|
||||||
|
else:
|
||||||
|
r = httptools.downloadpage(scheme + '://' + netloc + "/".join(splitted) + query + fragment,
|
||||||
|
follow_redirects=False, post={'url': splitted[2]})
|
||||||
|
if 'location' in r.headers and r.headers['location']:
|
||||||
|
new_uri = r.headers['location']
|
||||||
|
if new_uri and new_uri != uri:
|
||||||
|
uri = new_uri
|
||||||
|
return uri, 200
|
||||||
|
|
||||||
|
|
||||||
def unwrap_30x_only(uri, timeout=10):
|
def unwrap_30x_only(uri, timeout=10):
|
||||||
unshortener = UnshortenIt()
|
unshortener = UnshortenIt()
|
||||||
@@ -693,10 +697,13 @@ def findlinks(text):
|
|||||||
unshortener = UnshortenIt()
|
unshortener = UnshortenIt()
|
||||||
matches = []
|
matches = []
|
||||||
|
|
||||||
for regex in unshortener.listRegex:
|
regex = '(?:https?://(?:[\w\d]+\.)?)?(?:'
|
||||||
regex = '(?:https?://(?:[\w\d]+\.)?)?(?:' + regex + ')/[a-zA-Z0-9_=/]+'
|
for rg in unshortener.listRegex:
|
||||||
for match in re.findall(regex, text):
|
regex += rg + '|'
|
||||||
matches.append(match)
|
regex = regex[:-1] + ')/[a-zA-Z0-9_=/]+'
|
||||||
|
for match in re.findall(regex, text):
|
||||||
|
matches.append(match)
|
||||||
|
|
||||||
logger.info('matches=' + str(matches))
|
logger.info('matches=' + str(matches))
|
||||||
if len(matches) == 1:
|
if len(matches) == 1:
|
||||||
text += '\n' + unshorten(matches[0])[0]
|
text += '\n' + unshorten(matches[0])[0]
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ validUrlRegex = re.compile(
|
|||||||
r'(?:/?|[/?]\S+)$', re.IGNORECASE)
|
r'(?:/?|[/?]\S+)$', re.IGNORECASE)
|
||||||
|
|
||||||
chBlackList = ['url', 'mediasetplay']
|
chBlackList = ['url', 'mediasetplay']
|
||||||
srvBalcklist = ['mega', 'hdmario', 'torrent', 'youtube']
|
srvBlacklist = ['mega', 'hdmario', 'torrent', 'youtube']
|
||||||
chNumRis = {
|
chNumRis = {
|
||||||
'altadefinizione01': {
|
'altadefinizione01': {
|
||||||
'Film': 20
|
'Film': 20
|
||||||
@@ -222,7 +222,7 @@ print(channels)
|
|||||||
serverNames = []
|
serverNames = []
|
||||||
serversFinal = []
|
serversFinal = []
|
||||||
for s in servers:
|
for s in servers:
|
||||||
if not s['name'] in serverNames:
|
if s['name'] not in serverNames and s['name'] not in srvBlacklist:
|
||||||
serverNames.append(s['name'])
|
serverNames.append(s['name'])
|
||||||
serversFinal.append(s)
|
serversFinal.append(s)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user