From 36f9e691933c6551e000ec61fa5f95216e4cc993 Mon Sep 17 00:00:00 2001 From: Intel1 Date: Wed, 21 Nov 2018 09:22:00 -0500 Subject: [PATCH 1/8] Actualizados MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cinetux: fix enlaces danimados: fix enlaces de películas planetadocumental: Eliminados, solo tiene archivos .rar xms: fix enlaces descargacineclasico: fix enlaces bitp: fix enlaces dostream: fix enlaces --- plugin.video.alfa/channels/cinetux.py | 56 +++---- plugin.video.alfa/channels/danimados.py | 33 ++-- .../channels/planetadocumental.json | 22 --- .../channels/planetadocumental.py | 142 ------------------ plugin.video.alfa/channels/xms.py | 6 +- plugin.video.alfa/channels/yespornplease.py | 20 +-- plugin.video.alfa/lib/unshortenit.py | 2 +- plugin.video.alfa/servers/bitp.py | 2 +- plugin.video.alfa/servers/dostream.py | 24 ++- plugin.video.alfa/servers/streamplay.json | 2 +- 10 files changed, 62 insertions(+), 247 deletions(-) delete mode 100644 plugin.video.alfa/channels/planetadocumental.json delete mode 100644 plugin.video.alfa/channels/planetadocumental.py diff --git a/plugin.video.alfa/channels/cinetux.py b/plugin.video.alfa/channels/cinetux.py index b770a215..303616d2 100644 --- a/plugin.video.alfa/channels/cinetux.py +++ b/plugin.video.alfa/channels/cinetux.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -import re from channels import autoplay from channels import filtertools from core import httptools @@ -176,11 +175,11 @@ def destacadas(item): item.text_color = color2 data = httptools.downloadpage(item.url).data bloque = scrapertools.find_single_match(data, 'peliculas_destacadas.*?class="letter_home"') - patron = '(?s)title="([^"]+)".*?' - patron += 'href="([^"]+)".*?' + patron = '(?s)href="([^"]+)".*?' + patron += 'alt="([^"]+)".*?' patron += 'src="([^"]+)' matches = scrapertools.find_multiple_matches(bloque, patron) - for scrapedtitle, scrapedurl, scrapedthumbnail in matches: + for scrapedurl, scrapedtitle, scrapedthumbnail in matches: scrapedurl = CHANNEL_HOST + scrapedurl itemlist.append(item.clone(action="findvideos", title=scrapedtitle, fulltitle=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, @@ -224,11 +223,12 @@ def findvideos(item): logger.info() itemlist=[] data = httptools.downloadpage(item.url).data - patron = 'class="title">.*?src.*?/>([^>]+).*?data-type="([^"]+).*?data-post="(\d+)".*?data-nume="(\d+)' - matches = re.compile(patron, re.DOTALL).findall(data) - #logger.info("Intel66") - #scrapertools.printMatches(matches) - for language, tp, pt, nm in matches: + patron = 'tooltipctx.*?data-type="([^"]+).*?' + patron += 'data-post="(\d+)".*?' + patron += 'data-nume="(\d+).*?' + patron += 'class="title">.*?src.*?/>([^<]+)' + matches = scrapertools.find_multiple_matches(data, patron) + for tp, pt, nm, language in matches: language = language.strip() post = {'action':'doo_player_ajax', 'post':pt, 'nume':nm, 'type':tp} post = urllib.urlencode(post) @@ -242,17 +242,12 @@ def findvideos(item): else: title = '' url = scrapertools.find_single_match(new_data, "src='([^']+)'") - #logger.info("Intel33 %s" %url) - url = get_url(url) - if "mega" not in url and "mediafire" not in url: + url = get_url(url.replace('\\/', '/')) + if url: itemlist.append(Item(channel=item.channel, title ='%s'+title, url=url, action='play', quality=item.quality, language=IDIOMAS[language], infoLabels=item.infoLabels)) - #logger.info("Intel44") - #scrapertools.printMatches(itemlist) patron = "([^<]+)<" - matches = re.compile(patron, re.DOTALL).findall(data) - #logger.info("Intel66a") - #scrapertools.printMatches(matches) + matches = scrapertools.find_multiple_matches(data, patron) for hidden_url, quality, language in matches: if not config.get_setting('unify'): title = ' [%s][%s]' % (quality, IDIOMAS[language]) @@ -260,27 +255,32 @@ def findvideos(item): title = '' new_data = httptools.downloadpage(hidden_url).data url = scrapertools.find_single_match(new_data, 'id="link" href="([^"]+)"') - url = url.replace('\\/', '/') - url = get_url(url) - if "mega" not in url and "mediafire" not in url: + url = get_url(url.replace('\\/', '/')) + if url: itemlist.append(Item(channel=item.channel, title='%s'+title, url=url, action='play', quality=quality, language=IDIOMAS[language], infoLabels=item.infoLabels)) - #logger.info("Intel55") - #scrapertools.printMatches(itemlist) itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize()) + itemlist.sort(key=lambda it: (it.language, it.server, it.quality)) + tmdb.set_infoLabels(itemlist, __modo_grafico__) return itemlist def get_url(url): + logger.info() if "cinetux.me" in url: d1 = httptools.downloadpage(url).data - if "mail" in url: - id = scrapertools.find_single_match(d1, ' 0 and item.contentType=="movie" and item.contentChannel!='videolibrary': diff --git a/plugin.video.alfa/channels/planetadocumental.json b/plugin.video.alfa/channels/planetadocumental.json deleted file mode 100644 index ecc6eef7..00000000 --- a/plugin.video.alfa/channels/planetadocumental.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "id": "planetadocumental", - "name": "Planeta documental", - "language": ["*"], - "active": true, - "adult": false, - "thumbnail": "https://s8.postimg.cc/r6njedwdt/planeta_documental1.png", - "banner": "https://s8.postimg.cc/6za3m36m9/planeta_documental2.png", - "categories": [ - "documentary" - ], - "settings": [ - { - "id": "include_in_global_search", - "type": "bool", - "label": "Incluir en busqueda global", - "default": true, - "enabled": true, - "visible": true - } - ] -} diff --git a/plugin.video.alfa/channels/planetadocumental.py b/plugin.video.alfa/channels/planetadocumental.py deleted file mode 100644 index 52f973ae..00000000 --- a/plugin.video.alfa/channels/planetadocumental.py +++ /dev/null @@ -1,142 +0,0 @@ -# -*- coding: utf-8 -*- -# -*- Channel Planeta Documental -*- -# -*- Created for Alfa-addon -*- -# -*- By the Alfa Develop Group -*- - -from core import httptools -from core import jsontools -from core import scrapertools -from core import servertools -from core import tmdb -from core.item import Item -from channelselector import get_thumb -from platformcode import config, logger -from channels import autoplay -from channels import filtertools - - -IDIOMAS = {"Latino": "LAT"} -list_language = IDIOMAS.values() - -list_quality = [] - -list_servers = ['gvideo'] - -host = "https://www.planetadocumental.com" - -def mainlist(item): - logger.info() - itemlist = [] - autoplay.init(item.channel, list_servers, list_quality) - itemlist.append(item.clone(title="Últimos documentales", action="lista", - url= host, - thumbnail=get_thumb('lastest', auto=True))) - itemlist.append(item.clone(title="Por genero", action="generos", - url= host, thumbnail=get_thumb('genres', auto=True))) - itemlist.append(item.clone(title="", action="")) - itemlist.append(item.clone(title="Buscar...", action="search", thumbnail=get_thumb('search', auto=True))) - - return itemlist - - - -def generos(item): - logger.info() - itemlist = [] - data = httptools.downloadpage(item.url).data - bloque = scrapertools.find_single_match(data, 'sub-menu elementor-nav-menu--dropdown(.*?)/search[^\"']+).*?>(?P[^<>]+).*?badge[^>]+>(?P\d+)", data, re.DOTALL | re.MULTILINE) for url, name, counter in categories: result.append(item.clone(action = "links", title = "%s (%s videos)" % (name, counter), url = urljoin(item.url, url))) - return result + def get_page(url): page = re.search("p=(\d+)", url) if page: return int(page.group(1)) return 1 + def get_page_url(url, page): logger.debug("URL: %s to page %d" % (url, page)) resultURL = re.sub("([&\?]p=)(?:\d+)", "\g<1>%d" % page, url) if resultURL == url: resultURL += ("&" if "?" in url else "?") + "p=%d" % (page) - logger.debug("Result: %s" % (resultURL)) return resultURL @@ -64,21 +62,15 @@ def get_page_url(url, page): def links(item): logger.info() data = httptools.downloadpage(item.url).data - reExpr = "[^'\"]+)[^>]+(?:title|alt)[^'\"]*['\"](?P[^\"]+)[^>]+id[^'\"]*['\"](?P<id>[^'\"]+)[^>]*>(?:[^<]*<[^>]+>(?P<quality>[^<]+)<)?[^<]*<[^>]*duration[^>]*>(?P<duration>[^<]+)" reResults = re.findall(reExpr, data, re.MULTILINE | re.DOTALL) result = [] - for img, title, vID, quality, duration in reResults: - logger.info("[link] %(title)s [%(quality)s] [%(duration)s]: %(vid)s (%(img)s" % ({"title": title, "duration": duration, "vid": vID, "img": img, "quality": quality if quality else "--"})) - formattedQuality = "" if quality: formattedQuality += " [%s]" % (quality) - titleFormatted = "%(title)s%(quality)s [%(duration)s]" % ({"title": title, "quality": formattedQuality, "duration": duration}) result.append(item.clone(action = "play", title = titleFormatted, url = urljoin(item.url, "/view/%s" % (vID)), thumbnail = urljoin(item.url, img), vID = vID)) - # Has pagination paginationOccurences = data.count('class="prevnext"') if paginationOccurences: @@ -86,13 +78,11 @@ def links(item): logger.info("Page " + str(page) + " Ocurrences: " + str(paginationOccurences)) if page > 1: result.append(item.clone(action = "links", title = "<< Anterior", url = get_page_url(item.url, page - 1))) - if paginationOccurences > 1 or page == 1: result.append(item.clone(action = "links", title = "Siguiente >>", url = get_page_url(item.url, page + 1))) - - return result + def play(item): logger.info(item) embededURL = urljoin(item.url, "/view/%s" % (item.vID)) diff --git a/plugin.video.alfa/lib/unshortenit.py b/plugin.video.alfa/lib/unshortenit.py index 664e3bfe..9e12f629 100755 --- a/plugin.video.alfa/lib/unshortenit.py +++ b/plugin.video.alfa/lib/unshortenit.py @@ -26,7 +26,7 @@ def find_in_text(regex, text, flags=re.IGNORECASE | re.DOTALL): class UnshortenIt(object): - _adfly_regex = r'adf\.ly|j\.gs|q\.gs|u\.bb|ay\.gy|atominik\.com|tinyium\.com|microify\.com|threadsphere\.bid|clearload\.bid|activetect\.net' + _adfly_regex = r'adf\.ly|j\.gs|q\.gs|u\.bb|ay\.gy|atominik\.com|tinyium\.com|microify\.com|threadsphere\.bid|clearload\.bid|activetect\.net|swiftviz\.net' _linkbucks_regex = r'linkbucks\.com|any\.gs|cash4links\.co|cash4files\.co|dyo\.gs|filesonthe\.net|goneviral\.com|megaline\.co|miniurls\.co|qqc\.co|seriousdeals\.net|theseblogs\.com|theseforums\.com|tinylinks\.co|tubeviral\.com|ultrafiles\.net|urlbeat\.net|whackyvidz\.com|yyv\.co' _adfocus_regex = r'adfoc\.us' _lnxlu_regex = r'lnx\.lu' diff --git a/plugin.video.alfa/servers/bitp.py b/plugin.video.alfa/servers/bitp.py index 2070f04c..45d2a2f2 100644 --- a/plugin.video.alfa/servers/bitp.py +++ b/plugin.video.alfa/servers/bitp.py @@ -23,7 +23,7 @@ def get_video_url(page_url, user="", password="", video_password=""): logger.info("(page_url='%s')" % page_url) video_urls = [] data = httptools.downloadpage(page_url).data - videourl = scrapertools.find_multiple_matches(data, '<source src="(http[^"]+).*?data-res="([^"]+)') + videourl = scrapertools.find_multiple_matches(data, '<source src="(http[^"]+).*?title="([^"]+)') scrapertools.printMatches(videourl) for scrapedurl, scrapedquality in videourl: if "loadthumb" in scrapedurl: diff --git a/plugin.video.alfa/servers/dostream.py b/plugin.video.alfa/servers/dostream.py index 4d23a236..7184d286 100644 --- a/plugin.video.alfa/servers/dostream.py +++ b/plugin.video.alfa/servers/dostream.py @@ -3,33 +3,27 @@ # Conector DoStream By Alfa development Group # -------------------------------------------------------- -import re from core import httptools +from core import scrapertools from platformcode import logger def test_video_exists(page_url): logger.info("(page_url='%s')" % page_url) - data = httptools.downloadpage(page_url) - if data.code == 404: - return False, "[Dostream] El archivo no existe o ha sido borrado" - + return False, "[Dostream] El archivo no existe o ha sido borrado" return True, "" def get_video_url(page_url, premium=False, user="", password="", video_password=""): logger.info("url=" + page_url) - video_urls = [] - data = httptools.downloadpage(page_url).data - data = re.sub(r'"|\n|\r|\t| |<br>|\s{2,}', "", data) - logger.debug(data) - patron = "(?:'src'|'url'):'(http.*?)'" - matches = re.compile(patron, re.DOTALL).findall(data) - - for url in matches: - video_urls.append(['dostream',url]) - + data = httptools.downloadpage(page_url, headers={"Referer":page_url}).data + patron = '"label":"([^"]+)".*?' + patron += '"src":"(http.*?)".*?' + matches = scrapertools.find_multiple_matches(data, patron) + for label, url in matches: + video_urls.append(['%s [dostream]' %label, url]) + video_urls.sort(key=lambda it: int(it[0].split("p ")[0])) return video_urls diff --git a/plugin.video.alfa/servers/streamplay.json b/plugin.video.alfa/servers/streamplay.json index eec0fb52..22cf998a 100755 --- a/plugin.video.alfa/servers/streamplay.json +++ b/plugin.video.alfa/servers/streamplay.json @@ -4,7 +4,7 @@ "ignore_urls": [], "patterns": [ { - "pattern": "streamplay.to/(?:embed-|player-|)([a-z0-9]+)(?:.html|)", + "pattern": "streamplay.(?:to|me)/(?:embed-|player-|)([a-z0-9]+)(?:.html|)", "url": "http://streamplay.to/player-\\1.html" } ] From 86a4c16180ed48d97ffe04e492f6f5066101ea31 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Wed, 21 Nov 2018 10:35:40 -0500 Subject: [PATCH 2/8] unshortenit: actualizado --- plugin.video.alfa/lib/unshortenit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin.video.alfa/lib/unshortenit.py b/plugin.video.alfa/lib/unshortenit.py index 9e12f629..7c25e755 100755 --- a/plugin.video.alfa/lib/unshortenit.py +++ b/plugin.video.alfa/lib/unshortenit.py @@ -14,7 +14,7 @@ import urllib from base64 import b64decode from core import httptools -from platformcode import config +from platformcode import config, logger def find_in_text(regex, text, flags=re.IGNORECASE | re.DOTALL): @@ -355,7 +355,6 @@ class UnshortenIt(object): try: r = httptools.downloadpage(uri, timeout=self._timeout) html = r.data - session_id = re.findall(r'sessionId\:(.*?)\"\,', html) if len(session_id) > 0: session_id = re.sub(r'\s\"', '', session_id[0]) @@ -366,8 +365,9 @@ class UnshortenIt(object): http_header["Referer"] = uri http_header["Origin"] = "http://sh.st" http_header["X-Requested-With"] = "XMLHttpRequest" - + if config.is_xbmc(): + import xbmc xbmc.sleep(5 * 1000) else: time.sleep(5 * 1000) From 13ad03beca72914485d4b4d70de124689ce381ff Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Wed, 21 Nov 2018 10:43:01 -0500 Subject: [PATCH 3/8] cinecalidad y pelisplusco: fix --- plugin.video.alfa/channels/cinecalidad.py | 13 +++++++--- plugin.video.alfa/channels/pelisplusco.py | 29 +++++++++++++---------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/plugin.video.alfa/channels/cinecalidad.py b/plugin.video.alfa/channels/cinecalidad.py index 912048a7..ec18bc95 100644 --- a/plugin.video.alfa/channels/cinecalidad.py +++ b/plugin.video.alfa/channels/cinecalidad.py @@ -433,7 +433,14 @@ def newest(categoria): def search(item, texto): logger.info() + itemlist = [] texto = texto.replace(" ", "-") - item.url = item.host + '?s=' + texto - if texto != '': - return peliculas(item) + if item.host != '': + host_list = [item.host] + else: + host_list = ['http://www.cinecalidad.to', 'http://cinecalidad.to/espana/'] + for host_name in host_list: + item.url = host_name + '?s=' + texto + if texto != '': + itemlist.extend(peliculas(item)) + return itemlist \ No newline at end of file diff --git a/plugin.video.alfa/channels/pelisplusco.py b/plugin.video.alfa/channels/pelisplusco.py index 744de2ca..570a4082 100644 --- a/plugin.video.alfa/channels/pelisplusco.py +++ b/plugin.video.alfa/channels/pelisplusco.py @@ -143,10 +143,12 @@ def series_menu(item): return itemlist -def get_source(url): - +def get_source(url, referer=None): logger.info() - data = httptools.downloadpage(url).data + if referer is None: + data = httptools.downloadpage(url).data + else: + data = httptools.downloadpage(url, headers={'Referer':referer, 'x-requested-with': 'XMLHttpRequest'}).data data = re.sub(r'\n|\r|\t| |<br>|\s{2,}', "", data) return data @@ -173,7 +175,7 @@ def list_all (item): matches = scrapertools.find_multiple_matches(data, patron) for scrapedurl, scrapedthumbnail, scrapedyear, scrapedtitle in matches: - url = host+scrapedurl+'p001/' + url = host+scrapedurl thumbnail = scrapedthumbnail contentTitle=scrapedtitle title = contentTitle @@ -349,16 +351,15 @@ def season_episodes(item): def get_links_by_language(item, data): logger.info() - video_list = [] - language = scrapertools.find_single_match(data, 'ul id=level\d_(.*?)\s*class=') - patron = 'data-source=(.*?)data.*?srt=(.*?)data-iframe.*?Opci.*?<.*?hidden>[^\(]\((.*?)\)' + language = scrapertools.find_single_match(data, 'ul id="level\d_([^"]+)"\s*class=') + patron = 'data-source="([^"]+)"data-quality="([^"]+)"data-srt="([^"]+)"' matches = re.compile(patron, re.DOTALL).findall(data) if language in IDIOMAS: language = IDIOMAS[language] - for url, sub, quality in matches: + for url, quality, sub in matches: if 'http' not in url: new_url = 'https://onevideo.tv/api/player?key=90503e3de26d45e455b55e9dc54f015b3d1d4150&link' \ @@ -391,15 +392,19 @@ def findvideos(item): logger.info() itemlist = [] video_list = [] - data = httptools.downloadpage(item.url).data - data = re.sub(r'"|\n|\r|\t| |<br>|\s{2,}', "", data) + if item.contentType == 'movie': + new_url = new_url = item.url.replace('/pelicula/', '/player/%s/' % item.contentType) + else: + base_url = scrapertools.find_single_match(item.url, '(.*?)/temporada') + new_url = base_url.replace('/serie/', '/player/serie/') + new_url += '|%s|%s/' % (item.contentSeason, item.contentEpisodeNumber) + data = get_source(new_url, referer=item.url) - patron_language ='(<ul id=level\d_.*?\s*class=.*?ul>)' + patron_language ='(<ul id="level\d_.*?"*class=.*?ul>)' matches = re.compile(patron_language, re.DOTALL).findall(data) for language in matches: video_list.extend(get_links_by_language(item, language)) - video_list = servertools.get_servers_itemlist(video_list, lambda i: i.title % (i.server.capitalize(), i.language, i.quality) ) # Requerido para FilterTools From fc04c143ecc00953936f6226cbeb8e0c8936a416 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 21 Nov 2018 18:48:40 +0100 Subject: [PATCH 4/8] Newpct1: mejora en la disponibilidad --- plugin.video.alfa/channels/newpct1.py | 18 +++++++++++++---- plugin.video.alfa/channels/videolibrary.py | 3 --- plugin.video.alfa/lib/generictools.py | 23 ++++++++++++++-------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/plugin.video.alfa/channels/newpct1.py b/plugin.video.alfa/channels/newpct1.py index 1bdba2d3..e456b356 100644 --- a/plugin.video.alfa/channels/newpct1.py +++ b/plugin.video.alfa/channels/newpct1.py @@ -133,8 +133,11 @@ def mainlist(item): thumbnail=thumb_docus, category=item.category, channel_host=item.channel_host)) itemlist.append( Item(channel=item.channel, action="search", title="Buscar", url=item.channel_host + "buscar", thumbnail=thumb_buscar, category=item.category, channel_host=item.channel_host)) - - itemlist.append(Item(channel=item.channel, url=host, title="[COLOR yellow]Configuración:[/COLOR]", folder=False, thumbnail=thumb_separador, category=item.category, channel_host=item.channel_host)) + + clone_act = 'Clone: ' + if config.get_setting('clonenewpct1_channel_default', channel_py) == 0: + clone_act = 'Aleatorio: ' + itemlist.append(Item(channel=item.channel, url=host, title="[COLOR yellow]Configuración:[/COLOR] (" + clone_act + item.category + ")", folder=False, thumbnail=thumb_separador, category=item.category, channel_host=item.channel_host)) itemlist.append(Item(channel=item.channel, action="settingCanal", title="Configurar canal", thumbnail=thumb_settings, category=item.category, channel_host=item.channel_host)) @@ -243,9 +246,8 @@ def submenu_novedades(item): item.extra2 = '' #Renombramos el canal al nombre de clone inicial desde la URL - host = scrapertools.find_single_match(item.url, '(http.?\:\/\/(?:www.)?\w+\.\w+\/)') item.channel_host = host - item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize() + item.category = channel_clone_name.capitalize() data = '' timeout_search=timeout * 2 #Más tiempo para Novedades, que es una búsqueda @@ -2051,7 +2053,15 @@ def episodios(item): if match['episode'] is None: match['episode'] = "0" try: match['season'] = int(match['season']) + season_alt = match['season'] match['episode'] = int(match['episode']) + if match['season'] > max_temp: + logger.error("ERROR 07: EPISODIOS: Error en número de Temporada o Episodio: " + " / TEMPORADA/EPISODIO: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches)) + match['season'] = scrapertools.find_single_match(item_local.url, '\/[t|T]emp\w+-*(\d+)\/') + if not match['season']: + match['season'] = season_alt + else: + match['season'] = int(match['season']) except: logger.error("ERROR 07: EPISODIOS: Error en número de Temporada o Episodio: " + " / TEMPORADA/EPISODIO: " + str(match['season']) + " / " + str(match['episode']) + " / NUM_TEMPORADA: " + str(max_temp) + " / " + str(season) + " / MATCHES: " + str(matches)) diff --git a/plugin.video.alfa/channels/videolibrary.py b/plugin.video.alfa/channels/videolibrary.py index 1212ec4d..e2edd5c1 100644 --- a/plugin.video.alfa/channels/videolibrary.py +++ b/plugin.video.alfa/channels/videolibrary.py @@ -62,7 +62,6 @@ def list_movies(item, silent=False): for canal_org in new_item.library_urls: canal = generictools.verify_channel(canal_org) - logger.error(canal) try: channel_verify = __import__('channels.%s' % canal, fromlist=["channels.%s" % canal]) logger.debug('El canal %s parece correcto' % channel_verify) @@ -286,8 +285,6 @@ def list_tvshows(item): # logger.debug("item_tvshow:\n" + item_tvshow.tostring('\n')) ## verifica la existencia de los canales ## - - logger.debug(item_tvshow) if len(item_tvshow.library_urls) > 0: itemlist.append(item_tvshow) diff --git a/plugin.video.alfa/lib/generictools.py b/plugin.video.alfa/lib/generictools.py index 5647fb0d..eb549794 100644 --- a/plugin.video.alfa/lib/generictools.py +++ b/plugin.video.alfa/lib/generictools.py @@ -863,6 +863,7 @@ def post_tmdb_episodios(item, itemlist): #Componemos el título final, aunque con Unify usará infoLabels['episodio_titulo'] item_local.infoLabels['title'] = item_local.infoLabels['episodio_titulo'] + item_local.title = item_local.title.replace("[", "-").replace("]", "-") item_local.title = '%s [%s] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.title, item_local.infoLabels['year'], rating, item_local.quality, str(item_local.language)) #Quitamos campos vacíos @@ -871,7 +872,7 @@ def post_tmdb_episodios(item, itemlist): item_local.title = item_local.title.replace(" []", "").strip() item_local.title = re.sub(r'\s?\[COLOR \w+\]\[\[?-?\s?\]?\]\[\/COLOR\]', '', item_local.title).strip() item_local.title = re.sub(r'\s?\[COLOR \w+\]-?\s?\[\/COLOR\]', '', item_local.title).strip() - item_local.title = item_local.title.replace("[", "-").replace("]", "-").replace(".", ",").replace("GB", "G B").replace("Gb", "G b").replace("gb", "g b").replace("MB", "M B").replace("Mb", "M b").replace("mb", "m b") + item_local.title = item_local.title.replace(".", ",").replace("GB", "G B").replace("Gb", "G b").replace("gb", "g b").replace("MB", "M B").replace("Mb", "M b").replace("mb", "m b") #Si la información de num. total de episodios de TMDB no es correcta, tratamos de calcularla if num_episodios < item_local.contentEpisodeNumber: @@ -1161,7 +1162,8 @@ def post_tmdb_findvideos(item, itemlist): if item.channel_alt: title_gen = '[COLOR yellow]%s [/COLOR][ALT]: %s' % (item.category.capitalize(), title_gen) - elif (config.get_setting("quit_channel_name", "videolibrary") == 1 or item.channel == channel_py) and item.contentChannel == "videolibrary": + #elif (config.get_setting("quit_channel_name", "videolibrary") == 1 or item.channel == channel_py) and item.contentChannel == "videolibrary": + else: title_gen = '%s: %s' % (item.category.capitalize(), title_gen) #Si intervención judicial, alerto!!! @@ -1814,6 +1816,9 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F if item.channel_host: #y se borran resto de pasadas anteriores del item.channel_host + if it.emergency_urls: + item.emergency_urls = it.emergency_urls #Refrescar desde el .nfo + #Analizamos si hay series o películas que migrar, debido a que se ha activado en el .json del canal la opción "guardar" #"emergency_urls = 1", y hay que calcularla para todos los episodios y película existentes en la Videoteca. #Si "emergency_urls" está activada para uno o más canales, se verifica en el .nfo del vídeo si ya se ha realizado @@ -1824,10 +1829,7 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F #automáticamente. En el caso de peliculas, se general aquí el json actualizado y se marca el .nfo como actualizado. #Cuando en el .json se activa "Borrar", "emergency_urls = 2", se borran todos los enlaces existentes #Cuando en el .json se activa "Actualizar", "emergency_urls = 3", se actualizan todos los enlaces existentes - - if it.emergency_urls: - item.emergency_urls = it.emergency_urls #Refrescar desde el .nfo - + """ verify_cached_torrents() #TEMPORAL: verificamos si los .torrents son correctos try: #Si ha habido errores, vemos la lista y los reparamos json_error_path = filetools.join(config.get_runtime_path(), 'error_cached_torrents.json') @@ -1875,7 +1877,12 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F if not encontrado: logger.error('REGENERANDO: ' + str(item.emergency_urls)) item.emergency_urls.pop(channel_alt, None) - + except: + logger.error('Error en el proceso de RECARGA de URLs de Emergencia') + logger.error(traceback.format_exc()) + """ + + try: if item.url: #Viene de actualización de videoteca de series #Analizamos si el canal ya tiene las urls de emergencia: guardar o borrar if (config.get_setting("emergency_urls", item.channel) == 1 and (not item.emergency_urls or (item.emergency_urls and not item.emergency_urls.get(channel_alt, False)))) or (config.get_setting("emergency_urls", item.channel) == 2 and item.emergency_urls.get(channel_alt, False)) or config.get_setting("emergency_urls", item.channel) == 3 or emergency_urls_force: @@ -1894,7 +1901,7 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F except: logger.error('Error en el proceso de ALMACENAMIENTO de URLs de Emergencia') logger.error(traceback.format_exc()) - + #Ahora tratamos las webs intervenidas, tranformamos la url, el nfo y borramos los archivos obsoletos de la serie if channel not in intervencion and channel_py_alt not in intervencion and category not in intervencion and channel_alt != 'videolibrary': #lookup return (item, it, overwrite) #... el canal/clone está listado From eaa2339c1600cc78c5377e33f1c6f3612dd64013 Mon Sep 17 00:00:00 2001 From: Kingbox <37674310+lopezvg@users.noreply.github.com> Date: Wed, 21 Nov 2018 18:49:42 +0100 Subject: [PATCH 5/8] Enlaces de Emergencia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adaptación de canales: - Mejortorrent - Mejortorrent1 --- plugin.video.alfa/channels/mejortorrent.py | 106 ++++++++++++++---- plugin.video.alfa/channels/mejortorrent1.json | 22 ++++ plugin.video.alfa/channels/mejortorrent1.py | 89 +++++++++++---- plugin.video.alfa/core/videolibrarytools.py | 2 +- 4 files changed, 172 insertions(+), 47 deletions(-) diff --git a/plugin.video.alfa/channels/mejortorrent.py b/plugin.video.alfa/channels/mejortorrent.py index 722c559e..63e25330 100755 --- a/plugin.video.alfa/channels/mejortorrent.py +++ b/plugin.video.alfa/channels/mejortorrent.py @@ -265,8 +265,8 @@ def listado(item): del item.next_page #logger.debug(data) - logger.debug("PATRON1: " + patron + " / ") - logger.debug(matches) + #logger.debug("PATRON1: " + patron + " / ") + #logger.debug(matches) # Primera pasada # En la primera pasada se obtiene una información básica del título a partir de la url @@ -360,8 +360,8 @@ def listado(item): cnt_pag += cnt_tot cnt_pag_num += 1 - logger.debug("PATRON2: " + patron_title) - logger.debug(matches) + #logger.debug("PATRON2: " + patron_title) + #logger.debug(matches) cnt = 0 for scrapedtitle, notused, scrapedinfo in matches: item_local = itemlist[cnt] #Vinculamos item_local con la entrada de la lista itemlist (más fácil de leer) @@ -763,6 +763,12 @@ def findvideos(item): itemlist_f = [] #Itemlist de enlaces filtrados if not item.language: item.language = ['CAST'] #Castellano por defecto + matches = [] + + #Si es un lookup para cargar las urls de emergencia en la Videoteca... + if item.videolibray_emergency_urls: + item.emergency_urls = [] + item.emergency_urls.append([]) #Reservamos el espacio para los .torrents locales #Bajamos los datos de la página data = '' @@ -775,24 +781,47 @@ def findvideos(item): data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data) patron = "<a href='(secciones.php\?sec\=descargas&ap=contar&tabla=[^']+)'" except: + pass + + if not data: logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + + if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia? + matches = item.emergency_urls[1] #Restauramos matches + item.armagedon = True #Marcamos la situación como catastrófica + else: + if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca... + return item #Devolvemos el Item de la llamada + else: + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - matches = re.compile(patron, re.DOTALL).findall(data) + if not item.armagedon: #Si es un proceso normal, seguimos + matches = re.compile(patron, re.DOTALL).findall(data) if not matches: item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada if item.intervencion: #Sí ha sido clausurada judicialmente item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error - return itemlist #Salimos - - logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) - itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + elif not item.armagedon: + logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log')) + + if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia? + matches = item.emergency_urls[1] #Restauramos matches + item.armagedon = True #Marcamos la situación como catastrófica + else: + if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca... + return item #Devolvemos el Item de la llamada + else: + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos #logger.debug(data) #logger.debug("PATRON: " + patron) #logger.debug(matches) + + #Si es un lookup para cargar las urls de emergencia en la Videoteca... + if item.videolibray_emergency_urls: + item.emergency_urls.append(matches) #Salvamnos matches... #Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) @@ -803,41 +832,69 @@ def findvideos(item): url = urlparse.urljoin(item.url, scrapedurl) # Localiza el .torrent en el siguiente link - if not item.post: # Si no es llamada con Post, hay que bajar un nivel más + if not item.post and not item.armagedon: # Si no es llamada con Post, hay que bajar un nivel más try: torrent_data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(url).data) - except: #error + except: #error + pass + + if not torrent_data: logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / URL: " + url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia? + if len(item.emergency_urls[0]): + item_local.url = item.emergency_urls[0][0] #Restauramos la primera url + item.armagedon = True #Marcamos la situación como catastrófica + else: + if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca... + return item #Devolvemos el Item de la llamada + else: + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + #logger.debug(torrent_data) - item_local.url = scrapertools.get_match(torrent_data, ">Pincha.*?<a href='(.*?\/uploads\/torrents\/\w+\/.*?\.torrent)'") - item_local.url = urlparse.urljoin(url, item_local.url) - else: + if not item.armagedon: + item_local.url = scrapertools.get_match(torrent_data, ">Pincha.*?<a href='(.*?\/uploads\/torrents\/\w+\/.*?\.torrent)'") + item_local.url = urlparse.urljoin(url, item_local.url) + + elif not item.armagedon: item_local.url = url # Ya teníamos el link desde el primer nivel (documentales) item_local.url = item_local.url.replace(" ", "%20") + + if item.armagedon and item.emergency_urls and not item.videolibray_emergency_urls: + if len(item.emergency_urls[0]): + item_local.url = item.emergency_urls[0][0] #Guardamos la primera url del .Torrent + if len(item.emergency_urls[0]) > 1: + del item.emergency_urls[0][0] + if not item.armagedon and item.emergency_urls and not item.videolibray_emergency_urls: + if len(item.emergency_urls[0]): + item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la primera url del .Torrent ALTERNATIVA + + if item.videolibray_emergency_urls: + item.emergency_urls[0].append(item_local.url) #Salvamnos la url... # Poner la calidad, si es necesario if not item_local.quality: if "hdtv" in item_local.url.lower() or "720p" in item_local.url.lower() or "1080p" in item_local.url.lower() or "4k" in item_local.url.lower(): item_local.quality = scrapertools.find_single_match(item_local.url, '.*?_([H|7|1|4].*?)\.torrent') item_local.quality = item_local.quality.replace("_", " ") + if item.armagedon: #Si es catastrófico, lo marcamos + item_local.quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % item_local.quality # Extrae la dimensión del vídeo size = scrapertools.find_single_match(item_local.url, '(\d{1,3},\d{1,2}?\w+)\.torrent') - size = size.upper().replace(".", ",").replace("G", " G ").replace("M", " M ") #sustituimos . por , porque Unify lo borra - if not size: + size = size.upper().replace(".", ",").replace("G", " G ").replace("M", " M ") #sustituimos . por , porque Unify lo borra + if not size and not item.armagedon: size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent if size: item_local.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía item_local.title = '%s [%s]' % (item_local.title, size) #Agregamos size al final del título item_local.quality = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.quality) #Quitamos size de calidad, si lo traía - item_local.quality = '%s [%s]' % (item.quality, size) #Agregamos size al final de calidad + item_local.quality = '%s [%s]' % (item.quality, size) #Agregamos size al final de calidad #Ahora pintamos el link del Torrent, si lo hay - if item_local.url: # Hay Torrent ? - item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language)) #Preparamos título de Torrent - + if item_local.url: # Hay Torrent ? + item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][Torrent][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.quality, str(item_local.language)) #Preparamos título de Torrent + #Preparamos título y calidad, quitamos etiquetas vacías item_local.title = re.sub(r'\s?\[COLOR \w+\]\[\[?\s?\]?\]\[\/COLOR\]', '', item_local.title) item_local.title = re.sub(r'\s?\[COLOR \w+\]\s?\[\/COLOR\]', '', item_local.title) @@ -858,6 +915,9 @@ def findvideos(item): #logger.debug("title=[" + item.title + "], torrent=[ " + item_local.url + " ], url=[ " + url + " ], post=[" + item.post + "], thumbnail=[ " + item.thumbnail + " ]" + " size: " + size) + if item.videolibray_emergency_urls: + return item + if len(itemlist_f) > 0: #Si hay entradas filtradas... itemlist.extend(itemlist_f) #Pintamos pantalla filtrada else: diff --git a/plugin.video.alfa/channels/mejortorrent1.json b/plugin.video.alfa/channels/mejortorrent1.json index c17a3407..c5d2aa2f 100644 --- a/plugin.video.alfa/channels/mejortorrent1.json +++ b/plugin.video.alfa/channels/mejortorrent1.json @@ -54,6 +54,28 @@ "VOSE" ] }, + { + "id": "emergency_urls", + "type": "list", + "label": "Se quieren guardar Enlaces de Emergencia por si se cae la Web?", + "default": 1, + "enabled": true, + "visible": true, + "lvalues": [ + "No", + "Guardar", + "Borrar", + "Actualizar" + ] + }, + { + "id": "emergency_urls_torrents", + "type": "bool", + "label": "Se quieren guardar Torrents de Emergencia por si se cae la Web?", + "default": true, + "enabled": true, + "visible": "!eq(-1,'No')" + }, { "id": "seleccionar_ult_temporadda_activa", "type": "bool", diff --git a/plugin.video.alfa/channels/mejortorrent1.py b/plugin.video.alfa/channels/mejortorrent1.py index 6814d79e..23062782 100644 --- a/plugin.video.alfa/channels/mejortorrent1.py +++ b/plugin.video.alfa/channels/mejortorrent1.py @@ -165,8 +165,8 @@ def listado(item): item.contentType = "movie" pag = False #No hay paginación elif (item.extra == "peliculas" or item.extra == "varios") and not item.tipo: #Desde Menú principal - patron = '<a href="([^"]+)">?<img src="([^"]+)"[^<]+<\/a>' - patron_enlace = '\/\/.*?\/(.*?)\/$' + patron = '<a href="([^"]+)"[^>]+>?<img src="([^"]+)"[^<]+<\/a>' + patron_enlace = '\/\/.*?\/(8.*?)\/$' patron_title = '<a href="[^"]+">([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?' item.action = "findvideos" item.contentType = "movie" @@ -184,7 +184,7 @@ def listado(item): pag = False cnt_tot = 10 # Se reduce el numero de items por página porque es un proceso pesado elif item.extra == "series" and not item.tipo: - patron = '<a href="([^"]+)">?<img src="([^"]+)"[^<]+<\/a>' + patron = '<a href="([^"]+)"[^>]+>?<img src="([^"]+)"[^<]+<\/a>' patron_enlace = '\/\/.*?\/(.*?)-[temporada]?\d+[-|x]' patron_title = '<a href="[^"]+">([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?' patron_title_ep = '\/\/.*?\/(.*?)-(\d{1,2})x(\d{1,2})(?:-al-\d{1,2}x\d{1,2})?-?(\d+p)?\/$' @@ -203,7 +203,7 @@ def listado(item): item.contentType = "tvshow" pag = False else: - patron = '<a href="([^"]+)">?<img src="([^"]+)"[^<]+<\/a>' + patron = '<a href="([^"]+)"[^>]+>?<img src="([^"]+)"[^<]+<\/a>' patron_enlace = '\/\/.*?\/(.*?)-[temporada]?\d+[-|x]' patron_title = '<a href="[^"]+">([^<]+)<\/a>(\s*<b>([^>]+)<\/b>)?' patron_title_ep = '\/\/.*?\/(.*?)-(\d{1,2})x(\d{1,2})(?:-al-\d{1,2}x\d{1,2})?-?(\d+p)?\/$' @@ -813,6 +813,7 @@ def findvideos(item): itemlist_f = [] #Itemlist de enlaces filtrados if not item.language: item.language = ['CAST'] #Castellano por defecto + matches = [] #logger.debug(item) @@ -823,6 +824,11 @@ def findvideos(item): #Llamamos al método para crear el título general del vídeo, con toda la información obtenida de TMDB item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) + #Si es un lookup para cargar las urls de emergencia en la Videoteca... + if item.videolibray_emergency_urls: + item.emergency_urls = [] + item.emergency_urls.append([]) #Reservamos el espacio para los .torrents locales + #Bajamos los datos de la página de todo menos de Documentales y Varios if not item.post: try: @@ -836,34 +842,54 @@ def findvideos(item): if not data: logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia? + matches = item.emergency_urls[1] #Restauramos matches + item.armagedon = True #Marcamos la situación como catastrófica + else: + if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca... + return item #Devolvemos el Item de la llamada + else: + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - matches = re.compile(patron, re.DOTALL).findall(data) + if not item.armagedon: #Si es un proceso normal, seguimos + matches = re.compile(patron, re.DOTALL).findall(data) if not matches: item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada if item.intervencion: #Sí ha sido clausurada judicialmente item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error - return itemlist #Salimos + else: + logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log')) - logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) - itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia? + matches = item.emergency_urls[1] #Restauramos matches + item.armagedon = True #Marcamos la situación como catastrófica + else: + if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca... + return item #Devolvemos el Item de la llamada + else: + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos #logger.debug("PATRON: " + patron) #logger.debug(matches) #logger.debug(data) - for scrapedurl, name1, value1, value2, name2 in matches: #Hacemos el FOR aunque solo habrá un item + #Si es un lookup para cargar las urls de emergencia en la Videoteca... + if item.videolibray_emergency_urls: + item.emergency_urls.append(matches) #Salvamnos matches... + + for scrapedurl, name1, value1, value2, name2 in matches: #Hacemos el FOR aunque solo habrá un item #Generamos una copia de Item para trabajar sobre ella item_local = item.clone() url = scrapedurl # Localiza el .torrent en el siguiente link con Post post = '%s=%s&%s=%s' % (name1, value1, name2, value2) - try: - torrent_data = httptools.downloadpage(url, post=post, headers=headers, follow_redirects=False) - except: #error - pass + if not item.armagedon: + try: + torrent_data = httptools.downloadpage(url, post=post, headers=headers, follow_redirects=False) + except: #error + pass else: #Viene de SERIES y DOCUMENTALES. Generamos una copia de Item para trabajar sobre ella @@ -874,19 +900,34 @@ def findvideos(item): except: pass - if not torrent_data: + if not torrent_data or not 'location' in torrent_data.headers or not torrent_data.headers['location']: item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada if item.intervencion: #Sí ha sido clausurada judicialmente item, itemlist = generictools.post_tmdb_findvideos(item, itemlist) #Llamamos al método para el pintado del error - return itemlist #Salimos + elif not item.armagedon: + logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / URL: " + url + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log')) - logger.error("ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web " + " / URL: " + url + " / DATA: " + data) - itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El archivo Torrent no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + if item.emergency_urls and not item.videolibray_emergency_urls: #Hay urls de emergencia? + item_local.url = item.emergency_urls[0][0] #Restauramos la url del .torrent + item.armagedon = True #Marcamos la situación como catastrófica + else: + if item.videolibray_emergency_urls: #Si es llamado desde creación de Videoteca... + return item #Devolvemos el Item de la llamada + else: + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos #Capturamos la url del .torrent desde el Header - item_local.url = torrent_data.headers['location'] if 'location' in torrent_data.headers else item.url_post - item_local.url = item_local.url.replace(" ", "%20") #Quitamos espacios + if not item.armagedon: + item_local.url = torrent_data.headers['location'] if 'location' in torrent_data.headers else item.url_post + item_local.url = item_local.url.replace(" ", "%20") #Quitamos espacios + if item.emergency_urls: + item_local.torrent_alt = item.emergency_urls[0][0] #Guardamos la url del .Torrent ALTERNATIVA + + #Si es un lookup para cargar las urls de emergencia en la Videoteca... + if item.videolibray_emergency_urls: + item.emergency_urls[0].append(item_local.url) #Salvamnos la url... + return item #... y nos vamos # Poner la calidad, si es necesario if not item_local.quality: @@ -896,6 +937,8 @@ def findvideos(item): elif "hdtv" in item_local.url.lower() or "720p" in item_local.url.lower() or "1080p" in item_local.url.lower() or "4k" in item_local.url.lower(): item_local.quality = scrapertools.find_single_match(item_local.url, '.*?_([H|7|1|4].*?)\.torrent') item_local.quality = item_local.quality.replace("_", " ") + if item.armagedon: #Si es catastrófico, lo marcamos + item_local.quality = '[/COLOR][COLOR hotpink][E] [COLOR limegreen]%s' % item_local.quality # Extrae el tamaño del vídeo if scrapertools.find_single_match(data, '<b>Tama.*?:<\/b>&\w+;\s?([^<]+B)<?'): @@ -903,7 +946,7 @@ def findvideos(item): else: size = scrapertools.find_single_match(item_local.url, '(\d{1,3},\d{1,2}?\w+)\.torrent') size = size.upper().replace(".", ",").replace("G", " G ").replace("M", " M ") #sustituimos . por , porque Unify lo borra - if not size: + if not size and not item.armagedon: size = generictools.get_torrent_size(item_local.url) #Buscamos el tamaño en el .torrent if size: item_local.title = re.sub('\s\[\d+,?\d*?\s\w[b|B]\]', '', item_local.title) #Quitamos size de título, si lo traía diff --git a/plugin.video.alfa/core/videolibrarytools.py b/plugin.video.alfa/core/videolibrarytools.py index a11c9674..b4964de2 100644 --- a/plugin.video.alfa/core/videolibrarytools.py +++ b/plugin.video.alfa/core/videolibrarytools.py @@ -801,7 +801,7 @@ def caching_torrents(url, torrents_path=None, timeout=10, lookup=False, data_tor torrents_path += '.torrent' #path para dejar el .torrent torrents_path_encode = filetools.encode(torrents_path) #encode utf-8 del path - if url.endswith(".rar"): #No es un archivo .torrent + if url.endswith(".rar") or url.startswith("magnet:"): #No es un archivo .torrent logger.error('No es un archivo Torrent: ' + url) torrents_path = '' if data_torrent: From 5a8be6902d887564099f8ece04e8ad25e7026371 Mon Sep 17 00:00:00 2001 From: Alfa <30527549+alfa-addon@users.noreply.github.com> Date: Thu, 22 Nov 2018 08:25:44 -0500 Subject: [PATCH 6/8] 2.7.14 --- plugin.video.alfa/addon.xml | 56 ++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/plugin.video.alfa/addon.xml b/plugin.video.alfa/addon.xml index 1c319169..be86f063 100755 --- a/plugin.video.alfa/addon.xml +++ b/plugin.video.alfa/addon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.alfa" name="Alfa" version="2.7.13" provider-name="Alfa Addon"> +<addon id="plugin.video.alfa" name="Alfa" version="2.7.14" provider-name="Alfa Addon"> <requires> <import addon="xbmc.python" version="2.1.0"/> <import addon="script.module.libtorrent" optional="true"/> @@ -19,15 +19,51 @@ </assets> <news>[B]Estos son los cambios para esta versión:[/B] [COLOR green][B]Arreglos[/B][/COLOR] - ¤ cinetux ¤ porntrex ¤ repelis - ¤ fembed ¤ uptobox ¤ vivo - ¤ seriesmetro ¤ DivxTotal ¤ EliteTorrent - ¤ EstrenosGo ¤ GranTorrent - - [COLOR green][B]Novedades[/B][/COLOR] - ¤ Pack canales +18 - - Agradecimientos a @paeznet por colaborar en ésta versión + ¤ cinetux ¤ danimados ¤ xms + ¤ bitp ¤ descargacineclasico ¤ dostream + ¤ cinecalidad ¤ pelisplus ¤ Mejortorrent + ¤ Mejortorrent1 ¤ Newpc1 + + </news> + <description lang="es">Navega con Kodi por páginas web para ver sus videos de manera fácil.</description> + <summary lang="en">Browse web pages using Kodi</summary> + <description lang="en">Browse web pages using Kodi, you can easily watch their video content.</description> + <disclaimer>[COLOR red]The owners and submitters to this addon do not host or distribute any of the content displayed by these addons nor do they have any affiliation with the content providers.[/COLOR]</disclaimer> + <platform>all</platform> + <license>GNU GPL v3</license> + <forum>foro</forum> + <website>web</website> + <email>my@email.com</email> + <source>https://github.com/alfa-addon/addon</source> + </extension> + <extension point="xbmc.service" library="videolibrary_service.py" start="login|startup"> + </extension> +</addon> +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<addon id="plugin.video.alfa" name="Alfa" version="2.7.14" provider-name="Alfa Addon"> + <requires> + <import addon="xbmc.python" version="2.1.0"/> + <import addon="script.module.libtorrent" optional="true"/> + </requires> + <extension point="xbmc.python.pluginsource" library="default.py"> + <provides>video</provides> + </extension> + <extension point="xbmc.addon.metadata"> + <summary lang="es">Navega con Kodi por páginas web.</summary> + <assets> + <icon>logo-cumple.png</icon> + <fanart>fanart.jpg</fanart> + <screenshot>resources/media/themes/ss/1.jpg</screenshot> + <screenshot>resources/media/themes/ss/2.jpg</screenshot> + <screenshot>resources/media/themes/ss/3.jpg</screenshot> + <screenshot>resources/media/themes/ss/4.jpg</screenshot> + </assets> + <news>[B]Estos son los cambios para esta versión:[/B] + [COLOR green][B]Arreglos[/B][/COLOR] + ¤ cinetux ¤ danimados ¤ xms + ¤ bitp ¤ descargacineclasico ¤ dostream + ¤ cinecalidad ¤ pelisplus ¤ Mejortorrent + ¤ Mejortorrent1 ¤ Newpc1 </news> <description lang="es">Navega con Kodi por páginas web para ver sus videos de manera fácil.</description> From a48dec32d740c0ecccfe99472b4de00876126742 Mon Sep 17 00:00:00 2001 From: Alfa <30527549+alfa-addon@users.noreply.github.com> Date: Thu, 22 Nov 2018 13:04:16 -0500 Subject: [PATCH 7/8] v2.7.14.1 --- plugin.video.alfa/addon.xml | 41 ------------------------------------- 1 file changed, 41 deletions(-) diff --git a/plugin.video.alfa/addon.xml b/plugin.video.alfa/addon.xml index be86f063..61b48f44 100755 --- a/plugin.video.alfa/addon.xml +++ b/plugin.video.alfa/addon.xml @@ -39,44 +39,3 @@ <extension point="xbmc.service" library="videolibrary_service.py" start="login|startup"> </extension> </addon> -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.alfa" name="Alfa" version="2.7.14" provider-name="Alfa Addon"> - <requires> - <import addon="xbmc.python" version="2.1.0"/> - <import addon="script.module.libtorrent" optional="true"/> - </requires> - <extension point="xbmc.python.pluginsource" library="default.py"> - <provides>video</provides> - </extension> - <extension point="xbmc.addon.metadata"> - <summary lang="es">Navega con Kodi por páginas web.</summary> - <assets> - <icon>logo-cumple.png</icon> - <fanart>fanart.jpg</fanart> - <screenshot>resources/media/themes/ss/1.jpg</screenshot> - <screenshot>resources/media/themes/ss/2.jpg</screenshot> - <screenshot>resources/media/themes/ss/3.jpg</screenshot> - <screenshot>resources/media/themes/ss/4.jpg</screenshot> - </assets> - <news>[B]Estos son los cambios para esta versión:[/B] - [COLOR green][B]Arreglos[/B][/COLOR] - ¤ cinetux ¤ danimados ¤ xms - ¤ bitp ¤ descargacineclasico ¤ dostream - ¤ cinecalidad ¤ pelisplus ¤ Mejortorrent - ¤ Mejortorrent1 ¤ Newpc1 - - </news> - <description lang="es">Navega con Kodi por páginas web para ver sus videos de manera fácil.</description> - <summary lang="en">Browse web pages using Kodi</summary> - <description lang="en">Browse web pages using Kodi, you can easily watch their video content.</description> - <disclaimer>[COLOR red]The owners and submitters to this addon do not host or distribute any of the content displayed by these addons nor do they have any affiliation with the content providers.[/COLOR]</disclaimer> - <platform>all</platform> - <license>GNU GPL v3</license> - <forum>foro</forum> - <website>web</website> - <email>my@email.com</email> - <source>https://github.com/alfa-addon/addon</source> - </extension> - <extension point="xbmc.service" library="videolibrary_service.py" start="login|startup"> - </extension> -</addon> From 97663563a4172334c7cdeaa2cbaf31c5a01a411b Mon Sep 17 00:00:00 2001 From: Alfa <30527549+alfa-addon@users.noreply.github.com> Date: Thu, 22 Nov 2018 13:10:27 -0500 Subject: [PATCH 8/8] v2.7.15 --- plugin.video.alfa/addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.video.alfa/addon.xml b/plugin.video.alfa/addon.xml index 61b48f44..2f0d41b5 100755 --- a/plugin.video.alfa/addon.xml +++ b/plugin.video.alfa/addon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.alfa" name="Alfa" version="2.7.14" provider-name="Alfa Addon"> +<addon id="plugin.video.alfa" name="Alfa" version="2.7.15" provider-name="Alfa Addon"> <requires> <import addon="xbmc.python" version="2.1.0"/> <import addon="script.module.libtorrent" optional="true"/>