Fix proxytranslate, migliorie varie

This commit is contained in:
mac12m99
2021-04-25 11:47:16 +02:00
parent a1ad38d2ea
commit ff5f40b966
4 changed files with 15 additions and 14 deletions

View File

@@ -36,7 +36,7 @@ def menu(item):
def search(item, texto):
support.info(texto)
item.url = host + "/?s=" + texto
item.url = host + "/search/" + texto
try:
return peliculas(item)
except:
@@ -72,7 +72,7 @@ def peliculas(item):
if item.args == 'newest':
patron = r'<div id="blockvids">\s*<ul>\s*<li>\s*<a href="(?P<url>[^"]+)"[^>]+><img[^>]+src="(?P<thumb>[^"]+)"[^>]*>(?:[^>]+>){4}(?P<title>[^\[]+)\[(?P<lang>[^\]]+)\]'
else:
patron = r'<div class="span4">\s*<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)"[^>]+><\/a>(?:[^>]+>){7}\s*<h1>(?P<title>[^<\[]+)(?:\[(?P<lang>[^\]]+)\])?</h1></a>.*?-->(?:.*?<br />)?\s*(?P<plot>[^<]+)'
patron = r'<div class="span4">\s*<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)"[^>]+><\/a>(?:[^>]+>){7}\s*<h1>(?P<title>[^<\[]+)(?:\[(?P<lang>[^\]]+)\])?</h1></a>.*?-->(?:.*?<br(?: /)?>)?\s*(?P<plot>[^<]+)'
patronNext = r'<link rel="next" href="([^"]+)"'
action = 'check'
return locals()

View File

@@ -86,15 +86,15 @@ def encode(path, _samba=False):
@rtype: str
@return path encoded in system character set or utf-8 if samba
"""
# from core.support import dbg;dbg()
if not isinstance(path, unicode):
path = unicode(path, "utf-8", "ignore")
if scrapertools.find_single_match(path, r'(^\w+:\/\/)') or _samba and not PY3:
path = path.encode("utf-8", "ignore")
else:
if fs_encoding and not PY3:
path = path.encode(fs_encoding, "ignore")
if not PY3:
if scrapertools.find_single_match(path, r'(^\w+:\/\/)') or _samba:
path = path.encode("utf-8", "ignore")
else:
if fs_encoding:
path = path.encode(fs_encoding, "ignore")
# if PY3 and isinstance(path, bytes):
# if fs_encoding:

View File

@@ -88,20 +88,20 @@ def process_request_proxy(url):
time.sleep(0.5)
result = requests.get(
url_request_proxy,
timeout=20,
headers={'User-Agent': 'android'}
timeout=20
# headers={'User-Agent': 'android'}
)
data = result.content.decode('utf-8', 'ignore')
if not PY3:
data = data.encode('utf-8')
if logger:
logger.debug()
logger.debug(url_request_proxy)
data = re.sub('\s(\w+)=(?!")([^<>\s]+)', r' \1="\2"', data)
data = re.sub('https://translate\.googleusercontent\.com/.*?u=(.*?)&amp;usg=[A-Za-z0-9_-]+', '\\1', data)
data = re.sub('https?://[a-zA-Z0-9]+--' + domain.replace('.', '-') + '\.translate\.goog(/[a-zA-Z0-9#/-]+)', 'https://' + domain + '\\1', data)
data = re.sub('https?://[a-zA-Z0-9-]+' + domain.replace('.', '-') + '\.translate\.goog(/[a-zA-Z0-9#/-]+)', 'https://' + domain + '\\1', data)
data = re.sub('\s+<', '<', data)
data = data.replace('&amp;', '&').replace('https://translate.google.com/website?sl=' + SL + '&tl=' + TL + '&u=', '')
data = data.replace('&amp;', '&').replace('https://translate.google.com/website?sl=' + SL + '&tl=' + TL + '&ajax=1&u=', '')
return {'url': url.strip(), 'result': result, 'data': data}
except Exception as e:

View File

@@ -349,7 +349,8 @@ class SearchWindow(xbmcgui.WindowXML):
logger.debug('retring with original title on channel ' + channel)
dummy, valid, dummy = search(self.item.infoLabels.get('originaltitle'))
except:
pass
import traceback
logger.error(traceback.format_exc())
self.count += 1
return self.update(channel, valid, other if other else results)