From 17be3a6fac9acbbdfb87c41eacddda3889c9c488 Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Mon, 17 Feb 2020 19:44:31 +0100 Subject: [PATCH] Fix Support --- core/support.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/core/support.py b/core/support.py index 5c44314d..0c977809 100755 --- a/core/support.py +++ b/core/support.py @@ -157,7 +157,8 @@ def scrapeLang(scraped, lang, longtitle): return language, longtitle def cleantitle(title): - cleantitle = scrapertools.htmlclean(scrapertools.decodeHtmlentities(title).replace('"', "'").replace('×', 'x').replace('–', '-')).strip() + if type(title) != str: title.decode('UTF-8') + cleantitle = title.replace('"', "'").replace('×', 'x').replace('–', '-').strip() return cleantitle def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, typeContentDict, typeActionDict, blacklist, search, pag, function, lang): @@ -192,16 +193,17 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t for i, match in enumerate(matches): if pagination and (pag - 1) * pagination > i and not search: continue # pagination if pagination and i >= pag * pagination and not search: break # pagination - listGroups = match.keys() - match = match.values() + # listGroups = match.keys() + # match = match.values() - if len(listGroups) > len(match): # to fix a bug - match = list(match) - match.extend([''] * (len(listGroups) - len(match))) + # if len(listGroups) > len(match): # to fix a bug + # match = list(match) + # match.extend([''] * (len(listGroups) - len(match))) scraped = {} for kk in known_keys: - val = match[listGroups.index(kk)] if kk in listGroups else '' + val = match[kk] if kk in match else '' + # val = match[listGroups.index(kk)] if kk in listGroups else '' if val and (kk == "url" or kk == 'thumb') and 'http' not in val: val = scrapertools.find_single_match(item.url, 'https?://[a-z0-9.-]+') + (val if val.startswith('/') else '/' + val) scraped[kk] = val @@ -294,8 +296,10 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t other = scraped['other'] if scraped['other'] else '' ) - for lg in list(set(listGroups).difference(known_keys)): - it.__setattr__(lg, match[listGroups.index(lg)]) + # for lg in list(set(listGroups).difference(known_keys)): + # it.__setattr__(lg, match[listGroups.index(lg)]) + for lg in list(set(match.keys()).difference(known_keys)): + it.__setattr__(lg, match[lg]) if 'itemHook' in args: it = args['itemHook'](it) @@ -744,7 +748,7 @@ def typo(string, typography=''): if '{}' in string: string = '{' + re.sub(r'\s\{\}','',string) + '}' if 'submenu' in string: - string = u"\u2022\u2022 ".encode('utf-8') + re.sub(r'\ssubmenu','',string) + string = "•• " + re.sub(r'\ssubmenu','',string) if 'color' in string: color = scrapertools.find_single_match(string, 'color ([a-z]+)') if color == 'kod' or '': color = kod_color @@ -758,7 +762,7 @@ def typo(string, typography=''): if '--' in string: string = ' - ' + re.sub(r'\s--','',string) if 'bullet' in string: - string = '[B]' + u"\u2022".encode('utf-8') + '[/B] ' + re.sub(r'\sbullet','',string) + string = '[B]' + "•" + '[/B] ' + re.sub(r'\sbullet','',string) return string @@ -1064,7 +1068,7 @@ def controls(itemlist, item, AutoPlay=True, CheckLinks=True, down_load=True): channel_node = autoplay_node.get(item.channel, {}) settings_node = channel_node.get('settings', {}) AP = get_setting('autoplay') or settings_node['active'] - HS = config.get_setting('hide_servers') or (settings_node['hide_servers'] if settings_node.has_key('hide_server') else False) + HS = config.get_setting('hide_servers') or (settings_node['hide_servers'] if 'hide_server' in settings_node else False) if CL and not AP: if get_setting('checklinks', item.channel):