From 27f0375e4e5355c8c02744ae9c18bda10de1cbd8 Mon Sep 17 00:00:00 2001 From: pipcat Date: Fri, 20 Jul 2018 21:48:32 +0200 Subject: [PATCH] =?UTF-8?q?Correcci=C3=B3n=20vidoza=20y=20platformtools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platformcode/platformtools.py | 18 ++++----------- plugin.video.alfa/servers/vidoza.py | 23 ++++++++++++++----- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/plugin.video.alfa/platformcode/platformtools.py b/plugin.video.alfa/platformcode/platformtools.py index 506a6676..54459dba 100644 --- a/plugin.video.alfa/platformcode/platformtools.py +++ b/plugin.video.alfa/platformcode/platformtools.py @@ -127,13 +127,12 @@ def render_items(itemlist, parent_item): if 'anime' in channeltools.get_channel_parameters(parent_item.channel)['categories']: anime = True - # Recorremos el itemlist + unify_enabled = config.get_setting('unify') + #logger.debug('unify_enabled: %s' % unify_enabled) + + # Recorremos el itemlist for item in itemlist: - try: - channel_parameters = channeltools.get_channel_parameters(item.channel) - except: - pass #logger.debug(item) # Si el item no contiene categoria, le ponemos la del item padre if item.category == "": @@ -143,9 +142,7 @@ def render_items(itemlist, parent_item): if item.fanart == "": item.fanart = parent_item.fanart - if genre: - valid_genre = True thumb = get_thumb(item.title, auto=True) if thumb != '': @@ -155,12 +152,7 @@ def render_items(itemlist, parent_item): valid_genre = True - unify_enabled = config.get_setting('unify') - - #logger.debug('unify_enabled: %s' % unify_enabled) - - - if unify_enabled and not channel_parameters['adult'] and 'skip_unify' not in channel_parameters: + if unify_enabled: # Formatear titulo con unify item = unify.title_format(item) else: diff --git a/plugin.video.alfa/servers/vidoza.py b/plugin.video.alfa/servers/vidoza.py index a7b55f11..85da6413 100755 --- a/plugin.video.alfa/servers/vidoza.py +++ b/plugin.video.alfa/servers/vidoza.py @@ -20,13 +20,24 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= logger.info("(page_url='%s')" % page_url) data = httptools.downloadpage(page_url).data video_urls = [] - matches = scrapertools.find_multiple_matches(data, 'src\s*:\s*"([^"]+)".*?label:\'([^\']+)\'') - for media_url, calidad in matches: - ext = media_url[-4:] - video_urls.append(["%s %s [vidoza]" % (ext, calidad), media_url]) + + s = scrapertools.find_single_match(data, 'sourcesCode\s*:\s*(\[\{.*?\}\])') + s = s.replace('src:', '"src":').replace('type:', '"type":').replace('label:', '"label":').replace('res:', '"res":') + try: + data = json.loads(str(s)) + for enlace in data: + if 'src' in enlace: + tit = '' + if 'label' in enlace: tit += '[%s]' % enlace['label'] + if 'res' in enlace: tit += '[%s]' % enlace['res'] + if tit == '' and 'type' in enlace: tit = enlace['type'] + if tit == '': tit = '.mp4' + + video_urls.append(["%s [vidoza]" % tit, enlace['src']]) + except: + logger.debug('No se detecta json %s' % s) + pass video_urls.reverse() - for video_url in video_urls: - logger.info("%s - %s" % (video_url[0], video_url[1])) return video_urls