diff --git a/plugin.video.alfa/addon.xml b/plugin.video.alfa/addon.xml index 8a212ebe..dde43615 100755 --- a/plugin.video.alfa/addon.xml +++ b/plugin.video.alfa/addon.xml @@ -1,5 +1,5 @@ - + @@ -19,17 +19,17 @@ [B]Estos son los cambios para esta versión:[/B] [COLOR green][B]Canales agregados y arreglos[/B][/COLOR] - ¤ allcalidad ¤ jkanime - ¤ miradetodo ¤ asialiveaction - ¤ pedropolis ¤ cinemahd - ¤ inkapelis ¤ pelisplusco - ¤ pelisr ¤ vepelis - ¤ ver-peliculas ¤ divxtotal - ¤ estrenosgo ¤ newpct1 - ¤ pelispedia + ¤ allcalidad ¤ cinecalidad + ¤ repelis ¤ cumlouder + ¤ porntrex ¤ crunchyroll + ¤ pedropolis ¤ pepecine + ¤ divxtotal ¤ elitetorrent + ¤ estrenosgo ¤ grantorrent + ¤ mejortorrent1 ¤ newpct1 + ¤ danimados ¤ fanpelis + ¤ repelis ¤ arreglos internos - - ¤ Agradecimientos a @angedam por colaborar en ésta versión + ¤ Agradecimientos a @angedam, @chivmalev, @alaquepasa por colaborar en ésta versión Navega con Kodi por páginas web para ver sus videos de manera fácil. diff --git a/plugin.video.alfa/channels/allcalidad.py b/plugin.video.alfa/channels/allcalidad.py index 0b629353..6c5930d8 100755 --- a/plugin.video.alfa/channels/allcalidad.py +++ b/plugin.video.alfa/channels/allcalidad.py @@ -34,12 +34,40 @@ def mainlist(item): itemlist.append(Item(channel = item.channel, title = "Novedades", action = "peliculas", url = host, thumbnail = get_thumb("newest", auto = True))) itemlist.append(Item(channel = item.channel, title = "Por género", action = "generos_years", url = host, extra = "Genero", thumbnail = get_thumb("genres", auto = True) )) itemlist.append(Item(channel = item.channel, title = "Por año", action = "generos_years", url = host, extra = ">Año<", thumbnail = get_thumb("year", auto = True))) - itemlist.append(Item(channel = item.channel, title = "Favoritas", action = "peliculas", url = host + "/favorites", thumbnail = get_thumb("favorites", auto = True) )) + itemlist.append(Item(channel = item.channel, title = "Favoritas", action = "favorites", url = host + "/favorites", thumbnail = get_thumb("favorites", auto = True) )) itemlist.append(Item(channel = item.channel, title = "")) itemlist.append(Item(channel = item.channel, title = "Buscar", action = "search", url = host + "?s=", thumbnail = get_thumb("search", auto = True))) autoplay.show_option(item.channel, itemlist) return itemlist +def favorites(item): + logger.info() + itemlist = [] + data = httptools.downloadpage(item.url).data + patron = '(?s)short_overlay.*?= 0: color1, color2, color3, color4, color5 = perfil[__perfil__ - 1] else: color1 = color2 = color3 = color4 = color5 = "" - host = "http://www.crunchyroll.com" proxy_u = "http://anonymouse.org/cgi-bin/anon-www.cgi/" proxy_e = "http://proxyanonimo.es/browse.php?u=" @@ -27,24 +26,20 @@ proxy_e = "http://proxyanonimo.es/browse.php?u=" def login(): logger.info() - langs = ['deDE', 'ptPT', 'frFR', 'itIT', 'enUS', 'esLA', 'esES'] lang = langs[config.get_setting("crunchyrollidioma", "crunchyroll")] - httptools.downloadpage("http://www.crunchyroll.com/ajax/", "req=RpcApiTranslation_SetLang&locale=%s" % lang) - - login_page = "https://www.crunchyroll.com/login" + httptools.downloadpage(host + "/ajax/", "req=RpcApiTranslation_SetLang&locale=%s" % lang) + login_page = host.replace("http","https") + "/login" user = config.get_setting("crunchyrolluser", "crunchyroll") password = config.get_setting("crunchyrollpassword", "crunchyroll") if not user or not password: return False, "", "" data = httptools.downloadpage(login_page).data - if not "Redirecting" in data: token = scrapertools.find_single_match(data, 'name="login_form\[_token\]" value="([^"]+)"') redirect_url = scrapertools.find_single_match(data, 'name="login_form\[redirect_url\]" value="([^"]+)"') post = "login_form%5Bname%5D=" + user + "&login_form%5Bpassword%5D=" + password + \ "&login_form%5Bredirect_url%5D=" + redirect_url + "&login_form%5B_token%5D=" + token - data = httptools.downloadpage(login_page, post).data if not "<title>Redirecting" in data: if "Usuario %s no disponible" % user in data: @@ -53,7 +48,6 @@ def login(): return False, "Es necesario resolver un captcha. Loguéate desde un navegador y vuelve a intentarlo", "" else: return False, "No se ha podido realizar el login.", "" - data = httptools.downloadpage(host).data premium = scrapertools.find_single_match(data, ',"premium_status":"([^"]+)"') premium = premium.replace("_", " ").replace("free trial", "Prueba Gratuita").capitalize() @@ -67,7 +61,6 @@ def mainlist(item): logger.info() itemlist = [] item.text_color = color1 - proxy_usa = config.get_setting("proxy_usa", "crunchyroll") proxy_spain = config.get_setting("proxy_spain", "crunchyroll") item.login = False @@ -82,14 +75,12 @@ def mainlist(item): httptools.downloadpage("http://proxyanonimo.es/") item.proxy = "spain" host = proxy_e + host - if not item.login and error_message: itemlist.append(item.clone(title=error_message, action="configuracion", folder=False, text_color=color4)) elif item.login: itemlist.append(item.clone(title="Tipo de cuenta: %s" % premium, action="", text_color=color4)) elif item.proxy: itemlist.append(item.clone(title="Usando proxy: %s" % item.proxy.capitalize(), action="", text_color=color4)) - itemlist.append(item.clone(title="Anime", action="", text_color=color2)) item.contentType = "tvshow" itemlist.append( @@ -104,39 +95,32 @@ def mainlist(item): itemlist.append( item.clone(title=" Popular", action="lista", url=host + "/videos/drama/popular/ajax_page?pg=0", page=0)) itemlist.append(item.clone(title=" Índice Alfabético", action="indices", - url="http://www.crunchyroll.com/videos/drama/alpha")) - + url=host + "/videos/drama/alpha")) if item.proxy != "usa": itemlist.append(item.clone(action="calendario", title="Calendario de Estrenos Anime", text_color=color4, url=host + "/simulcastcalendar")) itemlist.append(item.clone(title="Configuración del canal", action="configuracion", text_color="gold")) - return itemlist def configuracion(item): from platformcode import platformtools ret = platformtools.show_channel_settings() - user = config.get_setting("crunchyrolluser", "crunchyroll") password = config.get_setting("crunchyrollpassword", "crunchyroll") sub = config.get_setting("crunchyrollsub", "crunchyroll") - config.set_setting("crunchyrolluser", user) config.set_setting("crunchyrollpassword", password) values = [6, 5, 4, 3, 2, 1, 0] config.set_setting("crunchyrollsub", str(values[sub])) platformtools.itemlist_refresh() - return ret def lista(item): logger.info() itemlist = [] - data = httptools.downloadpage(item.url).data - next = item.url.replace("?pg=%s" % item.page, "?pg=%s" % str(item.page + 1)) data_next = httptools.downloadpage(next).data patron = '<li id="media_group_(\d+)".*?title="([^"]+)".*?href="([^"]+)".*?src="([^"]+)"' \ @@ -154,18 +138,15 @@ def lista(item): itemlist.append(item.clone(action="episodios", url=url, title=scrapedtitle, thumbnail=thumb, contentTitle=title, contentSerieName=title, infoLabels={'plot': plot}, text_color=color2)) - if '<li id="media_group' in data_next: itemlist.append(item.clone(action="lista", url=next, title=">> Página Siguiente", page=item.page + 1, text_color="")) - return itemlist def episodios(item): logger.info() itemlist = [] - data = httptools.downloadpage(item.url).data data = re.sub(r'\n|\t|\s{2,}', '', data) patron = '<li id="showview_videos.*?href="([^"]+)".*?(?:src|data-thumbnailUrl)="([^"]+)".*?media_id="([^"]+)"' \ @@ -215,12 +196,10 @@ def episodios(item): def indices(item): logger.info() itemlist = [] - if not item.url: - itemlist.append(item.clone(title="Alfabético", url="http://www.crunchyroll.com/videos/anime/alpha")) - itemlist.append(item.clone(title="Géneros", url="http://www.crunchyroll.com/videos/anime")) - itemlist.append(item.clone(title="Temporadas", url="http://www.crunchyroll.com/videos/anime")) - + itemlist.append(item.clone(title="Alfabético", url=host + "/videos/anime/alpha")) + itemlist.append(item.clone(title="Géneros", url=host + "/videos/anime")) + itemlist.append(item.clone(title="Temporadas", url=host + "/videos/anime")) else: data = httptools.downloadpage(item.url).data if "Alfabético" in item.title: @@ -235,7 +214,6 @@ def indices(item): url = proxy_u + host + url else: url = host + url - itemlist.append(item.clone(action="alpha", title=title, url=url, page=0)) elif "Temporadas" in item.title: bloque = scrapertools.find_single_match(data, @@ -249,7 +227,6 @@ def indices(item): url = proxy_u + host + url else: url = host + url - itemlist.append(item.clone(action="lista", title=title, url=url, page=0)) else: bloque = scrapertools.find_single_match(data, '<div class="genre-selectors selectors">(.*?)</div>') @@ -260,18 +237,14 @@ def indices(item): url = proxy_e + url.replace("&", "%26") elif item.proxy == "usa": url = proxy_u + url - itemlist.append(item.clone(action="lista", title=title, url=url, page=0)) - return itemlist def alpha(item): logger.info() itemlist = [] - data = httptools.downloadpage(item.url).data - patron = '<div class="wrapper hover-toggle-queue.*?title="([^"]+)".*?href="([^"]+)".*?src="([^"]+)"' \ '.*?<span class="series-data.*?>\s*([^<]+)</span>.*?<p.*?>(.*?)</p>' matches = scrapertools.find_multiple_matches(data, patron) @@ -285,16 +258,13 @@ def alpha(item): itemlist.append(item.clone(action="episodios", url=url, title=scrapedtitle, thumbnail=thumb, contentTitle=title, contentSerieName=title, infoLabels={'plot': plot}, text_color=color2)) - return itemlist def calendario(item): logger.info() itemlist = [] - data = httptools.downloadpage(item.url).data - patron = '<div class="specific-date">.*?datetime="\d+-(\d+)-(\d+).*?class="day-name">.*?>\s*([^<]+)</time>(.*?)</section>' bloques = scrapertools.find_multiple_matches(data, patron) for mes, dia, title, b in bloques: @@ -309,10 +279,8 @@ def calendario(item): subt = re.sub(r"\s{2,}", " ", subt) if "<time" in subt: subt = re.sub(r"<time.*?>", "", subt).replace("</time>", "") - scrapedtitle = " [%s] %s - %s" % (hora, scrapertools.htmlclean(title), subt) scrapedtitle = re.sub(r"\[email protected\]|\[email\xc2\xa0protected\]", "Idolm@ster", scrapedtitle) - if "Disponible" in scrapedtitle: if item.proxy == "spain": url = urllib.unquote(url.replace("/browse.php?u=", "").replace("&b=12", "")) @@ -329,7 +297,6 @@ def calendario(item): .replace("&b=12", "").replace("_large", "_full")) itemlist.append(item.clone(action=action, url=url, title=scrapedtitle, contentTitle=title, thumbnail=thumb, text_color=color2, contentSerieName=title, server=server)) - next = scrapertools.find_single_match(data, 'js-pagination-next"\s*href="([^"]+)"') if next: if item.proxy == "spain": @@ -344,7 +311,6 @@ def calendario(item): else: prev = host + prev itemlist.append(item.clone(action="calendario", url=prev, title="<< Semana Anterior")) - return itemlist @@ -353,6 +319,5 @@ def play(item): if item.login and not "[V]" in item.title: post = "cbelapsed=60&h=&media_id=%s" % item.media_id + "&req=RpcApiVideo_VideoView&cbcallcount=1&ht=0" \ "&media_type=1&video_encode_id=0&playhead=10000" - httptools.downloadpage("http://www.crunchyroll.com/ajax/", post) - + httptools.downloadpage(host + "/ajax/", post) return [item] diff --git a/plugin.video.alfa/channels/cumlouder.py b/plugin.video.alfa/channels/cumlouder.py old mode 100755 new mode 100644 index 76b13e79..81a26a7f --- a/plugin.video.alfa/channels/cumlouder.py +++ b/plugin.video.alfa/channels/cumlouder.py @@ -18,6 +18,7 @@ def mainlist(item): itemlist.append(item.clone(title="Últimos videos", action="videos", url="https://www.cumlouder.com/")) itemlist.append(item.clone(title="Categorias", action="categorias", url="https://www.cumlouder.com/categories/")) itemlist.append(item.clone(title="Pornstars", action="pornstars_list", url="https://www.cumlouder.com/girls/")) + itemlist.append(item.clone(title="Listas", action="series", url="https://www.cumlouder.com/series/")) itemlist.append(item.clone(title="Buscar", action="search", url="https://www.cumlouder.com/search?q=%s")) return itemlist @@ -82,10 +83,8 @@ def categorias(item): itemlist = [] data = get_data(item.url) - # logger.info("channels.cumlouder data="+data) - patron = '<a tag-url="[^"]+" class="[^"]+" href="([^"]+)" title="([^"]+)">[^<]+' - patron += '<img class="thumb" src="([^"]+)".*?<span class="cantidad">([^"]+)</span>' - + data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) + patron = '<a tag-url=.*?href="([^"]+)" title="([^"]+)".*?<img class="thumb" src="([^"]+)".*?<span class="cantidad">([^<]+)</span>' matches = re.compile(patron, re.DOTALL).findall(data) for url, title, thumbnail, count in matches: if "go.php?" in url: @@ -109,6 +108,28 @@ def categorias(item): return itemlist +def series(item): + logger.info() + itemlist = [] + + data = get_data(item.url) + data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) + patron = '<a onclick=.*?href="([^"]+)".*?\<img src="([^"]+)".*?h2 itemprop="name">([^<]+).*?p>([^<]+)</p>' + matches = re.compile(patron, re.DOTALL).findall(data) + for url, thumbnail, title, count in matches: + itemlist.append( + item.clone(title="%s (%s) " % (title, count), url=urlparse.urljoin(item.url, url), action="videos", thumbnail=thumbnail)) + + # Paginador + matches = re.compile('<li[^<]+<a href="([^"]+)" rel="nofollow">Next[^<]+</a[^<]+</li>', re.DOTALL).findall(data) + if matches: + if "go.php?" in matches[0]: + url = urllib.unquote(matches[0].split("/go.php?u=")[1].split("&")[0]) + else: + url = urlparse.urljoin(item.url, matches[0]) + itemlist.append(item.clone(title="Pagina Siguiente", url=url)) + + return itemlist def videos(item): logger.info() @@ -116,7 +137,6 @@ def videos(item): data = get_data(item.url) patron = '<a class="muestra-escena" href="([^"]+)" title="([^"]+)"[^<]+<img class="thumb" src="([^"]+)".*?<span class="minutos"> <span class="ico-minutos sprite"></span> ([^<]+)</span>' - matches = re.compile(patron, re.DOTALL).findall(data) for url, title, thumbnail, duration in matches: if "go.php?" in url: diff --git a/plugin.video.alfa/channels/danimados.py b/plugin.video.alfa/channels/danimados.py index a3df1ecb..32891a44 100644 --- a/plugin.video.alfa/channels/danimados.py +++ b/plugin.video.alfa/channels/danimados.py @@ -143,52 +143,27 @@ def episodios(item): def findvideos(item): logger.info() + import base64 itemlist = [] data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) data1 = scrapertools.find_single_match(data, - '<div id="playex" .+?>(.+?)<\/nav><\/div><\/div>') - patron='src="(.+?)"' - itemla = scrapertools.find_multiple_matches(data1,patron) - if "favicons?domain" in itemla[0]: - method = 1 - data2=scrapertools.find_single_match(data, "var \$user_hashs = {(.+?)}") - patron='".+?":"(.+?)"' - itemla = scrapertools.find_multiple_matches(data2,patron) - else: - method = 0 - for i in range(len(itemla)): - if method==0: - url=itemla[i] - else: - import base64 - b=base64.b64decode(itemla[i]) - url=b.decode('utf8') - #verificar existencia del video (testing) - codigo=verificar_video(itemla[i]) - if codigo==200: - if "ok.ru" in url: - server='okru' - else: - server='' - if "youtube" in url: - server='youtube' - if "openload" in url: - server='openload' - if "google" in url: - server='gvideo' - if "rapidvideo" in url: - server='rapidvideo' - if "streamango" in url: - server='streamango' - if server!='': - title="Enlace encontrado en %s " % (server.capitalize()) - else: - title="NO DISPONIBLE" - if title!="NO DISPONIBLE": - itemlist.append(item.clone(title=title,url=url, action="play", server=server)) + '<div id="playex" .+?>(.+?)<\/nav>?\s<\/div><\/div>') + patron = "changeLink\('([^']+)'\)" + matches = re.compile(patron, re.DOTALL).findall(data1) + + for url64 in matches: + url =base64.b64decode(url64) + if 'danimados' in url: + new_data = httptools.downloadpage('https:'+url.replace('stream', 'stream_iframe')).data + url = scrapertools.find_single_match(new_data, '<source src="([^"]+)"') + + itemlist.append(item.clone(title='%s',url=url, action="play")) + + itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize()) + if config.get_videolibrary_support() and len(itemlist) > 0 and item.contentType=="movie" and item.contentChannel!='videolibrary': itemlist.append( item.clone(channel=item.channel, title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]', url=item.url, @@ -196,18 +171,3 @@ def findvideos(item): autoplay.start(itemlist, item) return itemlist - - -def verificar_video(url): - codigo=httptools.downloadpage(url).code - if codigo==200: - # Revise de otra forma - data=httptools.downloadpage(url).data - removed = scrapertools.find_single_match(data,'removed(.+)') - if len(removed) != 0: - codigo1=404 - else: - codigo1=200 - else: - codigo1=200 - return codigo1 diff --git a/plugin.video.alfa/channels/diskokosmiko.json b/plugin.video.alfa/channels/diskokosmiko.json new file mode 100644 index 00000000..0844956a --- /dev/null +++ b/plugin.video.alfa/channels/diskokosmiko.json @@ -0,0 +1,64 @@ +{ + "id": "diskokosmiko", + "name": "Diskokosmiko", + "language": ["cast", "lat"], + "active": true, + "adult": false, + "version": 1, + "thumbnail": "http://i.imgur.com/EjbfM7p.png?1", + "banner": "copiapop.png", + "categories": [ + "movie", + "tvshow" + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": false, + "enabled": true, + "visible": true + }, + { + "id": "diskokosmikouser", + "type": "text", + "color": "0xFFC52020", + "label": "Usuario Diskokosmiko", + "enabled": true, + "visible": true + }, + { + "id": "diskokosmikopassword", + "type": "text", + "color": "0xFFC52020", + "hidden": true, + "label": "Password Diskokosmiko", + "enabled": "!eq(-1,'')", + "visible": true + }, + { + "id": "adult_content", + "type": "bool", + "color": "0xFFd50b0b", + "label": "Mostrar contenido adulto en las búsquedas", + "default": false, + "enabled": true, + "visible": true + }, + { + "id": "perfil", + "type": "list", + "label": "Perfil de color", + "default": 3, + "enabled": true, + "visible": true, + "lvalues": [ + "Sin color", + "Perfil 3", + "Perfil 2", + "Perfil 1" + ] + } + ] +} \ No newline at end of file diff --git a/plugin.video.alfa/channels/diskokosmiko.py b/plugin.video.alfa/channels/diskokosmiko.py new file mode 100644 index 00000000..e73f9f48 --- /dev/null +++ b/plugin.video.alfa/channels/diskokosmiko.py @@ -0,0 +1,366 @@ +# -*- coding: utf-8 -*- + +import re +import threading +import urllib +import xbmc + +from core import downloadtools +from core import filetools +from core import httptools +from core import jsontools +from core import scrapertools +from core.item import Item +from platformcode import config, logger +from platformcode import platformtools + +__perfil__ = config.get_setting('perfil', "diskokosmiko") + +# Fijar perfil de color +perfil = [['0xFFFFE6CC', '0xFFFFCE9C', '0xFF994D00', '0xFFFE2E2E', '0xFF088A08'], + ['0xFFA5F6AF', '0xFF5FDA6D', '0xFF11811E', '0xFFFE2E2E', '0xFF088A08'], + ['0xFF58D3F7', '0xFF2E9AFE', '0xFF2E64FE', '0xFFFE2E2E', '0xFF088A08']] + +if __perfil__ - 1 >= 0: + color1, color2, color3, color4, color5 = perfil[__perfil__ - 1] +else: + color1 = color2 = color3 = color4 = color5 = "" + +adult_content = config.get_setting("adult_content", "diskokosmiko") + + +def login(pagina): + logger.info() + try: + dom = pagina.split(".")[0] + user = config.get_setting("%suser" %dom, "diskokosmiko") + password = config.get_setting("%spassword" %dom, "diskokosmiko") + if not user: + return False, "Para ver los enlaces de %s es necesario registrarse en %s" %(dom, pagina) + data = httptools.downloadpage("http://%s" % pagina).data + if re.search(r'(?i)%s' % user, data): + return True, "" + token = scrapertools.find_single_match(data, 'name="__RequestVerificationToken".*?value="([^"]+)"') + post = "__RequestVerificationToken=%s&UserName=%s&Password=%s" % (token, user, password) + headers = {'X-Requested-With': 'XMLHttpRequest'} + url_log = "http://%s/action/Account/Login" % pagina + data = httptools.downloadpage(url_log, post, headers).data + if "redirectUrl" in data: + logger.info("Login correcto") + return True, "" + else: + logger.error("Error en el login") + return False, "Nombre de usuario no válido. Comprueba tus credenciales" + except: + import traceback + logger.error(traceback.format_exc()) + return False, "Error durante el login. Comprueba tus credenciales" + + +def mainlist(item): + logger.info() + itemlist = [] + item.text_color = color1 + logueado, error_message = login("diskokosmiko.mx") + if not logueado: + itemlist.append(item.clone(title=error_message, action="configuracion", folder=False)) + else: + item.extra = "http://diskokosmiko.mx/" + itemlist.append(item.clone(title="DiskoKosmiko", action="", text_color=color2)) + itemlist.append(item.clone(title=" Búsqueda", action="search", url="http://diskokosmiko.mx/action/SearchFiles")) + itemlist.append(item.clone(title=" Colecciones", action="colecciones", + url="http://diskokosmiko.mx/action/home/MoreNewestCollections?pageNumber=1")) + itemlist.append(item.clone(title=" Búsqueda personalizada", action="filtro", + url="http://diskokosmiko.mx/action/SearchFiles")) + itemlist.append(item.clone(title=" Mi cuenta", action="cuenta")) + itemlist.append(item.clone(action="", title="")) + folder_thumb = filetools.join(config.get_data_path(), 'thumbs_disko') + files = filetools.listdir(folder_thumb) + if files: + itemlist.append( + item.clone(title="Eliminar caché de imágenes (%s)" % len(files), action="delete_cache", text_color="red")) + itemlist.append(item.clone(title="Configuración del canal", action="configuracion", text_color="gold")) + return itemlist + + +def search(item, texto): + logger.info() + item.post = "Mode=List&Type=Video&Phrase=%s&SizeFrom=0&SizeTo=0&Extension=&ref=pager&pageNumber=1" % texto.replace( + " ", "+") + try: + return listado(item) + except: + import sys, traceback + for line in sys.exc_info(): + logger.error("%s" % line) + logger.error(traceback.format_exc()) + return [] + + +def configuracion(item): + ret = platformtools.show_channel_settings() + platformtools.itemlist_refresh() + return ret + + +def listado(item): + logger.info() + itemlist = [] + data_thumb = httptools.downloadpage(item.url, item.post.replace("Mode=List", "Mode=Gallery")).data + if not item.post: + data_thumb = "" + item.url = item.url.replace("/gallery,", "/list,") + data = httptools.downloadpage(item.url, item.post).data + data = re.sub(r"\n|\r|\t|\s{2}| |<br>", "", data) + + folder = filetools.join(config.get_data_path(), 'thumbs_disko') + patron = 'data-file-id(.*?</p>)</div></div>' + bloques = scrapertools.find_multiple_matches(data, patron) + for block in bloques: + if "adult_info" in block and not adult_content: + continue + size = scrapertools.find_single_match(block, '<p.*?>([^<]+)</p>') + patron = 'class="name"><a href="([^"]+)".*?>([^<]+)<' + scrapedurl, scrapedtitle = scrapertools.find_single_match(block, patron) + scrapedthumbnail = scrapertools.find_single_match(block, "background-image:url\('([^']+)'") + if scrapedthumbnail: + try: + thumb = scrapedthumbnail.split("-", 1)[0].replace("?", "\?") + if data_thumb: + url_thumb = scrapertools.find_single_match(data_thumb, "(%s[^']+)'" % thumb) + else: + url_thumb = scrapedthumbnail + scrapedthumbnail = filetools.join(folder, "%s.jpg" % url_thumb.split("e=", 1)[1][-20:]) + except: + scrapedthumbnail = "" + if scrapedthumbnail: + t = threading.Thread(target=download_thumb, args=[scrapedthumbnail, url_thumb]) + t.setDaemon(True) + t.start() + else: + scrapedthumbnail = item.extra + "/img/file_types/gallery/movie.png" + scrapedurl = item.extra + scrapedurl + title = "%s (%s)" % (scrapedtitle, size) + if "adult_info" in block: + title += " [COLOR %s][+18][/COLOR]" % color4 + plot = scrapertools.find_single_match(block, '<div class="desc">(.*?)</div>') + if plot: + plot = scrapertools.decodeHtmlentities(plot) + new_item = Item(channel=item.channel, action="findvideos", title=title, url=scrapedurl, + thumbnail=scrapedthumbnail, contentTitle=scrapedtitle, text_color=color2, + extra=item.extra, infoLabels={'plot': plot}, post=item.post) + if item.post: + try: + new_item.folderurl, new_item.foldername = scrapertools.find_single_match(block, + '<p class="folder"><a href="([^"]+)".*?>([^<]+)<') + except: + pass + else: + new_item.folderurl = item.url.rsplit("/", 1)[0] + new_item.foldername = item.foldername + new_item.fanart = item.thumbnail + itemlist.append(new_item) + next_page = scrapertools.find_single_match(data, 'class="pageSplitter.*?" data-nextpage-number="([^"]+)"') + if next_page: + if item.post: + post = re.sub(r'pageNumber=(\d+)', "pageNumber=" + next_page, item.post) + url = item.url + else: + url = re.sub(r',\d+\?ref=pager', ",%s?ref=pager" % next_page, item.url) + post = "" + itemlist.append(Item(channel=item.channel, action="listado", title=">> Página Siguiente (%s)" % next_page, + url=url, post=post, extra=item.extra)) + return itemlist + + +def findvideos(item): + logger.info() + itemlist = [] + itemlist.append(item.clone(action="play", title="Reproducir/Descargar", server="diskokosmiko")) + usuario = scrapertools.find_single_match(item.url, '%s/([^/]+)/' % item.extra) + url_usuario = item.extra + "/" + usuario + if item.folderurl and not item.folderurl.startswith(item.extra): + item.folderurl = item.extra + item.folderurl + if item.post: + itemlist.append(item.clone(action="listado", title="Ver colección: %s" % item.foldername, + url=item.folderurl + "/gallery,1,1?ref=pager", post="")) + data = httptools.downloadpage(item.folderurl).data + token = scrapertools.find_single_match(data, + 'data-action="followChanged.*?name="__RequestVerificationToken".*?value="([^"]+)"') + collection_id = item.folderurl.rsplit("-", 1)[1] + post = "__RequestVerificationToken=%s&collectionId=%s" % (token, collection_id) + url = "%s/action/Follow/Follow" % item.extra + title = "Seguir Colección: %s" % item.foldername + if "dejar de seguir" in data: + title = "Dejar de seguir la colección: %s" % item.foldername + url = "%s/action/Follow/UnFollow" % item.extra + itemlist.append(item.clone(action="seguir", title=title, url=url, post=post, text_color=color5, folder=False)) + itemlist.append( + item.clone(action="colecciones", title="Ver colecciones del usuario: %s" % usuario, url=url_usuario)) + return itemlist + + +def colecciones(item): + logger.info() + itemlist = [] + usuario = False + data = httptools.downloadpage(item.url).data + if "Ver colecciones del usuario" not in item.title and not item.index: + data = jsontools.load(data)["Data"] + content = data["Content"] + content = re.sub(r"\n|\r|\t|\s{2}| |<br>", "", content) + else: + usuario = True + if item.follow: + content = scrapertools.find_single_match(data, + 'id="followed_collections"(.*?)<div id="recommended_collections"') + else: + content = scrapertools.find_single_match(data, + '<div id="collections".*?<div class="collections_list(.*?)<div class="collections_list') + content = re.sub(r"\n|\r|\t|\s{2}| |<br>", "", content) + patron = '<a class="name" href="([^"]+)".*?>([^<]+)<.*?src="([^"]+)".*?<p class="info">(.*?)</p>' + matches = scrapertools.find_multiple_matches(content, patron) + index = "" + if item.index and item.index != "0": + matches = matches[item.index:item.index + 20] + if len(matches) > item.index + 20: + index = item.index + 20 + elif len(matches) > 20: + matches = matches[:20] + index = 20 + folder = filetools.join(config.get_data_path(), 'thumbs_disko') + for url, scrapedtitle, thumb, info in matches: + url = item.extra + url + "/gallery,1,1?ref=pager" + title = "%s (%s)" % (scrapedtitle, scrapertools.htmlclean(info)) + try: + scrapedthumbnail = filetools.join(folder, "%s.jpg" % thumb.split("e=", 1)[1][-20:]) + except: + try: + scrapedthumbnail = filetools.join(folder, "%s.jpg" % thumb.split("/thumbnail/", 1)[1][-20:]) + thumb = thumb.replace("/thumbnail/", "/") + except: + scrapedthumbnail = "" + if scrapedthumbnail: + t = threading.Thread(target=download_thumb, args=[scrapedthumbnail, thumb]) + t.setDaemon(True) + t.start() + else: + scrapedthumbnail = thumb + + itemlist.append(Item(channel=item.channel, action="listado", title=title, url=url, + thumbnail=scrapedthumbnail, text_color=color2, extra=item.extra, + foldername=scrapedtitle)) + if not usuario and data.get("NextPageUrl"): + url = item.extra + data["NextPageUrl"] + itemlist.append(item.clone(title=">> Página Siguiente", url=url, text_color="")) + elif index: + itemlist.append(item.clone(title=">> Página Siguiente", url=item.url, index=index, text_color="")) + return itemlist + + +def seguir(item): + logger.info() + data = httptools.downloadpage(item.url, item.post) + message = "Colección seguida" + if "Dejar" in item.title: + message = "La colección ya no se sigue" + if data.sucess and config.get_platform() != "plex": + platformtools.dialog_notification("Acción correcta", message) + + +def cuenta(item): + logger.info() + itemlist = [] + if "diskokosmiko" in item.extra: + web = "diskokosmiko" + logueado, error_message = login("diskokosmiko.mx") + if not logueado: + itemlist.append(item.clone(title=error_message, action="configuracion", folder=False)) + return itemlist + user = config.get_setting("%suser" % web, "diskokosmiko") + user = unicode(user, "utf8").lower().encode("utf8") + url = item.extra + "/" + urllib.quote(user) + data = httptools.downloadpage(url).data + num_col = scrapertools.find_single_match(data, 'name="Has_collections" value="([^"]+)"') + if num_col != "0": + itemlist.append(item.clone(action="colecciones", url=url, index="0", title="Ver mis colecciones", + text_color=color5)) + else: + itemlist.append(item.clone(action="", title="No tienes ninguna colección", text_color=color4)) + + num_follow = scrapertools.find_single_match(data, 'name="Follows_collections" value="([^"]+)"') + if num_follow != "0": + itemlist.append(item.clone(action="colecciones", url=url, index="0", title="Colecciones que sigo", + text_color=color5, follow=True)) + else: + itemlist.append(item.clone(action="", title="No sigues ninguna colección", text_color=color4)) + return itemlist + + +def filtro(item): + logger.info() + list_controls = [] + valores = {} + dict_values = None + list_controls.append({'id': 'search', 'label': 'Texto a buscar', 'enabled': True, 'color': '0xFFC52020', + 'type': 'text', 'default': '', 'visible': True}) + list_controls.append({'id': 'tipo', 'label': 'Tipo de búsqueda', 'enabled': True, 'color': '0xFFFF8000', + 'type': 'list', 'default': -1, 'visible': True}) + list_controls[1]['lvalues'] = ['Aplicación', 'Archivo', 'Documento', 'Imagen', 'Música', 'Vídeo', 'Todos'] + valores['tipo'] = ['Application', 'Archive', 'Document', 'Image', 'Music', 'Video', ''] + list_controls.append({'id': 'ext', 'label': 'Extensión', 'enabled': True, 'color': '0xFFF4FA58', + 'type': 'text', 'default': '', 'visible': True}) + list_controls.append({'id': 'tmin', 'label': 'Tamaño mínimo (MB)', 'enabled': True, 'color': '0xFFCC2EFA', + 'type': 'text', 'default': '0', 'visible': True}) + list_controls.append({'id': 'tmax', 'label': 'Tamaño máximo (MB)', 'enabled': True, 'color': '0xFF2ECCFA', + 'type': 'text', 'default': '0', 'visible': True}) + # Se utilizan los valores por defecto/guardados + if "diskokosmiko" in item.extra: + web = "diskokosmiko" + valores_guardados = config.get_setting("filtro_defecto_" + web, item.channel) + if valores_guardados: + dict_values = valores_guardados + item.valores = valores + return platformtools.show_channel_settings(list_controls=list_controls, dict_values=dict_values, + caption="Filtra la búsqueda", item=item, callback='filtrado') + + +def filtrado(item, values): + values_copy = values.copy() + if "diskokosmiko" in item.extra: + web = "diskokosmiko" + # Guarda el filtro para que sea el que se cargue por defecto + config.set_setting("filtro_defecto_" + web, values_copy, item.channel) + tipo = item.valores["tipo"][values["tipo"]] + search = values["search"] + ext = values["ext"] + tmin = values["tmin"] + tmax = values["tmax"] + if not tmin.isdigit(): + tmin = "0" + if not tmax.isdigit(): + tmax = "0" + item.valores = "" + item.post = "Mode=List&Type=%s&Phrase=%s&SizeFrom=%s&SizeTo=%s&Extension=%s&ref=pager&pageNumber=1" \ + % (tipo, search, tmin, tmax, ext) + item.action = "listado" + return listado(item) + + +def download_thumb(filename, url): + lock = threading.Lock() + lock.acquire() + folder = filetools.join(config.get_data_path(), 'thumbs_disko') + if not filetools.exists(folder): + filetools.mkdir(folder) + lock.release() + if not filetools.exists(filename): + downloadtools.downloadfile(url, filename, silent=True) + return filename + + +def delete_cache(url): + folder = filetools.join(config.get_data_path(), 'thumbs_disko') + filetools.rmdirtree(folder) + if config.is_xbmc(): + xbmc.executebuiltin("Container.Refresh") diff --git a/plugin.video.alfa/channels/divxtotal.py b/plugin.video.alfa/channels/divxtotal.py index 8b3ca25e..8e1ba213 100644 --- a/plugin.video.alfa/channels/divxtotal.py +++ b/plugin.video.alfa/channels/divxtotal.py @@ -100,14 +100,14 @@ def categorias(item): if not data: #Si no ha logrado encontrar nada, salimos itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL. 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 + 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 matches: logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: SUBMENU: Ha cambiado la estructura de la Web. Reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos #logger.debug(item.url_plus) #logger.debug(matches) @@ -173,7 +173,7 @@ def listado(item): cnt_tot = 40 # Poner el num. máximo de items por página cnt_title = 0 # Contador de líneas insertadas en Itemlist - inicio = time.time() # Controlaremos que el proceso no exceda de un tiempo razonable + inicio = time.time() # Controlaremos que el proceso no exceda de un tiempo razonable fin = inicio + 10 # Después de este tiempo pintamos (segundos) timeout_search = timeout # Timeout para descargas if item.extra == 'search': @@ -182,8 +182,8 @@ def listado(item): timeout_search = 5 # Timeout un poco más largo para las búsquedas #Sistema de paginado para evitar páginas vacías o semi-vacías en casos de búsquedas con series con muchos episodios - title_lista = [] # Guarda la lista de series que ya están en Itemlist, para no duplicar lineas - if item.title_lista: # Si viene de una pasada anterior, la lista ya estará guardada + title_lista = [] # Guarda la lista de series que ya están en Itemlist, para no duplicar lineas + if item.title_lista: # Si viene de una pasada anterior, la lista ya estará guardada title_lista.extend(item.title_lista) # Se usa la lista de páginas anteriores en Item del item.title_lista # ... limpiamos @@ -206,7 +206,7 @@ def listado(item): if not data and not item.extra2: #Si la web está caída salimos sin dar error logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. 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 + break #si no hay más datos, algo no funciona, pintamos lo que tenemos #Patrón para todo, menos para Series completas, incluido búsquedas en cualquier caso patron = '<tr><td(?: class="[^"]+")?><a href="([^"]+)".?title="([^"]+)".*?<\/a><\/td><td(?: class="[^"]+")?>(?:<a href="[^"]+">)?(.*?)(?:<\/a>)?<\/td><td(?: class="[^"]+")?>.*?<\/td><td(?: class="[^"]+")?>(.*?)<\/td><\/tr>' @@ -224,7 +224,7 @@ def listado(item): logger.error("ERROR 02: LISTADO: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: LISTADO: Ha cambiado la estructura de la Web. Reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + break #si no hay más datos, algo no funciona, pintamos lo que tenemos #logger.debug("PATRON: " + patron) #logger.debug(matches) @@ -547,7 +547,7 @@ def episodios(item): itemlist = [] item.category = categoria - logger.debug(item) + #logger.debug(item) if item.from_title: item.title = item.from_title @@ -616,8 +616,8 @@ def episodios(item): itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos - logger.debug("PATRON: " + patron) - logger.debug(matches) + #logger.debug("PATRON: " + patron) + #logger.debug(matches) #logger.debug(data) season = max_temp diff --git a/plugin.video.alfa/channels/dospelis.json b/plugin.video.alfa/channels/dospelis.json index 9a9dc8d9..13130b10 100644 --- a/plugin.video.alfa/channels/dospelis.json +++ b/plugin.video.alfa/channels/dospelis.json @@ -3,7 +3,7 @@ "name": "DosPelis", "active": true, "adult": false, - "language": ["lat", "cast", "vose"], + "language": ["lat", "cast"], "thumbnail": "https://www.dospelis.com/wp-content/uploads/2018/07/dospelislogo.png", "banner": "", "categories": [ diff --git a/plugin.video.alfa/channels/elitetorrent.json b/plugin.video.alfa/channels/elitetorrent.json index 72705725..ec17889b 100644 --- a/plugin.video.alfa/channels/elitetorrent.json +++ b/plugin.video.alfa/channels/elitetorrent.json @@ -3,7 +3,7 @@ "name": "Elite Torrent", "active": true, "adult": false, - "language": ["*"], + "language": ["cast", "lat"], "thumbnail": "elitetorrent.png", "banner": "elitetorrent.png", "categories": [ diff --git a/plugin.video.alfa/channels/elitetorrent.py b/plugin.video.alfa/channels/elitetorrent.py index 0faf759c..6842c037 100644 --- a/plugin.video.alfa/channels/elitetorrent.py +++ b/plugin.video.alfa/channels/elitetorrent.py @@ -49,14 +49,14 @@ def submenu(item): if not data: logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) - return itemlist #Algo no funciona, pintamos lo que tenemos + return itemlist #Algo no funciona, pintamos lo que tenemos - patron = '<div class="cab_menu">.*?<\/div>' #Menú principal + patron = '<div class="cab_menu">.*?<\/div>' #Menú principal data1 = scrapertools.get_match(data, patron) - patron = '<div id="menu_langen">.*?<\/div>' #Menú de idiomas + patron = '<div id="menu_langen">.*?<\/div>' #Menú de idiomas data1 += scrapertools.get_match(data, patron) - patron = '<a href="(.*?)".*?title="(.*?)"' #Encontrar todos los apartados + patron = '<a href="(.*?)".*?title="(.*?)"' #Encontrar todos los apartados matches = re.compile(patron, re.DOTALL).findall(data1) if not matches: item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada @@ -68,25 +68,25 @@ def submenu(item): logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data1) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: SUBMENU: Ha cambiado la estructura de la Web. Reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos for scrapedurl, scrapedtitle in matches: scrapedtitle = re.sub('\r\n', '', scrapedtitle).decode('utf8').strip() scrapedtitle = scrapedtitle.replace(" torrent", "").replace(" Torrent", "").replace("Series y ", "").title() - if "castellano" in scrapedtitle.lower(): #Evita la entrada de peliculas castellano del menú de idiomas + if "castellano" in scrapedtitle.lower(): #Evita la entrada de peliculas castellano del menú de idiomas continue - if item.extra == "series": #Tratamos Series + if item.extra == "series": #Tratamos Series if not "/serie" in scrapedurl: continue - else: #Tratamos Películas + else: #Tratamos Películas if "/serie" in scrapedurl: continue itemlist.append(item.clone(action="listado", title=scrapedtitle, url=scrapedurl)) - if item.extra == "series": #Añadimos Series VOSE que está fuera del menú principal + if item.extra == "series": #Añadimos Series VOSE que está fuera del menú principal itemlist.append(item.clone(action="listado", title="Series VOSE", url=host + "/series-vose/")) return itemlist @@ -103,24 +103,24 @@ def listado(item): except: pass - if not data: #Si la web está caída salimos sin dar error + if not data: #Si la web está caída salimos sin dar error logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. 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 + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos patron = '<div id="principal">.*?<\/nav><\/div><\/div>' data = scrapertools.find_single_match(data, patron) - patron = '<li>.*?<a href="(.*?)".*?' #url - patron += 'title="(.*?)".*?' #título - patron += 'src="(.*?)".*?' #thumb - patron += "title='(.*?)'.*?" #categoría, idioma - patron += '"><i>(.*?)<\/i><\/span.*?' #calidad - patron += '="dig1">(.*?)<.*?' #tamaño - patron += '="dig2">(.*?)<\/span><\/div>' #tipo tamaño + patron = '<li>.*?<a href="(.*?)".*?' #url + patron += 'title="(.*?)".*?' #título + patron += 'src="(.*?)".*?' #thumb + patron += "title='(.*?)'.*?" #categoría, idioma + patron += '"><i>(.*?)<\/i><\/span.*?' #calidad + patron += '="dig1">(.*?)<.*?' #tamaño + patron += '="dig2">(.*?)<\/span><\/div>' #tipo tamaño matches = re.compile(patron, re.DOTALL).findall(data) - if not matches and not '<title>503 Backend fetch failed' in data: #error + if not matches and not '503 Backend fetch failed' in data: #error 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_listado(item, itemlist) #Llamamos al método para el pintado del error @@ -128,21 +128,21 @@ def listado(item): logger.error("ERROR 02: LISTADO: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: LISTADO: Ha cambiado la estructura de la Web. Reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + 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, scrapedtitle, scrapedthumbnail, scrapedcategory, scrapedcalidad, scrapedsize, scrapedsizet in matches: - item_local = item.clone() #Creamos copia de Item para trabajar + item_local = item.clone() #Creamos copia de Item para trabajar title = re.sub('\r\n', '', scrapedtitle).decode('utf8').strip() title = title.replace(" torrent", "").replace(" Torrent", "").replace("Series y ", "") item_local.url = urlparse.urljoin(host, scrapedurl) item_local.thumbnail = urlparse.urljoin(host, scrapedthumbnail) - if "---" in scrapedcalidad: #limpiamos calidades + if "---" in scrapedcalidad: #limpiamos calidades scrapedcalidad = '' if "microhd" in title.lower(): item_local.quality = "microHD" @@ -158,7 +158,7 @@ def listado(item): else: item_local.quality += ' [%s %s]' % (scrapedsize.replace(".", ","), scrapedsizet) - item_local.language = [] #Verificamos el idioma por si encontramos algo + item_local.language = [] #Verificamos el idioma por si encontramos algo if "latino" in scrapedcategory.lower() or "latino" in item.url or "latino" in title.lower(): item_local.language += ["LAT"] if "ingles" in scrapedcategory.lower() or "ingles" in item.url or "vose" in scrapedurl or "vose" in item.url: @@ -175,7 +175,7 @@ def listado(item): title = re.sub(r'\??\s?\d*?\&.*', '', title).title().strip() item_local.from_title = title #Guardamos esta etiqueta para posible desambiguación de título - if item_local.extra == "peliculas": #preparamos Item para películas + if item_local.extra == "peliculas": #preparamos Item para películas if "/serie" in scrapedurl or "/serie" in item.url: continue if not "/serie" in scrapedurl and not "/serie" in item.url: @@ -183,7 +183,7 @@ def listado(item): item_local.contentTitle = title item_local.extra = "peliculas" - if item_local.extra == "series": #preparamos Item para series + if item_local.extra == "series": #preparamos Item para series if not "/serie" in scrapedurl and not "/serie" in item.url: continue if "/serie" in scrapedurl or "/serie" in item.url: @@ -202,7 +202,7 @@ def listado(item): item_local.contentEpisodeNumber = 1 item_local.contentSerieName = title if epi_mult: - title = "%sx%s al %s -" % (item_local.contentSeason, str(item_local.contentEpisodeNumber).zfill(2), str(epi_mult).zfill(2)) #Creamos un título con el rango de episodios + title = "%sx%s al %s -" % (item_local.contentSeason, str(item_local.contentEpisodeNumber).zfill(2), str(epi_mult).zfill(2)) #Creamos un título con el rango de episodios else: title = '%sx%s ' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2)) @@ -214,7 +214,7 @@ def listado(item): if item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global, pasamos tmdb.set_infoLabels(item_local, True) - itemlist.append(item_local.clone()) #Pintar pantalla + itemlist.append(item_local.clone()) #Pintar pantalla #if not item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global # return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo @@ -227,12 +227,12 @@ def listado(item): # Extrae el paginador patron = '
.*?>": + if "Página siguiente >>" in itemlist[-1].title: itemlist.pop() # Se captura la excepción, para no interrumpir al canal novedades si un canal falla diff --git a/plugin.video.alfa/channels/estrenosgo.json b/plugin.video.alfa/channels/estrenosgo.json index 5e335051..bf922a70 100755 --- a/plugin.video.alfa/channels/estrenosgo.json +++ b/plugin.video.alfa/channels/estrenosgo.json @@ -3,7 +3,7 @@ "name": "EstrenosGo", "active": true, "adult": false, - "language": ["cast", "LAT", "VOSE", "VOS"], + "language": ["cast", "lat"], "fanart": "estrenosgo.png", "thumbnail": "estrenosgo.png", "banner": "estrenosgo.png", @@ -11,7 +11,8 @@ "movie", "tvshow", "torrent", - "direct" + "direct", + "vos" ], "settings": [ { diff --git a/plugin.video.alfa/channels/estrenosgo.py b/plugin.video.alfa/channels/estrenosgo.py index 4036f3af..72cfa220 100644 --- a/plugin.video.alfa/channels/estrenosgo.py +++ b/plugin.video.alfa/channels/estrenosgo.py @@ -113,7 +113,7 @@ def categorias(item): if not data: #Si no ha logrado encontrar nada, salimos itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL. 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 + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") matches = re.compile(patron, re.DOTALL).findall(data) @@ -121,7 +121,7 @@ def categorias(item): if not matches: logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: SUBMENU: Ha cambiado la estructura de la Web. Reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos #logger.debug(matches) @@ -182,7 +182,7 @@ def listado(item): cnt_tot = 40 # Poner el num. máximo de items por página cnt_title = 0 # Contador de líneas insertadas en Itemlist - inicio = time.time() # Controlaremos que el proceso no exceda de un tiempo razonable + inicio = time.time() # Controlaremos que el proceso no exceda de un tiempo razonable fin = inicio + 10 # Después de este tiempo pintamos (segundos) timeout_search = timeout # Timeout para descargas if item.extra == 'search': @@ -191,9 +191,9 @@ def listado(item): timeout_search = 5 # Timeout un poco más largo para las búsquedas #Sistema de paginado para evitar páginas vacías o semi-vacías en casos de búsquedas con series con muchos episodios - title_lista = [] # Guarda la lista de series que ya están en Itemlist, para no duplicar lineas - if item.title_lista: # Si viene de una pasada anterior, la lista ya estará guardada - title_lista.extend(item.title_lista) # Se usa la lista de páginas anteriores en Item + title_lista = [] # Guarda la lista de series que ya están en Itemlist, para no duplicar lineas + if item.title_lista: # Si viene de una pasada anterior, la lista ya estará guardada + title_lista.extend(item.title_lista) # Se usa la lista de páginas anteriores en Item del item.title_lista # ... limpiamos if not item.extra2: # Si viene de Catálogo o de Alfabeto @@ -215,7 +215,12 @@ def listado(item): if not data: #Si la web está caída salimos sin dar error logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + url + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. 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 len(itemlist) > 1: + #Pasamos a TMDB la lista completa Itemlist + tmdb.set_infoLabels(itemlist, __modo_grafico__) + #Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB + item, itemlist = generictools.post_tmdb_listado(item, itemlist) + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos #Patrón para todo menos para Series completas patron = '
' @@ -237,7 +242,12 @@ def listado(item): logger.error("ERROR 02: LISTADO: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: LISTADO: Ha cambiado la estructura de la Web. Reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + if len(itemlist) > 1: + #Pasamos a TMDB la lista completa Itemlist + tmdb.set_infoLabels(itemlist, __modo_grafico__) + #Llamamos al método para el maquillaje de los títulos obtenidos desde TMDB + item, itemlist = generictools.post_tmdb_listado(item, itemlist) + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos #logger.debug("PATRON: " + patron) #logger.debug(matches) @@ -253,9 +263,9 @@ def listado(item): except: last_page = 1 #Si no lo encuentra, lo ponemos a 1 - if item.extra == 'series': #Si son series completas, vamos a un listado especializado - item.matches = matches #salvamos todas las matches, no hay paginación - return listado_series(item) #llamamos a un método especializado + if item.extra == 'series': #Si son series completas, vamos a un listado especializado + item.matches = matches #salvamos todas las matches, no hay paginación + return listado_series(item) #llamamos a un método especializado #Empezamos el procesado de matches for scrapedurl, scrapedenlace, scrapedthumbnail, scrapedtitle, cat_ppal, cat_sec, opciones in matches: @@ -280,25 +290,25 @@ def listado(item): except: pass - if not data_serie: #Si la web está caída salimos sin dar error. Pintamos el episodio + if not data_serie: #Si la web está caída salimos sin dar error. Pintamos el episodio logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + scrapedurl + " / SERIE: " + cat_sec) else: patron_serie = '
.*?.*?<\/a>.*?' url = scrapertools.find_single_match(data_serie, patron_serie) #buscamos la url de la serie completa if url: url = host + url - extra = 'series' #es una serie completa - title_lista += [cat_sec] #la añadimos a la lista de series completas procesadas - title = cat_sec #salvamos el título de la serie completa + extra = 'series' #es una serie completa + title_lista += [cat_sec] #la añadimos a la lista de series completas procesadas + title = cat_sec #salvamos el título de la serie completa else: - url = scrapedurl #No se encuentra la Serie, se trata como Episodio suelto + url = scrapedurl #No se encuentra la Serie, se trata como Episodio suelto - elif "Archivo Torrent" not in scrapedenlace and "Video Online" not in scrapedenlace: #Si no tiene enlaces pasamos + elif "Archivo Torrent" not in scrapedenlace and "Video Online" not in scrapedenlace: #Si no tiene enlaces pasamos continue cnt_title += 1 - item_local = item.clone() #Creamos copia de Item para trabajar - if item_local.tipo: #... y limpiamos + item_local = item.clone() #Creamos copia de Item para trabajar + if item_local.tipo: #... y limpiamos del item_local.tipo if item_local.totalItems: del item_local.totalItems @@ -317,18 +327,18 @@ def listado(item): item_local.text_color = True del item_local.text_color - title_subs = [] #creamos una lista para guardar info importante - item_local.language = [] #creamos lista para los idiomas - item_local.quality = '' #iniciamos calidad + title_subs = [] #creamos una lista para guardar info importante + item_local.language = [] #creamos lista para los idiomas + item_local.quality = '' #iniciamos calidad quality_alt = '' - if 'series' not in cat_ppal: #si no son series, contiene la calidad + if 'series' not in cat_ppal: #si no son series, contiene la calidad quality_alt = cat_sec.lower().strip() - item_local.extra = extra #guardamos el extra procesado - item_local.url = url #guardamos la url final - item_local.thumbnail = host[:-1] + scrapedthumbnail #guardamos el thumb + item_local.extra = extra #guardamos el extra procesado + item_local.url = url #guardamos la url final + item_local.thumbnail = host[:-1] + scrapedthumbnail #guardamos el thumb item_local.context = "['buscar_trailer']" - item_local.contentType = "movie" #por defecto, son películas + item_local.contentType = "movie" #por defecto, son películas item_local.action = "findvideos" #Analizamos los formatos de la películas @@ -347,7 +357,7 @@ def listado(item): elif item_local.extra == 'series': item_local.contentType = "tvshow" item_local.action = "episodios" - item_local.season_colapse = True #Muestra las series agrupadas por temporadas + item_local.season_colapse = True #Muestra las series agrupadas por temporadas elif 'series' in cat_ppal or item_local.extra == 'episodios': item_local.contentType = "episode" item_local.extra = "episodios" @@ -361,7 +371,7 @@ def listado(item): item_local.contentType = "season" item_local.extra = "season" - if item_local.contentType == "movie": #para las peliculas ponemos el mismo extra + if item_local.contentType == "movie": #para las peliculas ponemos el mismo extra item_local.extra = "peliculas" #Detectamos idiomas @@ -495,13 +505,13 @@ def listado_series(item): #logger.debug(item) #Control de paginación - matches = item.matches #Restauramos la matches de la primera pasada + matches = item.matches #Restauramos la matches de la primera pasada del item.matches - matches_tot = len(matches) #La web no pagina las Series, lo tenemos que controlar - if item.matches_current: #Llevamos los contadores de cuánto hemos pintado y cuánto queda + matches_tot = len(matches) #La web no pagina las Series, lo tenemos que controlar + if item.matches_current: #Llevamos los contadores de cuánto hemos pintado y cuánto queda matches_current = item.matches_current if matches_tot >= matches_current + pag: - item.matches_current = matches_current + pag #Establecemos el bloque a pintar en este pasada + item.matches_current = matches_current + pag #Establecemos el bloque a pintar en este pasada else: item.matches_current = matches_tot @@ -566,8 +576,8 @@ def listado_series(item): #logger.debug(item_local) - #if not item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global - # return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo + #if not item.category: #Si este campo no existe es que viene de la primera pasada de una búsqueda global + # return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo #Pasamos a TMDB la lista completa Itemlist tmdb.set_infoLabels(itemlist, __modo_grafico__) @@ -607,7 +617,7 @@ def findvideos(item): if not data_torrent and not data_directo: logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea: " + item.url) 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 + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos patron = '
1 and (item.contentType == 'episode' or item.contentType == 'season'): itemlist_alt = sorted(itemlist_alt, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos - tmdb.set_infoLabels(itemlist_alt, True) #TMDB de la lista de episodios + tmdb.set_infoLabels(itemlist_alt, True) #TMDB de la lista de episodios itemlist.extend(itemlist_alt) #Ahora tratamos los servidores directo itemlist_alt = [] if matches_directo: - for scrapedurl, scrapedquality, scrapedlang in matches_directo: #leemos los torrents con la diferentes calidades + for scrapedurl, scrapedquality, scrapedlang in matches_directo: #leemos los torrents con la diferentes calidades #Generamos una copia de Item para trabajar sobre ella item_local = item.clone() - item_local.url = scrapedurl #Guardamos la url intermedia + item_local.url = scrapedurl #Guardamos la url intermedia item_local.quality = '' if scrapedquality: @@ -779,11 +789,11 @@ def findvideos(item): if not item_local.quality: item_local.quality = item.quality - elif scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])'): #Salvamos la duración + elif scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])'): #Salvamos la duración item_local.quality += ' [/COLOR][COLOR white]%s' % scrapertools.find_single_match(item.quality, '(\[\d+:\d+ h\])') #Copiamos duración if scrapedlang in IDIOMAS: - item_local.language = ["%s" % IDIOMAS[scrapedlang]] #Salvamos el idioma, si lo hay + item_local.language = ["%s" % IDIOMAS[scrapedlang]] #Salvamos el idioma, si lo hay #Leemos la página con el enlace al Servidor try: @@ -797,7 +807,7 @@ def findvideos(item): if not data or not matches: logger.error("ERROR 02: FINDVIDEOS: El enlace no existe o ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: El enlace no existe o ha cambiado la estructura de la Web. Verificar en la Web y reportar el error con el log')) - break #si no hay más datos, algo no funciona, pasamos a Ver Online + continue #si no hay más datos, algo no funciona, salimos #logger.debug(patron) #logger.debug(matches) @@ -862,14 +872,14 @@ def findvideos(item): #Verificamos el si el enlace del servidor está activo mostrar_server = True - if config.get_setting("hidepremium"): #Si no se aceptan servidore premium, se ignoran + if config.get_setting("hidepremium"): #Si no se aceptan servidore premium, se ignoran mostrar_server = servertools.is_server_enabled(servidor) - try: #Obtenemos el enlace + try: #Obtenemos el enlace if mostrar_server: - devuelve = servertools.findvideosbyserver(scrapedenlace, servidor) #existe el link ? + devuelve = servertools.findvideosbyserver(scrapedenlace, servidor) #existe el link ? if devuelve: - enlace = devuelve[0][1] #Se guarda el link + enlace = devuelve[0][1] #Se guarda el link if not enlace: continue @@ -877,21 +887,21 @@ def findvideos(item): #Si el link no está activo se ignora if "??" in item_local.alive: #dudoso item_local.title = '[COLOR yellow][?][/COLOR] [COLOR yellow][%s][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (servidor.capitalize(), quality, str(item_local.language)) - elif "no" in item_local.alive.lower(): #No está activo. Lo preparo, pero no lo pinto + elif "no" in item_local.alive.lower(): #No está activo. Lo preparo, pero no lo pinto item_local.title = '[COLOR red][%s][/COLOR] [COLOR yellow][%s][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.alive, servidor.capitalize(), quality, str(item_local.language)) logger.debug(item_local.alive + ": ALIVE / " + servidor + " / " + enlace) raise - else: #Sí está activo + else: #Sí está activo item_local.title = '[COLOR yellow][%s][/COLOR] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (servidor.capitalize(), quality, str(item_local.language)) #Ahora pintamos el link Directo item_local.url = enlace item_local.title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', item_local.title) #Quitamos etiquetas vacías - item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title) #Quitamos colores vacíos - item_local.action = "play" #Visualizar vídeo - item_local.server = servidor #Seridor Directo + item_local.title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', item_local.title) #Quitamos colores vacíos + item_local.action = "play" #Visualizar vídeo + item_local.server = servidor #Seridor Directo - itemlist_alt.append(item_local.clone(quality=quality)) #Pintar pantalla + itemlist_alt.append(item_local.clone(quality=quality)) #Pintar pantalla except: logger.error('ERROR al procesar enlaces DIRECTOS: ' + servidor + ' / ' + scrapedenlace) @@ -901,7 +911,7 @@ def findvideos(item): #Si son múltiples episodios, ordenamos if len(itemlist_alt) > 1 and (item.contentType == 'episode' or item.contentType == 'season'): itemlist_alt = sorted(itemlist_alt, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos - tmdb.set_infoLabels(itemlist_alt, True) #TMDB de la lista de episodios + tmdb.set_infoLabels(itemlist_alt, True) #TMDB de la lista de episodios itemlist.extend(itemlist_alt) return itemlist @@ -913,14 +923,14 @@ def episodios(item): #logger.debug(item) - curr_page = 1 # Página inicial - last_page = 99999 # Última página inicial + curr_page = 1 # Página inicial + last_page = 99999 # Última página inicial if item.curr_page: - curr_page = int(item.curr_page) # Si viene de una pasada anterior, lo usamos - del item.curr_page # ... y lo borramos + curr_page = int(item.curr_page) # Si viene de una pasada anterior, lo usamos + del item.curr_page # ... y lo borramos if item.last_page: - last_page = int(item.last_page) # Si viene de una pasada anterior, lo usamos - del item.last_page # ... y lo borramos + last_page = int(item.last_page) # Si viene de una pasada anterior, lo usamos + del item.last_page # ... y lo borramos url_item = item.url.replace('1-.fx', '%s-.fx').replace('-1.fx', '-%s.fx') if item.from_title: item.title = item.from_title @@ -928,8 +938,8 @@ def episodios(item): #Limpiamos num. Temporada y Episodio que ha podido quedar por Novedades season_display = 0 if item.contentSeason: - if item.season_colapse: #Si viene del menú de Temporadas... - season_display = item.contentSeason #... salvamos el num de sesión a pintar + if item.season_colapse: #Si viene del menú de Temporadas... + season_display = item.contentSeason #... salvamos el num de sesión a pintar item.from_num_season_colapse = season_display del item.season_colapse item.contentType = "tvshow" @@ -949,14 +959,14 @@ def episodios(item): tmdb.set_infoLabels(item, True) modo_ultima_temp_alt = modo_ultima_temp - if item.ow_force == "1": #Si hay un traspaso de canal o url, se actualiza todo + if item.ow_force == "1": #Si hay un traspaso de canal o url, se actualiza todo modo_ultima_temp_alt = False max_temp = 1 if item.infoLabels['number_of_seasons']: max_temp = item.infoLabels['number_of_seasons'] y = [] - if modo_ultima_temp_alt and item.library_playcounts: #Averiguar cuantas temporadas hay en Videoteca + if modo_ultima_temp_alt and item.library_playcounts: #Averiguar cuantas temporadas hay en Videoteca patron = 'season (\d+)' matches = re.compile(patron, re.DOTALL).findall(str(item.library_playcounts)) for x in matches: @@ -967,19 +977,19 @@ def episodios(item): # Descarga la página data = '' - url = url_item % curr_page #Inserto en num de página en la url + url = url_item % curr_page #Inserto en num de página en la url try: data = re.sub(r"\n|\r|\t|\s{2}|()| ", "", httptools.downloadpage(url, timeout=timeout).data) data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") - except: #Algún error de proceso, salimos + except: #Algún error de proceso, salimos pass if not data: logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea" + item.url) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: EPISODIOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) - return itemlist + break #Pintamos lo que tenemos - curr_page += 1 #Apunto ya a la página siguiente + curr_page += 1 #Apunto ya a la página siguiente #Usamos el mismo patrón que en listado patron = '
' @@ -996,7 +1006,7 @@ def episodios(item): logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web. Reportar el error con el log')) - return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos + break #si no hay más datos, algo no funciona, pintamos lo que tenemos #logger.debug("PATRON: " + patron) #logger.debug(matches) @@ -1080,10 +1090,10 @@ def episodios(item): else: item_local.title = '%sx%s -' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2)) - if modo_ultima_temp_alt and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca + if modo_ultima_temp_alt and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca if item_local.contentSeason < max_temp: - curr_page = 999999 #Sale del bucle de leer páginas - break #Sale del bucle actual del WHILE de episodios por página + curr_page = 999999 #Sale del bucle de leer páginas + break #Sale del bucle actual del WHILE de episodios por página if season_display > 0: if item_local.contentSeason > season_display: @@ -1098,10 +1108,10 @@ def episodios(item): if len(itemlist) > 1: itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) #clasificamos - if item.season_colapse and not item.add_videolibrary: #Si viene de listado, mostramos solo Temporadas + if item.season_colapse and not item.add_videolibrary: #Si viene de listado, mostramos solo Temporadas item, itemlist = generictools.post_tmdb_seasons(item, itemlist) - if not item.season_colapse: #Si no es pantalla de Temporadas, pintamos todo + if not item.season_colapse: #Si no es pantalla de Temporadas, pintamos todo # Pasada por TMDB y clasificación de lista por temporada y episodio tmdb.set_infoLabels(itemlist, True) diff --git a/plugin.video.alfa/channels/fanpelis.json b/plugin.video.alfa/channels/fanpelis.json new file mode 100644 index 00000000..4482e32a --- /dev/null +++ b/plugin.video.alfa/channels/fanpelis.json @@ -0,0 +1,41 @@ +{ + "id": "fanpelis", + "name":"Fanpelis", + "thumbnail":"http://fanpelis.com/wp-content/uploads/2018/05/111.png", + "banner":"", + "active": true, + "adult": false, + "language": ["cast", "lat"], + "version": 1, + "categories": [ + "movie", + "tvshow" + ], + "settings": [ + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Incluir en Novedades - Peliculas", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_infantiles", + "type": "bool", + "label": "Incluir en Novedades - Infantiles", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_terror", + "type": "bool", + "label": "Incluir en Novedades - terror", + "default": true, + "enabled": true, + "visible": true + } + ] + +} diff --git a/plugin.video.alfa/channels/fanpelis.py b/plugin.video.alfa/channels/fanpelis.py new file mode 100644 index 00000000..aba09ec5 --- /dev/null +++ b/plugin.video.alfa/channels/fanpelis.py @@ -0,0 +1,293 @@ +# -*- coding: utf-8 -*- +# -*- Channel Fanpelis -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import re +import urllib +import urlparse + +from channelselector import get_thumb +from core import httptools +from core import jsontools +from core import scrapertools +from core import servertools +from core.item import Item +from platformcode import config, logger +from core import tmdb + +host = "http://fanpelis.com/" + +def mainlist(item): + logger.info() + itemlist = list() + itemlist.append( + Item(channel=item.channel, + title="Peliculas", + action="sub_menu", + url=host + "movies/", + thumbnail=get_thumb('movies', auto=True))) + + itemlist.append( + Item(channel=item.channel, + title="Series", + action="sub_menu", + url=host + "series/", + thumbnail=get_thumb('tvshows', auto=True))) + + itemlist.append( + Item(channel=item.channel, + title="Buscar", + action="search", + url=host, + thumbnail=get_thumb("search", auto=True))) + + return itemlist + + +def sub_menu(item): + logger.info() + + itemlist = list() + + itemlist.append( + Item(channel=item.channel, + title="Ultimas", + action="list_all", + url=item.url, + thumbnail=get_thumb("last", auto=True))) + + itemlist.append( + Item(channel=item.channel, + title="Generos", + action="categories", + url=host, + thumbnail=get_thumb('genres', auto=True) + + )) + + itemlist.append( + Item(channel=item.channel, + title="Por Año", + action="categories", + url=host, + thumbnail=get_thumb('year', auto=True) + )) + + return itemlist + +def get_source(url): + logger.info() + data = httptools.downloadpage(url).data + data = re.sub(r'\n|\r|\t| |
|\s{2,}', "", data) + return data + + +def categories(item): + logger.info() + itemlist = [] + + data = get_source(item.url) + if item.title == 'Generos': + patron = 'menu-item-object-category menu-item-\d+">
([^<]+)<' + else: + patron = 'menu-item-object-release-year menu-item-\d+">([^<]+)<' + + matches = re.compile(patron, re.DOTALL).findall(data) + + for url, title in matches: + itemlist.append(Item(channel=item.channel, + action="list_all", + title=title, + url=url + )) + + return itemlist + + +def search(item, texto): + logger.info() + texto = texto.replace(" ", "+") + try: + if texto != '': + item.texto = texto + return list_all(item) + else: + return [] + except: + import sys + for line in sys.exc_info(): + logger.error("%s" % line) + return [] + + +def list_all(item): + logger.info() + itemlist = [] + + if item.texto != '': + url = item.url + "?s=%s" % item.texto + else: + url = item.url + + try: + data = get_source(url) + except: + return itemlist + data = data.replace("'", '"') + + pattern = 'class="ml-item.*?">(\d{4})<') + new_item = Item(channel=item.channel, + title=title, + url=url, + thumbnail=thumb, + infoLabels = {'year': year} + ) + if 'series' in url: + new_item.action = 'seasons' + new_item.contentSerieName = title + else: + new_item.action = 'findvideos' + new_item.contentTitle = title + + itemlist.append(new_item) + + tmdb.set_infoLabels(itemlist, seekTmdb=True) + + active_page = scrapertools.find_single_match(data, '
  • (\d+)') + if item.texto != '': + next_page = host + 'page/%s/' % (int(active_page) + 1) + else: + next_page = item.url +'page/%s/' % (int (active_page) + 1) + + if next_page: + + url = urlparse.urljoin(host, next_page) + itemlist.append(Item(channel=item.channel, + action="list_all", + title=">> Página siguiente", + url=url, + texto=item.texto, + thumbnail=get_thumb("next.png"))) + return itemlist + + +def seasons(item): + logger.info() + + itemlist = [] + + data = get_source(item.url) + patron = 'Temporada(\d+)' + matches = re.compile(patron, re.DOTALL).findall(data) + + for temporada in matches: + title = 'Temporada %s' % temporada + contentSeasonNumber = temporada + item.infoLabels['season'] = contentSeasonNumber + itemlist.append(item.clone(action='episodesxseason', + title=title, + contentSeasonNumber=contentSeasonNumber + )) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + if config.get_videolibrary_support() and len(itemlist) > 0: + itemlist.append(Item(channel=item.channel, + title='[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]', + url=item.url, + action="add_serie_to_library", + extra="episodios", + contentSerieName=item.contentSerieName, + contentSeasonNumber=contentSeasonNumber + )) + + return itemlist + +def episodios(item): + logger.info() + itemlist = [] + templist = seasons(item) + for tempitem in templist: + itemlist += episodesxseason(tempitem) + + return itemlist + + +def episodesxseason(item): + logger.info() + + itemlist = [] + season = item.contentSeasonNumber + data = get_source(item.url) + data = scrapertools.find_single_match(data, 'Temporada%s.*?' % season) + patron = '([^<]+)' + matches = re.compile(patron, re.DOTALL).findall(data) + ep = 1 + for scrapedurl, scrapedtitle in matches: + epi = str(ep) + title = season + 'x%s - Episodio %s' % (epi, epi) + url = scrapedurl + contentEpisodeNumber = epi + item.infoLabels['episode'] = contentEpisodeNumber + itemlist.append(item.clone(action='findvideos', + title=title, + url=url, + contentEpisodeNumber=contentEpisodeNumber, + )) + ep += 1 + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + return itemlist + + +def findvideos(item): + logger.info() + itemlist = [] + + data = get_source(item.url) + patron = '
    ' # lang, url matches = re.compile(patron, re.DOTALL).findall(data) for option, url in matches: - lang = scrapertools.find_single_match(data, '
  • .*?-->(\w+)' % option) - lang = lang.lower() + lang = scrapertools.find_single_match(data, '
  • .*?(.*?)= item.indexp + perpage: - break; + isDD, language = _extraer_dd_idioma(language) + if isDD: + continue + + repe = False + for it in itemlist: + if it.url == host + url: + repe = True + break + if repe: + continue path = scrapertools.find_single_match(thumbnail, "w\w+(/\w+.....)") filtro_list = {"poster_path": path} filtro_list = filtro_list.items() - itemlist.append(item.clone(action = 'findvideos', - title = title, - url = host + url, - thumbnail = thumbnail, - language = language, - infoLabels = {'filtro': filtro_list}, - ) - ) + + new_item = item.clone(action = 'findvideos', + title = title, + url = host + url, + thumbnail = thumbnail, + language = language, + infoLabels = {'filtro': filtro_list, 'year': '-'} + ) + + if item.type == 'series': + new_item.contentType = 'episode' + season_episode = scrapertools.find_single_match(title, ' (\d+)x(\d+)') + if season_episode: + new_item.contentSeason = season_episode[0] + new_item.contentEpisodeNumber = season_episode[1] + new_item.contentSerieName = re.sub(r' \d+x\d+', '', title).strip() + else: + new_item.contentSerieName = title + else: + new_item.contentType = 'movie' + new_item.contentTitle = title + + itemlist.append(new_item) + + if len(itemlist) >= perpage: + break; + tmdb.set_infoLabels(itemlist) # Desde novedades no tenemos el elemento item.channel - if item.channel: - itemlist.append(item.clone(title = "Página siguiente >>>", - indexp = item.indexp + perpage - ) - ) - if item.indexp > 1: - itemlist.append(item.clone(title = "<<< Página anterior", - indexp = item.indexp - perpage - ) - ) + if item.channel and len(itemlist) >= perpage and count + 1 <= len(matches): + itemlist.append( item.clone(title = "Página siguiente >>>", indexp = count + 1) ) return itemlist @@ -200,7 +222,7 @@ def list_all(item): item.page = 1 genero = scrapertools.find_single_match(item.url, "genre=(\w+)") - data= get_source(item.url) + data = get_source(item.url) token = scrapertools.find_single_match(data, "token:.*?'(.*?)'") url = host+'/titles/paginate?_token=%s&perPage=%d&page=%d&order=mc_num_of_votesDesc&type=%s&minRating=&maxRating=&availToStream=1&genres[]=%s' % (token, perpage, item.page, item.type, genero) data = httptools.downloadpage(url).data @@ -225,6 +247,7 @@ def list_all(item): if item.type == 'movie': new_item.action = 'findvideos' + new_item.contentType = 'movie' new_item.contentTitle = element['title'] new_item.fulltitle = element['title'] if new_item.extra != "links_encoded": @@ -234,6 +257,8 @@ def list_all(item): new_item.action = 'seasons' new_item.url = host + "/ver-serie-tv/" + str(element['id']) new_item.show = element['title'] + new_item.contentType = 'tvshow' + new_item.contentSerieName = element['title'] itemlist.append(new_item) @@ -242,10 +267,6 @@ def list_all(item): itemlist.append(item.clone(title = 'Página siguiente >>>', page = item.page + 1)) - if (int(item.page) > 1): - itemlist.append(item.clone(title = '<<< Página anterior', - page = item.page - 1)) - return itemlist def episodios(item): @@ -262,17 +283,22 @@ def episodios(item): def seasons(item): logger.info() + itemlist=[] + data = httptools.downloadpage(item.url).data reSeasons = re.findall("href *= *[\"']([^\"']+)[\"'][^\"']+[\"']sezon[^>]+>([^<]+)+", data) - - itemlist = [item.clone(action = "seasons_episodes", - title = title, - url = url) for url, title in reSeasons] + for url, title in reSeasons: + new_item = item.clone(action = "seasons_episodes", title = title, url = url) + new_item.contentType = 'season' + new_item.contentSeason = title.replace('Temporada', '').strip() + itemlist.append(new_item) if len(itemlist) == 1: itemlist = seasons_episodes(itemlist[0]) + tmdb.set_infoLabels(itemlist) + # Opción "Añadir esta serie a la videoteca de XBMC" if config.get_videolibrary_support() and len(itemlist) > 0: itemlist.append(item.clone(title="Añadir esta serie a la videoteca", action="add_serie_to_library", extra="episodios")) @@ -281,16 +307,25 @@ def seasons(item): def seasons_episodes(item): logger.info() + itemlist=[] data = httptools.downloadpage(item.url).data - reEpisodes = re.findall("]+col-sm-3[^>]+href *= *[\"'](?P[^\"']+).*?]+src *= *[\"'](?P[^\"']+).*?]+>(?P.*?)</a>", data, re.MULTILINE | re.DOTALL) - seasons = [item.clone(action = "findvideos", - title = re.sub("<b>Episodio (\d+)</b> - T(\d+) \|[^\|]*\| ".format(item.show), "\g<2>x\g<1> - ", title), - thumbnail = thumbnail, - url = url) for url, thumbnail, title in reEpisodes] + reEpisodes = re.findall('<li class="media bord">(.*?)</li>', data, re.MULTILINE | re.DOTALL) + for epi in reEpisodes: + new_item = item.clone(action = "findvideos") + new_item.url = scrapertools.find_single_match(epi, ' href="([^"]*)') + new_item.thumbnail = scrapertools.find_single_match(epi, ' src="([^"]*)') + new_item.contentType = 'episode' + new_item.contentEpisodeNumber = scrapertools.find_single_match(epi, '<b>Episodio (\d+)</b>') + title = scrapertools.find_single_match(epi, '<b>Episodio \d+</b> - T\d+ \|[^\|]*\| ([^<]*)').strip() + new_item.title = '%sx%s - %s' % (str(item.contentSeason), str(new_item.contentEpisodeNumber), title) + + itemlist.append(new_item) - return seasons + tmdb.set_infoLabels(itemlist) + + return itemlist def findvideos(item): @@ -298,28 +333,17 @@ def findvideos(item): itemlist=[] if item.extra != "links_encoded": - - # data = httptools.downloadpage(item.url).data - # linksRE = re.findall("getFavicon\('(?P<url>[^']+)[^>]+>[^>]+>(?P<language>[^<]+).+?<td[^>]+>(?P<quality>[^<]*).+?<td[^>]+>(?P<antiquity>[^<]*)", data, re.MULTILINE | re.DOTALL) - # for url, language, quality, antiquity in linksRE: - # logger.info("URL = " + url); - - data = httptools.downloadpage(item.url).data - patron = "renderTab.bind.*?'([^']+).*?" - patron += "app.utils.getFavicon.*?<img [^>]*src *= *[\"']/([^\.]+).*?" - patron += 'color:#B1FFC5;">([^<]+)' + patron = "renderTab\.bind.*?'([^']+)" + patron += '.*?<img data-bind="[^"]+"><b>([^<]*)' + patron += '.*?<td [^>]*>([^<]*)' + patron += '.*?<td [^>]*>([^<]*)' + matches = scrapertools.find_multiple_matches(data, patron) - for scrapedurl, language, scrapedquality in matches: - isDD = language.startswith("z") - if isDD: - language = language[1:] - - language = language[0:2] - language = IDIOMAS.get(language, language) - - title = ("Ver" if not isDD else "Descargar") + " enlace en %s [" + language + "] [" + scrapedquality + "]" + for scrapedurl, language, scrapedquality, scrapedwhen in matches: + isDD, language = _extraer_dd_idioma(language) if not isDD: + title = "%s [" + language + "] [" + scrapedquality + "] [" + scrapedwhen + "]" itemlist.append(item.clone(action = 'play', title = title, url = scrapedurl, @@ -327,22 +351,17 @@ def findvideos(item): ) ) itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize()) + else: for link in item.url: - - language = scrapertools.find_single_match(link['label'], '/([^\.]+)') - isDD = language.startswith("z") - if isDD: - language = language[1:] - - language = language[0:2] - + isDD, language = _extraer_dd_idioma(link['label']) if not isDD: itemlist.append(item.clone(action='play', title = item.title, url= link['url'], - language=IDIOMAS.get(language, language), + language=language, quality=link['quality'])) + itemlist=servertools.get_servers_itemlist(itemlist) for videoitem in itemlist: videoitem.title = '%s [%s] [%s]' % (videoitem.server.capitalize(), videoitem.language, videoitem.quality) @@ -365,3 +384,10 @@ def findvideos(item): def play(item): item.thumbnail = item.contentThumbnail return [item] + +# idiomas: l, c, s, i, v (lat, cast, subt, inglés, vo). Si empieza por z es descarga directa +def _extraer_dd_idioma(lang): + lang = lang.strip().lower() + isDD = lang.startswith('z') + lg = lang[1] if isDD else lang[0] + return isDD, IDIOMAS.get(lg, lang) diff --git a/plugin.video.alfa/channels/porntrex.py b/plugin.video.alfa/channels/porntrex.py old mode 100755 new mode 100644 index 38f59a3b..17387bea --- a/plugin.video.alfa/channels/porntrex.py +++ b/plugin.video.alfa/channels/porntrex.py @@ -10,6 +10,7 @@ from core.item import Item from platformcode import config, logger host = "https://www.porntrex.com" +perpage = 20 def mainlist(item): @@ -73,12 +74,14 @@ def lista(item): scrapedthumbnail = urlparse.urljoin(host, scrapedthumbnail) else: scrapedurl = urlparse.urljoin(host, scrapedurl) + if not scrapedthumbnail.startswith("https"): + scrapedthumbnail = "https:%s" % scrapedthumbnail if duration: scrapedtitle = "%s - %s" % (duration, scrapedtitle) if '>HD<' in quality: scrapedtitle += " [COLOR red][HD][/COLOR]" - itemlist.append(item.clone(action=action, title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, + itemlist.append(item.clone(action=action, title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, contentThumbnail=scrapedthumbnail, fanart=scrapedthumbnail)) # Extrae la marca de siguiente página @@ -128,6 +131,8 @@ def categorias(item): scrapedthumbnail = urllib.unquote(scrapedthumbnail.split("/go.php?u=")[1].split("&")[0]) else: scrapedurl = urlparse.urljoin(host, scrapedurl) + if not scrapedthumbnail.startswith("https"): + scrapedthumbnail = "https:%s" % scrapedthumbnail if videos: scrapedtitle = "%s (%s)" % (scrapedtitle, videos) itemlist.append(item.clone(action="lista", title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, @@ -148,10 +153,8 @@ def categorias(item): def playlists(item): logger.info() itemlist = [] - # Descarga la pagina data = get_data(item.url) - # Extrae las entradas patron = '<div class="item.*?href="([^"]+)" title="([^"]+)".*?data-original="([^"]+)".*?<div class="totalplaylist">([^<]+)<' matches = scrapertools.find_multiple_matches(data, patron) @@ -161,12 +164,13 @@ def playlists(item): scrapedthumbnail = urlparse.urljoin(host, scrapedthumbnail) else: scrapedurl = urlparse.urljoin(host, scrapedurl) + if not scrapedthumbnail.startswith("https"): + scrapedthumbnail = "https:%s" % scrapedthumbnail if videos: - scrapedtitle = "%s (%s)" % (scrapedtitle, videos) + scrapedtitle = "%s [COLOR red](%s)[/COLOR]" % (scrapedtitle, videos) itemlist.append(item.clone(action="videos", title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, fanart=scrapedthumbnail)) - - # Extrae la marca de siguiente página + #Extrae la marca de siguiente página next_page = scrapertools.find_single_match(data, '<li class="next">.*?href="([^"]+)"') if next_page: if "go.php?" in next_page: @@ -180,38 +184,43 @@ def playlists(item): def videos(item): logger.info() + if not item.indexp: + item.indexp = 1 itemlist = [] - - # Descarga la pagina + # Descarga la pagina data = get_data(item.url) - action = "play" if config.get_setting("menu_info", "porntrex"): action = "menu_info" # Extrae las entradas - patron = '<a href="([^"]+)" class="item ".*?data-original="([^"]+)".*?<strong class="title">\s*([^<]+)<' + patron = '<div class="video-item.*?href="([^"]+)".*?title="([^"]+)".*?src="([^"]+)"(.*?)<div class="durations">.*?</i>([^<]+)</div>' matches = scrapertools.find_multiple_matches(data, patron) - for scrapedurl, scrapedthumbnail, scrapedtitle in matches: - scrapedtitle = scrapedtitle.strip() + count = 0 + for scrapedurl, scrapedtitle, scrapedthumbnail, quality, duration in matches: + count += 1 + if count < item.indexp: + continue if "go.php?" in scrapedurl: scrapedurl = urllib.unquote(scrapedurl.split("/go.php?u=")[1].split("&")[0]) scrapedthumbnail = urlparse.urljoin(host, scrapedthumbnail) - itemlist.append(item.clone(action=action, title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, - fanart=scrapedthumbnail)) - - # Extrae la marca de siguiente página - next_page = scrapertools.find_single_match(data, '<li class="next">.*?from:(\d+)') - if next_page: - if "from=" in item.url: - next_page = re.sub(r'&from=(\d+)', '&from=%s' % next_page, item.url) else: - next_page = "%s?mode=async&function=get_block&block_id=playlist_view_playlist_view&sort_by" \ - "=added2fav_date&&from=%s" % (item.url, next_page) - itemlist.append(item.clone(action="videos", title=">> Página Siguiente", url=next_page)) + scrapedurl = urlparse.urljoin(host, scrapedurl) + if not scrapedthumbnail.startswith("https"): + scrapedthumbnail = "https:%s" % scrapedthumbnail + if duration: + scrapedtitle = "%s - %s" % (duration, scrapedtitle) + if '>HD<' in quality: + scrapedtitle += " [COLOR red][HD][/COLOR]" + if len(itemlist) >= perpage: + break; + itemlist.append(item.clone(action=action, title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, contentThumbnail=scrapedthumbnail, + fanart=scrapedthumbnail)) + #Extrae la marca de siguiente página + if item.channel and len(itemlist) >= perpage: + itemlist.append( item.clone(title = "Página siguiente >>>", indexp = count + 1) ) return itemlist - def play(item): logger.info() itemlist = [] @@ -224,7 +233,7 @@ def play(item): patron = '<iframe.*?height="(\d+)".*?video_url\s*:\s*\'([^\']+)\'' matches = scrapertools.find_multiple_matches(data, patron) for url, quality in matches: - if "http" in quality: + if "https" in quality: calidad = url url = quality quality = calidad + "p" diff --git a/plugin.video.alfa/channels/poseidonhd.json b/plugin.video.alfa/channels/poseidonhd.json index 07337f2f..1f4d4d48 100644 --- a/plugin.video.alfa/channels/poseidonhd.json +++ b/plugin.video.alfa/channels/poseidonhd.json @@ -3,12 +3,13 @@ "name": "PoseidonHD", "active": true, "adult": false, - "language": ["lat", "vose"], + "language": ["lat"], "thumbnail": "https://poseidonhd.com/wp-content/uploads/2017/06/logo2.png", "banner": "", "categories": [ "movie", "tvshow", + "vos", "direct" ], "settings": [ diff --git a/plugin.video.alfa/channels/poseidonhd.py b/plugin.video.alfa/channels/poseidonhd.py index b3945d79..b4c8d547 100644 --- a/plugin.video.alfa/channels/poseidonhd.py +++ b/plugin.video.alfa/channels/poseidonhd.py @@ -17,7 +17,7 @@ from channels import autoplay from platformcode import config, logger -IDIOMAS = {'mx': 'Latino', 'dk':'Latino', 'es': 'Castellano', 'en': 'VOSE', 'gb':'VOSE'} +IDIOMAS = {'mx': 'Latino', 'dk':'Latino', 'es': 'Castellano', 'en': 'VOSE', 'gb':'VOSE', 'de':'Alemán'} list_language = IDIOMAS.values() list_quality = ['HD', 'SD', 'CAM'] diff --git a/plugin.video.alfa/channels/repelis.json b/plugin.video.alfa/channels/repelis.json new file mode 100644 index 00000000..f4959e8a --- /dev/null +++ b/plugin.video.alfa/channels/repelis.json @@ -0,0 +1,76 @@ +{ + "id": "repelis", + "name": "Repelis", + "active": true, + "adult": false, + "language": ["lat","cast","vo"], + "thumbnail": "https://s8.postimg.cc/yem7wyfw1/repelis1.png", + "banner": "https://s8.postimg.cc/p6tzg9gjl/repelis2.png", + "categories": [ + "movie" + ], + "settings": [ + { + "id": "filter_languages", + "type": "list", + "label": "Mostrar enlaces en idioma...", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": [ + "No filtrar", + "LAT", + "ESP", + "VO" + ] + }, + { + "id": "modo_grafico", + "type": "bool", + "label": "Buscar información extra", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_latino", + "type": "bool", + "label": "Incluir en Novedades - Latino", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Incluir en Novedades - Peliculas", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_infantiles", + "type": "bool", + "label": "Incluir en Novedades - Infantiles", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_terror", + "type": "bool", + "label": "Incluir en Novedades - terror", + "default": true, + "enabled": true, + "visible": true + } + ] +} diff --git a/plugin.video.alfa/channels/repelis.py b/plugin.video.alfa/channels/repelis.py new file mode 100644 index 00000000..ca9118b4 --- /dev/null +++ b/plugin.video.alfa/channels/repelis.py @@ -0,0 +1,221 @@ +# -*- coding: utf-8 -*- +# -*- Channel Repelis -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import urllib + +from channelselector import get_thumb +from channels import autoplay +from channels import filtertools +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 platformcode import config, logger + + +idio = {'es-mx': 'LAT','es-es': 'ESP','en': 'VO'} +cali = {'poor': 'SD','low': 'SD','high': 'HD'} + +list_language = idio.values() +list_quality = ["SD","HD"] +list_servers = ['rapidvideo', 'streamango', 'fastplay', 'openload', 'netu', 'vidoza', 'uptobox'] + + +__channel__='repelis' + +host = "https://repelis.io" + +try: + __modo_grafico__ = config.get_setting('modo_grafico', __channel__) +except: + __modo_grafico__ = True + + +def mainlist(item): + logger.info() + autoplay.init(item.channel, list_servers, list_quality) + itemlist = [] + itemlist.append(Item(channel = item.channel, title = "Destacadas", action = "destacadas", url = host, thumbnail = get_thumb("hot", auto = True))) + itemlist.append(Item(channel = item.channel, title = "Agregadas recientemente", action = "peliculas", url = host + "/explorar?page=", page=1, thumbnail = get_thumb("last", auto = True))) + itemlist.append(Item(channel = item.channel, title = "Por género", action = "generos", url = host, extra = "Genero", thumbnail = get_thumb("genres", auto = True) )) + itemlist.append(Item(channel = item.channel, title = "")) + itemlist.append(Item(channel = item.channel, title = "Buscar", action = "search", url = host + "/search?term=", thumbnail = get_thumb("search", auto = True))) + autoplay.show_option(item.channel, itemlist) + return itemlist + +def destacadas(item): + logger.info() + itemlist = [] + data = httptools.downloadpage(item.url).data + patron = 'Películas destacadas(.*?)</section>' + bloque = scrapertools.find_single_match(data, patron) + patron = 'href="([^"]+).*?' + patron += 'title="([^"]+).*?' + patron += 'data-src="([^"]+).*?' + patron += 'data-year="([^"]+)' + matches = scrapertools.find_multiple_matches(bloque, patron) + for scrapedurl, scrapedtitle, scrapedthumbnail, scrapedyear in matches: + scrapedtitle = scrapedtitle.replace("Película ","") + itemlist.append(Item(channel = item.channel, + action = "findvideos", + contentTitle = scrapedtitle, + infoLabels = {'year':scrapedyear}, + thumbnail = host + scrapedthumbnail, + title = scrapedtitle + " (%s)" %scrapedyear, + url = host + scrapedurl + )) + tmdb.set_infoLabels(itemlist) + return itemlist + + +def peliculas(item): + logger.info() + itemlist = [] + url = item.url + headers = [ + ['Content-Type', 'application/json'] + ] + if item.extra != "busca": + url = item.url + str(item.page) + data = httptools.downloadpage(url, post="", headers=headers).data + bloquex = scrapertools.find_single_match(data, 'window.__NUXT__={.*?movies":(.*?\])') + dict = jsontools.load(bloquex) + else: + dd = httptools.downloadpage("https://repelis.io/graph", post=jsontools.dump(item.post), headers=headers).data + dict = jsontools.load(dd)["data"]["movies"] + for datos in dict: + scrapedurl = host + "/pelicula/" + datos["slug"] + "-" + datos["id"] + scrapedtitle = datos["title"].replace("Película ","") + scrapedthumbnail = host + "/_images/posters/" + datos["poster"] + "/180x270.jpg" + scrapedyear = scrapertools.find_single_match(datos["releaseDate"],'\d{4}') + itemlist.append(Item(channel = item.channel, + action = "findvideos", + contentTitle = scrapedtitle, + infoLabels = {'year':scrapedyear}, + thumbnail = scrapedthumbnail, + title = scrapedtitle + " (%s)" %scrapedyear, + url = scrapedurl + )) + tmdb.set_infoLabels(itemlist) + #pagination + if len(itemlist)>0: + itemlist.append(Item(channel = item.channel, + action = "peliculas", + page = item.page + 1, + title = "Página siguiente >>", + url = item.url + )) + return itemlist + + +def newest(categoria): + logger.info() + itemlist = [] + item = Item() + try: + if categoria in ['peliculas','latino']: + item.url = host + "/explorar?page=" + item.page=1 + elif categoria == 'infantiles': + item.url = host + '/genero/animacion-WYXS9?page' + item.page = 1 + elif categoria == 'terror': + item.url = host + 'genero/terror-dVbSb?page=' + item.page = 1 + itemlist = peliculas(item) + if "Pagina" in itemlist[-1].title: + itemlist.pop() + except: + import sys + for line in sys.exc_info(): + logger.error("{0}".format(line)) + return [] + + return itemlist + + +def search(item, texto): + logger.info() + item.url = item.url + texto + item.extra = "busca" + item.page = 1 + item.texto = texto + item.post = {"query":"\n query ($term: String) {\n movies: allMovies(search: $term) {\n id\n slug\n title\n rating\n releaseDate\n released\n poster\n nowPlaying\n }\n }\n ","variables":{"term":"%s" %texto}} + if texto != '': + return peliculas(item) + else: + return [] + + +def generos(item): + logger.info() + itemlist = [] + data = httptools.downloadpage(item.url).data + bloque = scrapertools.find_single_match(data, "Géneros.*?</ul>") + patron = 'href="([^"]+)"' + patron += '>([^<]+)' + matches = scrapertools.find_multiple_matches(bloque, patron) + for url, titulo in matches: + itemlist.append(Item(channel = item.channel, + action = "peliculas", + title = titulo, + url = host + url + "?page=", + page = 1 + )) + return itemlist + + +def findvideos(item): + itemlist = [] + data = httptools.downloadpage(item.url).data + bloque = scrapertools.find_single_match(data, ',"mirrors":(.*?\])') + if bloque == "[]": + return [] + dict = jsontools.load(bloque) + urlx = httptools.downloadpage(host + dict[0]["url"]) #Para que pueda saltar el cloudflare, se tiene que descargar la página completa + for datos in dict: + url1 = httptools.downloadpage(host + datos["url"], follow_redirects=False, only_headers=True).headers.get("location", "") + titulo = "Ver en: %s (" + cali[datos["quality"]] + ") (" + idio[datos["audio"]] + ")" + text_color = "white" + if "youtube" in url1: + titulo = "Ver trailer: %s" + text_color = "yellow" + itemlist.append( + item.clone(channel = item.channel, + action = "play", + language = idio[datos["audio"]], + quality = cali[datos["quality"]], + title = titulo, + url = url1 + )) + itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize()) + itemlist.sort(key=lambda it: (it.language, it.server)) + tmdb.set_infoLabels(itemlist, __modo_grafico__) + # Requerido para FilterTools + itemlist = filtertools.get_links(itemlist, item, list_language) + + # Requerido para AutoPlay + + autoplay.start(itemlist, item) + + if itemlist: + itemlist.append(Item(channel = item.channel)) + itemlist.append(item.clone(channel="trailertools", title="Buscar Tráiler", action="buscartrailer", context="", + text_color="magenta")) + # Opción "Añadir esta película a la biblioteca de KODI" + if item.extra != "library": + if config.get_videolibrary_support(): + itemlist.append(Item(channel=item.channel, title="Añadir a la videoteca", text_color="green", + action="add_pelicula_to_library", url=item.url, thumbnail = item.thumbnail, + contentTitle = item.contentTitle + )) + return itemlist + + +def play(item): + item.thumbnail = item.contentThumbnail + return [item] diff --git a/plugin.video.alfa/channels/sipeliculas.json b/plugin.video.alfa/channels/sipeliculas.json index 2f472705..487a8dd7 100755 --- a/plugin.video.alfa/channels/sipeliculas.json +++ b/plugin.video.alfa/channels/sipeliculas.json @@ -3,7 +3,7 @@ "name": "SiPeliculas", "active": true, "adult": false, - "language": "[lat]", + "language": ["lat"], "banner": "https://s24.postimg.cc/5wcznkxhv/sipeliculas.png", "thumbnail": "https://s23.postimg.cc/adrl2k5mz/sipeliculas.png", "categories": [ diff --git a/plugin.video.alfa/channels/videolibrary.json b/plugin.video.alfa/channels/videolibrary.json index 4afa81bd..abfd28d6 100755 --- a/plugin.video.alfa/channels/videolibrary.json +++ b/plugin.video.alfa/channels/videolibrary.json @@ -277,6 +277,16 @@ "enabled": true, "visible": true }, + { + "id": "lowerize_title", + "type": "list", + "label": "Crear directorios con letras en minúsculas", + "default": 0, + "lvalues": [ + "Si", + "No" + ] + }, { "id": "scraper_movies", "type": "list", @@ -313,4 +323,4 @@ "default": false } ] -} \ No newline at end of file +} diff --git a/plugin.video.alfa/channels/wikiseries.json b/plugin.video.alfa/channels/wikiseries.json index d0cf2aee..ba783c43 100644 --- a/plugin.video.alfa/channels/wikiseries.json +++ b/plugin.video.alfa/channels/wikiseries.json @@ -3,11 +3,12 @@ "name": "WikiSeries", "active": true, "adult": false, - "language": ["lat", "cast", "vo", "vose"], + "language": ["lat", "cast"], "thumbnail": "https://s31.postimg.cc/tnmcrytnv/16142379_1847422438815031_3788419094563167644_n.jpg", "banner": "", "categories": [ - "tvshow" + "tvshow", + "vos" ], "settings": [ { diff --git a/plugin.video.alfa/core/httptools.py b/plugin.video.alfa/core/httptools.py index 53b71b97..5f2f2355 100755 --- a/plugin.video.alfa/core/httptools.py +++ b/plugin.video.alfa/core/httptools.py @@ -242,8 +242,9 @@ def downloadpage(url, post=None, headers=None, timeout=None, follow_redirects=Tr server_cloudflare = "cloudflare" is_channel = inspect.getmodule(inspect.currentframe().f_back) - # error 4xx o 5xx se lanza excepcion - # response["code"] = 400 + # error 4xx o 5xx se lanza excepcion (menos para servidores) + # response["code"] = 400 # linea de código para probar + is_channel = str(is_channel).replace("/servers/","\\servers\\") # Para sistemas operativos diferente a Windows la ruta cambia if type(response["code"]) == int and "\\servers\\" not in str(is_channel): if response["code"] > 399 and (server_cloudflare == "cloudflare" and response["code"] != 503): raise WebErrorException(urlparse.urlparse(url)[1]) diff --git a/plugin.video.alfa/lib/generictools.py b/plugin.video.alfa/lib/generictools.py index bed1e5fe..fa6bb57c 100644 --- a/plugin.video.alfa/lib/generictools.py +++ b/plugin.video.alfa/lib/generictools.py @@ -182,9 +182,9 @@ def update_title(item): item.title = item.title.replace("[" + str(rating_old) + "]", "[" + str(rating_new) + "]") except: pass - if item.wanted: #Actualizamos Wanted, si existe + if item.wanted: #Actualizamos Wanted, si existe item.wanted = item.contentTitle - if new_item.contentSeason: #Restauramos el núm. de Temporada después de TMDB + if new_item.contentSeason: #Restauramos el núm. de Temporada después de TMDB item.contentSeason = new_item.contentSeason if item.from_update: @@ -194,12 +194,12 @@ def update_title(item): #Para evitar el "efecto memoria" de TMDB, se le llama con un título ficticio para que resetee los buffers if item.contentSerieName: - new_item.infoLabels['tmdb_id'] = '289' #una serie no ambigua + new_item.infoLabels['tmdb_id'] = '289' #una serie no ambigua else: - new_item.infoLabels['tmdb_id'] = '111' #una peli no ambigua + new_item.infoLabels['tmdb_id'] = '111' #una peli no ambigua new_item.infoLabels['year'] = '-' if new_item.contentSeason: - del new_item.infoLabels['season'] #Funciona mal con num. de Temporada + del new_item.infoLabels['season'] #Funciona mal con num. de Temporada scraper_return = scraper.find_and_set_infoLabels(new_item) #logger.debug(item) @@ -268,7 +268,7 @@ def post_tmdb_listado(item, itemlist): title_add = ' ' if item_local.title_subs: for title_subs in item_local.title_subs: - if "audio" in title_subs.lower(): #se restaura info de Audio + if "audio" in title_subs.lower(): #se restaura info de Audio title_add += scrapertools.find_single_match(title_subs, r'[a|A]udio (.*?)') continue if scrapertools.find_single_match(title_subs, r'(\d{4})'): #Se restaura el año, s no lo ha dado TMDB @@ -277,7 +277,7 @@ def post_tmdb_listado(item, itemlist): continue title_add = title_add.rstrip() - title_add = '%s -%s-' % (title_add, title_subs) #se agregan el resto de etiquetas salvadas + title_add = '%s -%s-' % (title_add, title_subs) #se agregan el resto de etiquetas salvadas item_local.title_subs = [] del item_local.title_subs @@ -299,15 +299,15 @@ def post_tmdb_listado(item, itemlist): # Si TMDB no ha encontrado nada y hemos usado el año de la web, lo intentamos sin año if not item_local.infoLabels['tmdb_id']: - if item_local.infoLabels['year']: #lo intentamos de nuevo solo si había año, puede que erroneo - year = item_local.infoLabels['year'] #salvamos el año por si no tiene éxito la nueva búsqueda - item_local.infoLabels['year'] = "-" #reseteo el año + if item_local.infoLabels['year']: #lo intentamos de nuevo solo si había año, puede que erroneo + year = item_local.infoLabels['year'] #salvamos el año por si no tiene éxito la nueva búsqueda + item_local.infoLabels['year'] = "-" #reseteo el año try: - tmdb.set_infoLabels(item_local, True) #pasamos otra vez por TMDB + tmdb.set_infoLabels(item_local, True) #pasamos otra vez por TMDB except: pass - if not item_local.infoLabels['tmdb_id']: #ha tenido éxito? - item_local.infoLabels['year'] = year #no, restauramos el año y lo dejamos ya + if not item_local.infoLabels['tmdb_id']: #ha tenido éxito? + item_local.infoLabels['year'] = year #no, restauramos el año y lo dejamos ya # Para Episodios, tomo el año de exposición y no el de inicio de la serie if item_local.infoLabels['aired']: @@ -322,22 +322,31 @@ def post_tmdb_listado(item, itemlist): if item_local.contentType == 'season': item_local.title = item_local.from_title + #Limpiamos calidad de títulos originales que se hayan podido colar + if item_local.infoLabels['originaltitle'].lower() in item_local.quality.lower(): + item_local.quality = re.sub(item_local.infoLabels['originaltitle'], '', item_local.quality, flags=re.IGNORECASE) + # Preparamos el título para series, con los núm. de temporadas, si las hay if item_local.contentType in ['season', 'tvshow', 'episode']: if item_local.contentType == "episode": - if "Temporada" in title: #Compatibilizamos "Temporada" con Unify + + #Si no está el título del episodio, pero sí está en "title", lo rescatamos + if not item_local.infoLabels['episodio_titulo'] and item_local.infoLabels['title'].lower() != item_local.infoLabels['tvshowtitle'].lower(): + item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['title'] + + if "Temporada" in title: #Compatibilizamos "Temporada" con Unify title = '%sx%s al 99 -' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber)) - if " al " in title: #Si son episodios múltiples, ponemos nombre de serie - if " al 99" in title.lower(): #Temporada completa. Buscamos num total de episodios + if " al " in title: #Si son episodios múltiples, ponemos nombre de serie + if " al 99" in title.lower(): #Temporada completa. Buscamos num total de episodios title = title.replace("99", str(item_local.infoLabels['temporada_num_episodios'])) title = '%s %s' % (title, item_local.contentSerieName) item_local.infoLabels['episodio_titulo'] = '%s - %s [%s] [%s]' % (scrapertools.find_single_match(title, r'(al \d+)'), item_local.contentSerieName, item_local.infoLabels['year'], rating) elif item_local.infoLabels['episodio_titulo']: title = '%s %s, %s' % (title, item_local.infoLabels['episodio_titulo'], item_local.contentSerieName) - item_local.infoLabels['episodio_titulo'] = '%s- %s [%s] [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.contentSerieName, item_local.infoLabels['year'], rating) + item_local.infoLabels['episodio_titulo'] = '%s, %s [%s] [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.contentSerieName, item_local.infoLabels['year'], rating) - else: #Si no hay título de episodio, ponermos el nombre de la serie + else: #Si no hay título de episodio, ponermos el nombre de la serie if item_local.contentSerieName not in title: title = '%s %s' % (title, item_local.contentSerieName) item_local.infoLabels['episodio_titulo'] = '%s [%s] [%s]' % (item_local.contentSerieName, item_local.infoLabels['year'], rating) @@ -367,7 +376,7 @@ def post_tmdb_listado(item, itemlist): title += " -Varios-" item_local.contentTitle += " -Varios-" - title += title_add #Se añaden etiquetas adicionales, si las hay + title += title_add #Se añaden etiquetas adicionales, si las hay #Ahora maquillamos un poco los titulos dependiendo de si se han seleccionado títulos inteleigentes o no if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados: @@ -383,7 +392,7 @@ def post_tmdb_listado(item, itemlist): title = re.sub(r'\s\[COLOR \w+\]\[\[?\]?\]\[\/COLOR\]', '', title).strip() title = re.sub(r'\s\[COLOR \w+\]\[\/COLOR\]', '', title).strip() - if item.category_new == "newest": #Viene de Novedades. Marcamos el título con el nombre del canal + if item.category_new == "newest": #Viene de Novedades. Marcamos el título con el nombre del canal title += ' -%s-' % scrapertools.find_single_match(item_local.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize() if item_local.contentType == "movie": item_local.contentTitle += ' -%s-' % scrapertools.find_single_match(item_local.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').capitalize() @@ -465,18 +474,18 @@ def post_tmdb_seasons(item, itemlist): # Primero creamos un título para TODAS las Temporadas # Pasada por TMDB a Serie, para datos adicionales try: - tmdb.set_infoLabels(item, True) #TMDB de cada Temp + tmdb.set_infoLabels(item, True) #TMDB de cada Temp except: pass item_season = item.clone() - if item_season.season_colapse: #Quitamos el indicador de listado por Temporadas + if item_season.season_colapse: #Quitamos el indicador de listado por Temporadas del item_season.season_colapse - title = '** Todas las Temporadas' #Agregamos título de TODAS las Temporadas (modo tradicional) - if item_season.infoLabels['number_of_episodes']: #Ponemos el núm de episodios de la Serie + title = '** Todas las Temporadas' #Agregamos título de TODAS las Temporadas (modo tradicional) + if item_season.infoLabels['number_of_episodes']: #Ponemos el núm de episodios de la Serie title += ' [%s epi]' % str(item_season.infoLabels['number_of_episodes']) - rating = '' #Ponemos el rating, si es diferente del de la Serie + rating = '' #Ponemos el rating, si es diferente del de la Serie if item_season.infoLabels['rating'] and item_season.infoLabels['rating'] != 0.0: try: rating = float(item_season.infoLabels['rating']) @@ -486,9 +495,9 @@ def post_tmdb_seasons(item, itemlist): if rating and rating == 0.0: rating = '' - if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados: + if not config.get_setting("unify"): #Si Titulos Inteligentes NO seleccionados: title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_season.infoLabels['year']), rating, item_season.quality, str(item_season.language)) - else: #Lo arreglamos un poco para Unify + else: #Lo arreglamos un poco para Unify title = title.replace('[', '-').replace(']', '-').replace('.', ',').strip() title = title.replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip() @@ -539,7 +548,7 @@ def post_tmdb_seasons(item, itemlist): #logger.debug(item_local) - else: #Si hay más de una temporada se sigue, si no se devuelve el Itemlist original + else: #Si hay más de una temporada se sigue, si no se devuelve el Itemlist original if item.season_colapse: del item.season_colapse return (item, itemlist) @@ -646,7 +655,7 @@ def post_tmdb_episodios(item, itemlist): if item.from_channel: del item.from_channel - for item_local in itemlist: #Recorremos el Itemlist generado por el canal + for item_local in itemlist: #Recorremos el Itemlist generado por el canal if item_local.add_videolibrary: del item_local.add_videolibrary if item_local.add_menu: @@ -750,7 +759,15 @@ def post_tmdb_episodios(item, itemlist): elif item_local.infoLabels['aired']: item_local.infoLabels['year'] = scrapertools.find_single_match(str(item_local.infoLabels['aired']), r'\/(\d{4})') - #Preparamos el título para que sea compatible con Añadir Serie a Videoteca + #Limpiamos calidad de títulos originales que se hayan podido colar + if item_local.infoLabels['originaltitle'].lower() in item_local.quality.lower(): + item_local.quality = re.sub(item_local.infoLabels['originaltitle'], '', item_local.quality, flags=re.IGNORECASE) + + #Si no está el título del episodio, pero sí está en "title", lo rescatamos + if not item_local.infoLabels['episodio_titulo'] and item_local.infoLabels['title'].lower() != item_local.infoLabels['tvshowtitle'].lower(): + item_local.infoLabels['episodio_titulo'] = item_local.infoLabels['title'] + + #Preparamos el título para que sea compatible con Añadir Serie a Videoteca if "Temporada" in item_local.title: #Compatibilizamos "Temporada" con Unify item_local.title = '%sx%s al 99 -' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber)) if " al " in item_local.title: #Si son episodios múltiples, ponemos nombre de serie @@ -763,7 +780,7 @@ def post_tmdb_episodios(item, itemlist): item_local.title = '%s %s' % (item_local.title, item_local.infoLabels['episodio_titulo']) item_local.infoLabels['episodio_titulo'] = '%s [%s] [%s]' % (item_local.infoLabels['episodio_titulo'], item_local.infoLabels['year'], rating) - else: #Si no hay título de episodio, ponermos el nombre de la serie + else: #Si no hay título de episodio, ponermos el nombre de la serie item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName) item_local.infoLabels['episodio_titulo'] = '%s [%s] [%s]' % (item_local.contentSerieName, item_local.infoLabels['year'], rating) @@ -812,8 +829,8 @@ def post_tmdb_episodios(item, itemlist): itemlist.append(item.clone(title="** [COLOR yelow]Actualizar Títulos - vista previa videoteca[/COLOR] **", action="actualizar_titulos", tmdb_stat=False, from_action=item.action, from_title_tmdb=item.title, from_update=True)) #Borro num. Temporada si no viene de menú de Añadir a Videoteca y no está actualizando la Videoteca - if not item.library_playcounts: #si no está actualizando la Videoteca - if modo_serie_temp != '': #y puede cambiara a serie-temporada + if not item.library_playcounts: #si no está actualizando la Videoteca + if modo_serie_temp != '': #y puede cambiara a serie-temporada if item.contentSeason and not item.add_menu: del item.infoLabels['season'] #La decisión de ponerlo o no se toma en la zona de menús @@ -835,13 +852,13 @@ def post_tmdb_episodios(item, itemlist): #Estamos en un canal que puede seleccionar entre gestionar Series completas o por Temporadas #Tendrá una línea para Añadir la Serie completa y otra para Añadir sólo la Temporada actual - if item.action == 'get_seasons': #si es actualización desde videoteca, título estándar + if item.action == 'get_seasons': #si es actualización desde videoteca, título estándar #Si hay una nueva Temporada, se activa como la actual if item.library_urls[item.channel] != item.url and (item.contentType == "season" or modo_ultima_temp): - item.library_urls[item.channel] = item.url #Se actualiza la url apuntando a la última Temporada + item.library_urls[item.channel] = item.url #Se actualiza la url apuntando a la última Temporada try: - from core import videolibrarytools #Se fuerza la actualización de la url en el .nfo - itemlist_fake = [] #Se crea un Itemlist vacio para actualizar solo el .nfo + from core import videolibrarytools #Se fuerza la actualización de la url en el .nfo + itemlist_fake = [] #Se crea un Itemlist vacio para actualizar solo el .nfo videolibrarytools.save_tvshow(item, itemlist_fake) #Se actualiza el .nfo except: logger.error("ERROR 08: EPISODIOS: No se ha podido actualizar la URL a la nueva Temporada") @@ -875,10 +892,10 @@ def post_tmdb_episodios(item, itemlist): if len(itemlist_fo) > 0: itemlist = itemlist_fo + itemlist - if item.add_videolibrary: #Estamos Añadiendo a la Videoteca. - del item.add_videolibrary #Borramos ya el indicador - if item.add_menu: #Opción que avisa si se ha añadido a la Videoteca - del item.add_menu #desde la página de Episodios o desde Menú Contextual + if item.add_videolibrary: #Estamos Añadiendo a la Videoteca. + del item.add_videolibrary #Borramos ya el indicador + if item.add_menu: #Opción que avisa si se ha añadido a la Videoteca + del item.add_menu #desde la página de Episodios o desde Menú Contextual #logger.debug(item) @@ -917,7 +934,7 @@ def post_tmdb_findvideos(item, itemlist): except: item.unify = config.get_setting("unify") - if item.contentSeason_save: #Restauramos el num. de Temporada + if item.contentSeason_save: #Restauramos el num. de Temporada item.contentSeason = item.contentSeason_save del item.contentSeason_save @@ -932,7 +949,7 @@ def post_tmdb_findvideos(item, itemlist): #elif (not item.infoLabels['tvdb_id'] and item.contentType == 'episode') or item.contentChannel == "videolibrary": # tmdb.set_infoLabels(item, True) try: - tmdb.set_infoLabels(item, True) #TMDB de cada Temp + tmdb.set_infoLabels(item, True) #TMDB de cada Temp except: pass #Restauramos la información de max num. de episodios por temporada despues de TMDB @@ -980,7 +997,7 @@ def post_tmdb_findvideos(item, itemlist): if item.infoLabels['duration']: tiempo = item.infoLabels['duration'] - elif item.contentChannel == 'videolibrary': #No hay, viene de la Videoteca? buscamos en la DB + elif item.contentChannel == 'videolibrary': #No hay, viene de la Videoteca? buscamos en la DB #Leo de la BD de Kodi la duración de la película o episodio. En "from_fields" se pueden poner las columnas que se quiera nun_records = 0 try: @@ -995,14 +1012,14 @@ def post_tmdb_findvideos(item, itemlist): for strFileName, field1 in records: tiempo = field1 - try: #calculamos el timepo en hh:mm - tiempo_final = int(tiempo) #lo convierto a int, pero puede se null - if tiempo_final > 0: #Si el tiempo está a 0, pasamos - if tiempo_final > 700: #Si está en segundos - tiempo_final = tiempo_final / 60 #Lo transformo a minutos - horas = tiempo_final / 60 #Lo transformo a horas - resto = tiempo_final - (horas * 60) #guardo el resto de minutos de la hora - if not scrapertools.find_single_match(item.quality, '(\[\d+:\d+)'): #si ya tiene la duración, pasamos + try: #calculamos el timepo en hh:mm + tiempo_final = int(tiempo) #lo convierto a int, pero puede se null + if tiempo_final > 0: #Si el tiempo está a 0, pasamos + if tiempo_final > 700: #Si está en segundos + tiempo_final = tiempo_final / 60 #Lo transformo a minutos + horas = tiempo_final / 60 #Lo transformo a horas + resto = tiempo_final - (horas * 60) #guardo el resto de minutos de la hora + if not scrapertools.find_single_match(item.quality, '(\[\d+:\d+)'): #si ya tiene la duración, pasamos item.quality += ' [/COLOR][COLOR white][%s:%s h]' % (str(horas).zfill(2), str(resto).zfill(2)) #Lo agrego a Calidad del Servidor except: pass @@ -1023,11 +1040,11 @@ def post_tmdb_findvideos(item, itemlist): if (" al " in item.title or " Al " in item.title) and not "al " in item.infoLabels['episodio_titulo']: title = '%s al %s - ' % (title, scrapertools.find_single_match(item.title, '[al|Al] (\d+)')) else: - title = '%s %s' % (title, item.infoLabels['episodio_titulo']) #Título Episodio + title = '%s %s' % (title, item.infoLabels['episodio_titulo']) #Título Episodio title_gen = '%s, ' % title - if item.contentType == "episode" or item.contentType == "season": #Series o Temporadas - title_gen += '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR] [%s]' % (item.contentSerieName, item.infoLabels['year'], rating, item.quality, str(item.language), scrapertools.find_single_match(item.title, '\s\[(\d+,?\d*?\s\w[b|B])\]')) #Rating, Calidad, Idioma, Tamaño + if item.contentType == "episode" or item.contentType == "season": #Series o Temporadas + title_gen += '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR] [%s]' % (item.contentSerieName, item.infoLabels['year'], rating, item.quality, str(item.language), scrapertools.find_single_match(item.title, '\s\[(\d+,?\d*?\s\w[b|B])\]')) #Rating, Calidad, Idioma, Tamaño if item.infoLabels['status'] and item.infoLabels['status'].lower() == "ended": title_gen = '[TERM.] %s' % title_gen #Marca cuando la Serie está terminada y no va a haber más producción item.title = title_gen @@ -1042,9 +1059,9 @@ def post_tmdb_findvideos(item, itemlist): title_gen = title_gen.replace(" []", "").strip() #Quitamos etiquetas vacías title_videoteca = title_gen #Salvamos el título para Videoteca - if not item.unify: #Si Titulos Inteligentes NO seleccionados: + if not item.unify: #Si Titulos Inteligentes NO seleccionados: title_gen = '**- [COLOR gold]Enlaces Ver: [/COLOR]%s[COLOR gold] -**[/COLOR]' % (title_gen) - else: #Si Titulos Inteligentes SÍ seleccionados: + else: #Si Titulos Inteligentes SÍ seleccionados: title_gen = '[COLOR gold]Enlaces Ver: [/COLOR]%s' % (title_gen) if item.channel_alt: @@ -1107,7 +1124,7 @@ def get_field_from_kodi_DB(item, from_fields='*', files='file'): VIDEOLIBRARY_PATH = config.get_videolibrary_config_path() VIDEOLIBRARY_REAL_PATH = config.get_videolibrary_path() - if item.contentType == 'movie': #Agrego la carpeta correspondiente al path de la Videoteca + if item.contentType == 'movie': #Agrego la carpeta correspondiente al path de la Videoteca path = filetools.join(VIDEOLIBRARY_REAL_PATH, FOLDER_MOVIES) path2 = filetools.join(VIDEOLIBRARY_PATH, FOLDER_MOVIES) folder = FOLDER_MOVIES @@ -1116,40 +1133,40 @@ def get_field_from_kodi_DB(item, from_fields='*', files='file'): path2 = filetools.join(VIDEOLIBRARY_PATH, FOLDER_TVSHOWS) folder = FOLDER_TVSHOWS - raiz, carpetas, ficheros = filetools.walk(path).next() #listo las series o películas en la Videoteca - carpetas = [filetools.join(path, f) for f in carpetas] #agrego la carpeta del contenido al path - for carpeta in carpetas: #busco el contenido seleccionado en la lista de carpetas - if item.contentType == 'movie' and (item.contentTitle.lower() in carpeta or item.contentTitle in carpeta): #Películas? - path = carpeta #Almacenamos la carpeta en el path + raiz, carpetas, ficheros = filetools.walk(path).next() #listo las series o películas en la Videoteca + carpetas = [filetools.join(path, f) for f in carpetas] #agrego la carpeta del contenido al path + for carpeta in carpetas: #busco el contenido seleccionado en la lista de carpetas + if item.contentType == 'movie' and (item.contentTitle.lower() in carpeta or item.contentTitle in carpeta): #Películas? + path = carpeta #Almacenamos la carpeta en el path break - elif item.contentType in ['tvshow', 'season', 'episode'] and (item.contentSerieName.lower() in carpeta or item.contentSerieName in carpeta): #Series? - path = carpeta #Almacenamos la carpeta en el path + elif item.contentType in ['tvshow', 'season', 'episode'] and (item.contentSerieName.lower() in carpeta or item.contentSerieName in carpeta): #Series? + path = carpeta #Almacenamos la carpeta en el path break path2 += '/%s/' % scrapertools.find_single_match(path, '%s.(.*?\s\[.*?\])' % folder) #Agregamos la carpeta de la Serie o Películas, formato Android - file_search = '%' #Por defecto busca todos los archivos de la carpeta - if files == 'file': #Si se ha pedido son un archivo (defecto), se busca - if item.contentType == 'episode': #Si es episodio, se pone el nombre, si no de deja % - file_search = '%sx%s.strm' % (item.contentSeason, str(item.contentEpisodeNumber).zfill(2)) #Nombre para episodios + file_search = '%' #Por defecto busca todos los archivos de la carpeta + if files == 'file': #Si se ha pedido son un archivo (defecto), se busca + if item.contentType == 'episode': #Si es episodio, se pone el nombre, si no de deja % + file_search = '%sx%s.strm' % (item.contentSeason, str(item.contentEpisodeNumber).zfill(2)) #Nombre para episodios - if "\\" in path: #Ajustamos los / en función de la plataforma + if "\\" in path: #Ajustamos los / en función de la plataforma path = path.replace("/", "\\") - path += "\\" #Terminamos el path con un / + path += "\\" #Terminamos el path con un / else: path += "/" - if FOLDER_TVSHOWS in path: #Compruebo si es CINE o SERIE - contentType = "episode_view" #Marco la tabla de BBDD de Kodi Video + if FOLDER_TVSHOWS in path: #Compruebo si es CINE o SERIE + contentType = "episode_view" #Marco la tabla de BBDD de Kodi Video else: - contentType = "movie_view" #Marco la tabla de BBDD de Kodi Video - path1 = path.replace("\\\\", "\\") #para la SQL solo necesito la carpeta - path2 = path2.replace("\\", "/") #Formato no Windows + contentType = "movie_view" #Marco la tabla de BBDD de Kodi Video + path1 = path.replace("\\\\", "\\") #para la SQL solo necesito la carpeta + path2 = path2.replace("\\", "/") #Formato no Windows #Ejecutmos la sentencia SQL if not from_fields: from_fields = '*' else: - from_fields = 'strFileName, %s' % from_fields #al menos dos campos, porque uno solo genera cosas raras + from_fields = 'strFileName, %s' % from_fields #al menos dos campos, porque uno solo genera cosas raras sql = 'select %s from %s where (strPath like "%s" or strPath like "%s") and strFileName like "%s"' % (from_fields, contentType, path1, path2, file_search) nun_records = 0 records = None @@ -1233,7 +1250,7 @@ def fail_over_newpct1(item, patron, patron2=None, timeout=None): return (item, data) #nos vamos, con el mismo clone, si está activo if (item.action == 'episodios' or item.action == 'findvideos') and item.contentType not in contentType: #soporta el fail_over de este contenido? logger.error("ERROR 99: " + item.action.upper() + ": Acción no soportada para Fail-Over en canal: " + item.url) - return (item, data) #no soporta el fail_over de este contenido, no podemos hacer nada + return (item, data) #no soporta el fail_over de este contenido, no podemos hacer nada break if not channel_failed: @@ -1263,7 +1280,7 @@ def fail_over_newpct1(item, patron, patron2=None, timeout=None): #quitamos el código de series, porque puede variar entre webs if item.action == "episodios" or item.action == "get_seasons": item.url = re.sub(r'\/\d+\/?$', '', item.url) #parece que con el título solo ecuentra la serie, normalmente... - url_alt = [item.url] #salvamos la url para el bucle, pero de momento ignoramos la inicial con código de serie + url_alt = [item.url] #salvamos la url para el bucle, pero de momento ignoramos la inicial con código de serie #si es un episodio, generalizamos la url para que se pueda encontrar en otro clone. Quitamos la calidad del final de la url elif item.action == "findvideos" and item.contentType == "episode": @@ -1380,7 +1397,7 @@ def web_intervenida(item, data, desactivar=True): category = item.category if not item.category: category = item.channel - intervencion = (category, judicial) #Guardamos el nombre canal/categoría y el thumb judicial + intervencion = (category, judicial) #Guardamos el nombre canal/categoría y el thumb judicial if not item.intervencion: item.intervencion = [] #Si no existe el array, lo creamos item.intervencion += [intervencion] #Añadimos esta intervención al array @@ -1416,10 +1433,10 @@ def web_intervenida(item, data, desactivar=True): #Guardamos los cambios hechos en el .json try: if item.channel != channel_py: - disabled = config.set_setting('enabled', False, item.channel) #Desactivamos el canal + disabled = config.set_setting('enabled', False, item.channel) #Desactivamos el canal disabled = config.set_setting('include_in_global_search', False, item.channel) #Lo sacamos de las búquedas globales channel_path = filetools.join(config.get_runtime_path(), "channels", item.channel + ".json") - with open(channel_path, 'w') as outfile: #Grabamos el .json actualizado + with open(channel_path, 'w') as outfile: #Grabamos el .json actualizado json.dump(json_data, outfile, sort_keys = True, indent = 2, ensure_ascii = False) except: logger.error("ERROR 98 al salvar el archivo: %s" % channel_path) @@ -1526,96 +1543,96 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F return (item, it, overwrite) #... el canal/clone está listado import ast - intervencion_list = ast.literal_eval(intervencion) #Convertir a Array el string + intervencion_list = ast.literal_eval(intervencion) #Convertir a Array el string #logger.debug(intervencion_list) if lookup == True: - overwrite = False #Solo avisamos si hay cambios + overwrite = False #Solo avisamos si hay cambios for activo, canal_org, canal_des, url_org, url_des, patron1, patron2, patron3, patron4, patron5, content_inc, content_exc, ow_force in intervencion_list: #Es esta nuestra entrada? if activo == '1' and (canal_org == channel_alt or canal_org == item.channel or channel_alt == 'videolibrary' or ow_force == 'del'): - if ow_force == 'del': #Si es un borrado de estructuras erroneas, hacemos un proceso aparte - canal_des_def = canal_des #Si hay canal de sustitución para item.library_urls, lo usamos + if ow_force == 'del': #Si es un borrado de estructuras erroneas, hacemos un proceso aparte + canal_des_def = canal_des #Si hay canal de sustitución para item.library_urls, lo usamos if not canal_des_def and canal_org in item.library_urls and len(item.library_urls) == 1: #Si no, lo extraemos de la url canal_des_def = scrapertools.find_single_match(item.library_urls[canal_org], 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').lower() #salvamos la url actual de la estructura a borrar url_total = '' if item.url: - url_total = item.url #Si existe item.url, lo salvamos para futuro uso - if item.library_urls and canal_org in item.library_urls: #Si existe una entrada con el canal a borrar, lo procesamos - if lookup == True: #Queremos que el canal solo visualice sin migración? - overwrite = True #Avisamos que hay cambios + url_total = item.url #Si existe item.url, lo salvamos para futuro uso + if item.library_urls and canal_org in item.library_urls: #Si existe una entrada con el canal a borrar, lo procesamos + if lookup == True: #Queremos que el canal solo visualice sin migración? + overwrite = True #Avisamos que hay cambios continue logger.error('** REGLA: ' + canal_org + ', ' + canal_des+ ', ' + ow_force) logger.error('item.library_urls PREVIA: ' + str(item.library_urls)) - url_total = item.library_urls[canal_org] #salvamos la url actual de la estructura a borrar + url_total = item.library_urls[canal_org] #salvamos la url actual de la estructura a borrar url_total_status = False - if len(item.library_urls) == 1 or canal_des: #si el nuevo canal no existe ya... + if len(item.library_urls) == 1 or canal_des: #si el nuevo canal no existe ya... item.library_urls.update({canal_des_def: url_total}) #restauramos la url con el nuevo canal - url_total_status = True #marcamos esta url como válida - overwrite = True #Le decimos que sobreescriba todos los .jsons - item.ow_force = '1' #Le decimos que revise todas las temporadas + url_total_status = True #marcamos esta url como válida + overwrite = True #Le decimos que sobreescriba todos los .jsons + item.ow_force = '1' #Le decimos que revise todas las temporadas if len(item.library_urls) > 1: - item.library_urls.pop(canal_org, None) #borramos la url del canal a borrar - overwrite = True #Le decimos que sobreescriba todos los .jsons - item.ow_force = '1' #Le decimos que revise todas las temporadas + item.library_urls.pop(canal_org, None) #borramos la url del canal a borrar + overwrite = True #Le decimos que sobreescriba todos los .jsons + item.ow_force = '1' #Le decimos que revise todas las temporadas if it.library_urls: - it.library_urls = item.library_urls #lo salvamos en el .nfo, si lo hay + it.library_urls = item.library_urls #lo salvamos en el .nfo, si lo hay if item.url and item.url == url_total and url_total_status == False: #si la url es la del canal borrado... for canal_vid, url_vid in item.library_urls.items(): canal_vid_alt = "'%s'" % canal_vid - if canal_vid_alt not in intervencion: #... la sustituimos por la primera válida + if canal_vid_alt not in intervencion: #... la sustituimos por la primera válida item.url = url_vid break - if canal_vid_alt in fail_over_list: #Si es un clone de Newpct1, salvamos la nueva categoría + if canal_vid_alt in fail_over_list: #Si es un clone de Newpct1, salvamos la nueva categoría item.category = scrapertools.find_single_match(item.url, 'http.?\:\/\/(?:www.)?(\w+)\.\w+\/').lower() #Salvamos categoría else: - item.category = canal_vid.capitalize() #si no, salvamos nueva categoría + item.category = canal_vid.capitalize() #si no, salvamos nueva categoría logger.error('item.library_urls ACTUALIZADA: ' + str(item.library_urls)) - if lookup == False: #si es migración completa... - delete_stat += 1 #Ya hemos actualizado algo, o habrá que hacerlo... + if lookup == False: #si es migración completa... + delete_stat += 1 #Ya hemos actualizado algo, o habrá que hacerlo... canal_org_des_list += [(canal_org, canal_des, url_total, ow_force)] #salvamos el resultado para su proceso else: - if channel_alt == 'videolibrary': #Viene de videolibrary.list_movies: IMPRESCINDIBLE + if channel_alt == 'videolibrary': #Viene de videolibrary.list_movies: IMPRESCINDIBLE for canal_vid, url_vid in item.library_urls.items(): - if canal_org != canal_vid: #Miramos si canal_org de la regla está en item.library_urls + if canal_org != canal_vid: #Miramos si canal_org de la regla está en item.library_urls continue else: - channel_alt = canal_org #Sí, ponermos el nombre del canal de origen + channel_alt = canal_org #Sí, ponermos el nombre del canal de origen channel_b = "'%s'" % canal_org - if channel_b in fail_over_list: #Si es un clone de Newpct1, se actualiza a newpct1 + if channel_b in fail_over_list: #Si es un clone de Newpct1, se actualiza a newpct1 channel_alt = channel_py if channel_alt == 'videolibrary': continue - if item.contentType == "list": #Si viene de Videolibrary, le cambiamos ya el canal + if item.contentType == "list": #Si viene de Videolibrary, le cambiamos ya el canal if item.channel != channel_py: - item.channel = canal_des #Cambiamos el canal. Si es clone, lo hace el canal - continue #Salimos sin hacer nada más. item está casi vacío + item.channel = canal_des #Cambiamos el canal. Si es clone, lo hace el canal + continue #Salimos sin hacer nada más. item está casi vacío if item.contentType not in content_inc and "*" not in content_inc: #Está el contenido el la lista de incluidos continue - if item.contentType in content_exc: #Está el contenido excluido? + if item.contentType in content_exc: #Está el contenido excluido? continue if item.channel != channel_py: - channel_enabled = channeltools.is_enabled(channel_alt) #Verificamos que el canal esté inactivo + channel_enabled = channeltools.is_enabled(channel_alt) #Verificamos que el canal esté inactivo channel_enabled_alt = config.get_setting('enabled', channel_alt) - channel_enabled = channel_enabled * channel_enabled_alt #Si está inactivo en algún sitio, tomamos eso - if channel_enabled == 1 and canal_org != canal_des: #Si el canal está activo, puede ser solo... - continue #... una intervención que afecte solo a una región - if ow_force == 'no' and it.library_urls: #Esta regla solo vale para findvideos... - continue #... salidmos si estamos actualizando - if lookup == True: #Queremos que el canal solo visualice sin migración? + channel_enabled = channel_enabled * channel_enabled_alt #Si está inactivo en algún sitio, tomamos eso + if channel_enabled == 1 and canal_org != canal_des: #Si el canal está activo, puede ser solo... + continue #... una intervención que afecte solo a una región + if ow_force == 'no' and it.library_urls: #Esta regla solo vale para findvideos... + continue #... salidmos si estamos actualizando + if lookup == True: #Queremos que el canal solo visualice sin migración? if ow_force != 'no': - overwrite = True #Avisamos que hay cambios - continue #Salimos sin tocar archivos + overwrite = True #Avisamos que hay cambios + continue #Salimos sin tocar archivos url_total = '' if item.url: url_total = item.url elif not item.url and item.library_urls: url_total = item.library_urls[canal_org] - url_total = url_total.replace(url_org, url_des) #reemplazamos una parte de url + url_total = url_total.replace(url_org, url_des) #reemplazamos una parte de url url = '' if patron1: #Hay expresión regex? url += scrapertools.find_single_match(url_total, patron1) #La aplicamos a url @@ -1665,39 +1682,39 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F # Listamos todos los ficheros de la serie, asi evitamos tener que comprobar si existe uno por uno canal_erase_list = [] raiz, carpetas_series, ficheros = filetools.walk(path).next() - ficheros = [filetools.join(path, f) for f in ficheros] #Almacenamos la lista de archivos de la carpeta + ficheros = [filetools.join(path, f) for f in ficheros] #Almacenamos la lista de archivos de la carpeta for archivo in ficheros: for canal_org_def, canal_des_def, url_total, ow_force_def in canal_org_des_list: #pasamos por todas las "parejas" a borrar canal_erase = '[%s]' % canal_org_def canal_new = '[%s]' % canal_des_def - if canal_erase in archivo: #Borramos los .json que sean de los canal afectados + if canal_erase in archivo: #Borramos los .json que sean de los canal afectados if canal_des_def: - item_json = Item().fromjson(filetools.read(archivo)) #leemos el .json ante de borrarlo para salvar... - title = item_json.title #... el título con su formato - language = item_json.language #... los idiomas, que no están en el .nfo - wanted = item_json.wanted #... y wanted con el título original - json_path = archivo.replace(canal_erase, canal_new) #Salvamos el path del .json para luego crearlo + item_json = Item().fromjson(filetools.read(archivo)) #leemos el .json ante de borrarlo para salvar... + title = item_json.title #... el título con su formato + language = item_json.language #... los idiomas, que no están en el .nfo + wanted = item_json.wanted #... y wanted con el título original + json_path = archivo.replace(canal_erase, canal_new) #Salvamos el path del .json para luego crearlo json_path_list += [(canal_org_def, canal_des_def, url_total, json_path, title, language, wanted)] - filetools.remove(archivo) #Borramos el .json + filetools.remove(archivo) #Borramos el .json logger.error('** BORRAMOS: ' + str(archivo)) - if ow_force_def == 'del': #Si la función es 'del' ... - overwrite = True #Le decimos que sobreescriba todos los .jsons - item.ow_force = '1' #Le decimos que revise todas las temporadas + if ow_force_def == 'del': #Si la función es 'del' ... + overwrite = True #Le decimos que sobreescriba todos los .jsons + item.ow_force = '1' #Le decimos que revise todas las temporadas #Si se ha cambiado algo, se actualizan los .nfo if item.contentType == "movie" and ".nfo" in archivo: if it.ow_force: del it.ow_force - filetools.write(archivo, head_nfo + it.tojson()) #escribo el .nfo de la peli por si aborta update + filetools.write(archivo, head_nfo + it.tojson()) #escribo el .nfo de la peli por si aborta update if item.contentType != "movie" and "tvshow.nfo" in archivo: - filetools.write(archivo, head_nfo + it.tojson()) #escribo el tvshow.nfo por si aborta update + filetools.write(archivo, head_nfo + it.tojson()) #escribo el tvshow.nfo por si aborta update #Aquí convertimos las películas. Después de borrado el .json, dejamos que videolibrarytools lo regenere - if item.contentType == "movie": #Dejamos que regenere el archivo .json + if item.contentType == "movie": #Dejamos que regenere el archivo .json item_movie = item.clone() if item_movie.ow_force: del item_movie.ow_force item_movie.update_last = '1' del item_movie.update_last - del item_movie.library_playcounts #Borramos lo que no es necesario en el .json + del item_movie.library_playcounts #Borramos lo que no es necesario en el .json del item_movie.library_urls del item_movie.nfo del item_movie.path @@ -1710,14 +1727,14 @@ def redirect_clone_newpct1(item, head_nfo=None, it=None, path=False, overwrite=F logger.error('** .json LIST: ' + str(json_path_list)) for canal_org_def, canal_des_def, url_total, json_path, title, language, wanted in json_path_list: #pasamos por todas canales logger.error('** ESCRIBIMOS: ' + json_path) - item_movie.channel = canal_des_def #mombre del canal migrado + item_movie.channel = canal_des_def #mombre del canal migrado if not item_movie.category: item_movie.category = canal_des_def.capitalize() #categoría - item_movie.url = url_total #url migrada - if title: item_movie.title = title #restaurmos el título con formato - if language: item_movie.language = language #restaurmos los idiomas - if wanted: item_movie.wanted = wanted #restaurmos wanted - item_movie.added_replacing = canal_org_def #guardamos la traza del canal reemplazado - filetools.write(json_path, item_movie.tojson()) #Salvamos el nuevo .json de la película + item_movie.url = url_total #url migrada + if title: item_movie.title = title #restaurmos el título con formato + if language: item_movie.language = language #restaurmos los idiomas + if wanted: item_movie.wanted = wanted #restaurmos wanted + item_movie.added_replacing = canal_org_def #guardamos la traza del canal reemplazado + filetools.write(json_path, item_movie.tojson()) #Salvamos el nuevo .json de la película if (update_stat > 0 and path != False and ow_force_def in ['force', 'auto']) or item.ow_force == '1' or len(json_path_list) > 0: logger.error('ITEM cambiado') diff --git a/plugin.video.alfa/platformcode/xbmc_config_menu.py b/plugin.video.alfa/platformcode/xbmc_config_menu.py index 25c2f807..32416094 100755 --- a/plugin.video.alfa/platformcode/xbmc_config_menu.py +++ b/plugin.video.alfa/platformcode/xbmc_config_menu.py @@ -469,10 +469,11 @@ class SettingsWindow(xbmcgui.WindowXMLDialog): self.ok_enabled = False self.default_enabled = False - if xbmcgui.__version__ == "1.2": - self.setCoordinateResolution(1) - else: - self.setCoordinateResolution(5) + if config.get_platform(True)['num_version'] < 18: + if xbmcgui.__version__ == "1.2": + self.setCoordinateResolution(1) + else: + self.setCoordinateResolution(5) # Ponemos el título self.getControl(10002).setLabel(self.caption) diff --git a/plugin.video.alfa/servers/cloudsany.json b/plugin.video.alfa/servers/cloudsany.json deleted file mode 100644 index 75c373ca..00000000 --- a/plugin.video.alfa/servers/cloudsany.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "cloudsany.com/i/([A-z0-9]+)", - "url": "https://cloudsany.com/i/\\1" - } - ] - }, - "free": true, - "id": "cloudsany", - "name": "cloudsany", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ], - "thumbnail": "https://s1.postimg.cc/6wixo35myn/cloudsany1.png" -} diff --git a/plugin.video.alfa/servers/cloudsany.py b/plugin.video.alfa/servers/cloudsany.py deleted file mode 100644 index 67112c5f..00000000 --- a/plugin.video.alfa/servers/cloudsany.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# ------------------------------------------------------------ -# Alfa addon - KODI Plugin -# Conector para cloudsany -# https://github.com/alfa-addon -# ------------------------------------------------------------ - -from core import httptools -from core import scrapertools -from lib import jsunpack -from platformcode import logger - - -def test_video_exists(page_url): - logger.info("(page_url='%s')" % page_url) - data = httptools.downloadpage(page_url).data - if "no longer exists" in data: - return False, "[Cloudsany] El fichero ha sido borrado" - - return True, "" - - -def get_video_url(page_url, user="", password="", video_password=""): - logger.info("(page_url='%s')" % page_url) - data = httptools.downloadpage(page_url).data - data = scrapertools.find_single_match(data, 'p,a,c,k,e.*?</script>') - unpack = jsunpack.unpack(data) - logger.info("Intel11 %s" %unpack) - video_urls = [] - videourl = scrapertools.find_single_match(unpack, 'config={file:"([^"]+)') - video_urls.append([".MP4 [Cloudsany]", videourl]) - - return video_urls diff --git a/plugin.video.alfa/servers/wholecloud.json b/plugin.video.alfa/servers/diskokosmiko.json old mode 100755 new mode 100644 similarity index 69% rename from plugin.video.alfa/servers/wholecloud.json rename to plugin.video.alfa/servers/diskokosmiko.json index 1faa1ab1..fde2cf0a --- a/plugin.video.alfa/servers/wholecloud.json +++ b/plugin.video.alfa/servers/diskokosmiko.json @@ -1,42 +1,43 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "wholecloud.net/(?:video/|embed/?v=)([A-z0-9]+)", - "url": "http://wholecloud.net/embed/?v=\\1" - } - ] - }, - "free": true, - "id": "wholecloud", - "name": "wholecloud", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ], - "thumbnail": "http://i.imgur.com/yIAQurm.png" -} \ No newline at end of file +{ + "active": true, + "find_videos": { + "ignore_urls": [], + "patterns": [ + { + "pattern": "((?:diskokosmiko.mx)/[^\\s'\"]+)", + "url": "http://\\1" + } + ] + }, + "free": true, + "id": "diskokosmoko", + "name": "diskokosmiko", + "settings": [ + { + "default": false, + "enabled": true, + "id": "black_list", + "label": "@60654", + "type": "bool", + "visible": true + }, + { + "default": 0, + "enabled": true, + "id": "favorites_servers_list", + "label": "@60655", + "lvalues": [ + "No", + "1", + "2", + "3", + "4", + "5" + ], + "type": "list", + "visible": false + } + ], + "thumbnail": "http://i.imgur.com/EjbfM7p.png?1", + "version": 1 +} diff --git a/plugin.video.alfa/servers/diskokosmiko.py b/plugin.video.alfa/servers/diskokosmiko.py new file mode 100644 index 00000000..9cc38e84 --- /dev/null +++ b/plugin.video.alfa/servers/diskokosmiko.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +from channels import kbagi +from core import httptools +from core import jsontools +from core import scrapertools +from platformcode import logger + + +def test_video_exists(page_url): + logger.info("(page_url='%s')" % page_url) + domain = "diskokosmiko.mx" + logueado, error_message = diskokosmiko.login(domain) + if not logueado: + return False, error_message + + data = httptools.downloadpage(page_url).data + if ("File was deleted" or "Not Found" or "File was locked by administrator") in data: + return False, "[%s] El archivo no existe o ha sido borrado" %domain + + return True, "" + + +def get_video_url(page_url, premium=False, user="", password="", video_password=""): + logger.info("(page_url='%s')" % page_url) + + video_urls = [] + data = httptools.downloadpage(page_url).data + host = "http://diskokosmiko.mx" + host_string = "diskokosmiko" + + url = scrapertools.find_single_match(data, '<form action="([^"]+)" class="download_form"') + if url: + url = host + url + fileid = url.rsplit("f=", 1)[1] + token = scrapertools.find_single_match(data, + '<div class="download_container">.*?name="__RequestVerificationToken".*?value="([^"]+)"') + post = "fileId=%s&__RequestVerificationToken=%s" % (fileid, token) + headers = {'X-Requested-With': 'XMLHttpRequest'} + data = httptools.downloadpage(url, post, headers).data + data = jsontools.load(data) + mediaurl = data.get("DownloadUrl") + extension = data.get("Extension") + + video_urls.append([".%s [%s]" % (extension, host_string), mediaurl]) + + for video_url in video_urls: + logger.info(" %s - %s" % (video_url[0], video_url[1])) + + return video_urls diff --git a/plugin.video.alfa/servers/gounlimited.py b/plugin.video.alfa/servers/gounlimited.py index dcf835af..ed02a6f5 100644 --- a/plugin.video.alfa/servers/gounlimited.py +++ b/plugin.video.alfa/servers/gounlimited.py @@ -24,9 +24,9 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= data = re.sub(r'"|\n|\r|\t| |<br>|\s{2,}', "", data) packed_data = scrapertools.find_single_match(data, "javascript'>(eval.*?)</script>") unpacked = jsunpack.unpack(packed_data) - patron = "file:(.*?),label:(.*?)}" + patron = "sources..([^\]]+)" matches = re.compile(patron, re.DOTALL).findall(unpacked) - for url, quality in matches: - video_urls.append(['%s' % quality, url]) - video_urls.sort(key=lambda x: int(x[0])) + for url in matches: + url += "|Referer=%s" %page_url + video_urls.append(['mp4', url]) return video_urls diff --git a/plugin.video.alfa/servers/nowvideo.json b/plugin.video.alfa/servers/nowvideo.json deleted file mode 100755 index c7298a48..00000000 --- a/plugin.video.alfa/servers/nowvideo.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "nowvideo.../(?:video/|embed.php\\?.*v=)([A-z0-9]+)", - "url": "http://www.nowvideo.sx/video/\\1" - } - ] - }, - "free": true, - "id": "nowvideo", - "name": "nowvideo", - "premium": [ - "nowvideo", - "realdebrid" - ], - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - }, - { - "default": false, - "enabled": true, - "id": "premium", - "label": "Activar cuenta premium", - "type": "bool", - "visible": true - }, - { - "default": "", - "enabled": "eq(-1,true)", - "id": "user", - "label": "@30014", - "type": "text", - "visible": true - }, - { - "default": "", - "enabled": "eq(-2,true)+!eq(-1,'')", - "hidden": true, - "id": "password", - "label": "@30015", - "type": "text", - "visible": true - } - ], - "thumbnail": "server_nowvideo.png" -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/nowvideo.py b/plugin.video.alfa/servers/nowvideo.py deleted file mode 100755 index 5fad7efb..00000000 --- a/plugin.video.alfa/servers/nowvideo.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -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) - url = page_url.replace("http://www.nowvideo.sx/video/", "http://embed.nowvideo.sx/embed/?v=") - data = httptools.downloadpage(url).data - if "The file is being converted" in data or "Please try again later" in data: - return False, "El fichero está en proceso" - elif "no longer exists" in data: - return False, "El fichero ha sido borrado" - return True, "" - - -def get_video_url(page_url, premium=False, user="", password="", video_password=""): - logger.info("(page_url='%s')" % page_url) - video_urls = [] - if premium: - login_url = "http://www.nowvideo.eu/login.php" - data = httptools.downloadpage(login_url).data - login_url = "http://www.nowvideo.eu/login.php?return=" - post = "user=" + user + "&pass=" + password + "®ister=Login" - headers = {"Referer": "http://www.nowvideo.eu/login.php"} - data = httptools.downloadpage(login_url, post, headers=headers).data - data = httptools.downloadpage(page_url).data - flashvar_file = scrapertools.get_match(data, 'flashvars.file="([^"]+)"') - flashvar_filekey = scrapertools.get_match(data, 'flashvars.filekey=([^;]+);') - flashvar_filekey = scrapertools.get_match(data, 'var ' + flashvar_filekey + '="([^"]+)"') - flashvar_user = scrapertools.get_match(data, 'flashvars.user="([^"]+)"') - flashvar_key = scrapertools.get_match(data, 'flashvars.key="([^"]+)"') - flashvar_type = scrapertools.get_match(data, 'flashvars.type="([^"]+)"') - url = "http://www.nowvideo.eu/api/player.api.php?user=" + flashvar_user + "&file=" + flashvar_file + "&pass=" + flashvar_key + "&cid=1&cid2=undefined&key=" + flashvar_filekey.replace( - ".", "%2E").replace("-", "%2D") + "&cid3=undefined" - data = httptools.downloadpage(url).data - location = scrapertools.get_match(data, 'url=([^\&]+)&') - location = location + "?client=FLASH" - video_urls.append([scrapertools.get_filename_from_url(location)[-4:] + " [premium][nowvideo]", location]) - else: - url = page_url.replace("http://www.nowvideo.sx/video/", "http://embed.nowvideo.sx/embed/?v=") - data = httptools.downloadpage(url).data - videourls = scrapertools.find_multiple_matches(data, 'src\s*:\s*[\'"]([^\'"]+)[\'"]') - if not videourls: - videourls = scrapertools.find_multiple_matches(data, '<source src=[\'"]([^\'"]+)[\'"]') - for videourl in videourls: - if videourl.endswith(".mpd"): - id = scrapertools.find_single_match(videourl, '/dash/(.*?)/') - videourl = "http://www.nowvideo.sx/download.php%3Ffile=mm" + "%s.mp4" % id - videourl = re.sub(r'/dl(\d)*/', '/dl/', videourl) - ext = scrapertools.get_filename_from_url(videourl)[-4:] - videourl = videourl.replace("%3F", "?") + \ - "|User-Agent=Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0" - video_urls.append([ext + " [nowvideo]", videourl]) - return video_urls diff --git a/plugin.video.alfa/servers/oboom.json b/plugin.video.alfa/servers/oboom.json deleted file mode 100755 index 13708a42..00000000 --- a/plugin.video.alfa/servers/oboom.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "(oboom.com/[a-zA-Z0-9]+)", - "url": "https://www.\\1" - } - ] - }, - "free": false, - "id": "oboom", - "name": "oboom", - "premium": [ - "realdebrid" - ], - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ] -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/oboom.py b/plugin.video.alfa/servers/oboom.py deleted file mode 100755 index e28083a1..00000000 --- a/plugin.video.alfa/servers/oboom.py +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- - -from platformcode import logger - - -def get_video_url(page_url, premium=False, user="", password="", video_password=""): - logger.info("(page_url='%s')" % page_url) - video_urls = [] - return video_urls diff --git a/plugin.video.alfa/servers/playwatch.json b/plugin.video.alfa/servers/playwatch.json deleted file mode 100755 index 48a0ed1a..00000000 --- a/plugin.video.alfa/servers/playwatch.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "playwatch.me/(?:embed/|)([A-z0-9]+)", - "url": "http://playwatch.me/embed/\\1" - } - ] - }, - "free": true, - "id": "playwatch", - "name": "playwatch", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ], - "thumbnail": "http://i.imgur.com/c7LwCTc.png?1" -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/playwatch.py b/plugin.video.alfa/servers/playwatch.py deleted file mode 100755 index cd19be00..00000000 --- a/plugin.video.alfa/servers/playwatch.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- - -import base64 - -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) - - response = httptools.downloadpage(page_url, follow_redirects=False) - - if not response.sucess or response.headers.get("location"): - return False, "[Playwatch] El fichero 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) - - data = httptools.downloadpage(page_url, follow_redirects=False).data - - code = scrapertools.find_single_match(data, ' tracker:\s*"([^"]+)"') - media_url = base64.b64decode(code) - ext = scrapertools.get_filename_from_url(media_url)[-4:] - video_urls = [["%s [playwatch]" % ext, media_url]] - - for video_url in video_urls: - logger.info("%s - %s" % (video_url[0], video_url[1])) - - return video_urls diff --git a/plugin.video.alfa/servers/playwire.json b/plugin.video.alfa/servers/playwire.json deleted file mode 100755 index f05e2a8b..00000000 --- a/plugin.video.alfa/servers/playwire.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "(?:cdn|config).playwire.com(?:/v2|)/(\\d+)/(?:embed|videos/v2|config)/(\\d+)", - "url": "http://config.playwire.com/\\1/videos/v2/\\2/zeus.json" - } - ] - }, - "free": true, - "id": "playwire", - "name": "playwire", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ] -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/playwire.py b/plugin.video.alfa/servers/playwire.py deleted file mode 100755 index 27e12fbb..00000000 --- a/plugin.video.alfa/servers/playwire.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -import xml.etree.ElementTree as ET - -from core import jsontools -from core import scrapertools -from platformcode import logger - - -def test_video_exists(page_url): - logger.info("(page_url='%s')" % page_url) - - data = scrapertools.cachePage(page_url) - if ("File was deleted" or "Not Found") in data: return False, "[playwire] 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) - - data = scrapertools.cachePage(page_url) - data = jsontools.load(data) - f4m = data['content']['media']['f4m'] - - video_urls = [] - data = scrapertools.downloadpageGzip(f4m) - - xml = ET.fromstring(data) - base_url = xml.find('{http://ns.adobe.com/f4m/1.0}baseURL').text - for media in xml.findall('{http://ns.adobe.com/f4m/1.0}media'): - if ".m3u8" in media.get('url'): continue - media_url = base_url + "/" + media.get('url') - try: - height = media.get('height') - width = media.get('width') - label = "(" + width + "x" + height + ")" - except: - label = "" - video_urls.append([scrapertools.get_filename_from_url(media_url)[-4:] + " " + label + " [playwire]", media_url]) - - for video_url in video_urls: - logger.info("%s - %s" % (video_url[0], video_url[1])) - - return video_urls diff --git a/plugin.video.alfa/servers/powvideo.py b/plugin.video.alfa/servers/powvideo.py index 685c4a9f..086f8896 100644 --- a/plugin.video.alfa/servers/powvideo.py +++ b/plugin.video.alfa/servers/powvideo.py @@ -15,7 +15,7 @@ headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/2 def test_video_exists(page_url): referer = page_url.replace('iframe', 'preview') data = httptools.downloadpage(page_url, headers={'referer': referer}).data - if data == "File was deleted": + if data == "File was deleted" or data == '': return False, "[powvideo] El video ha sido borrado" return True, "" @@ -33,26 +33,12 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= url = scrapertools.find_single_match(unpacked, "(?:src):\\\\'([^\\\\]+.mp4)\\\\'") - matches = scrapertools.find_single_match(data, "\['splice'\]\(0x([0-9a-fA-F]*),0x([0-9a-fA-F]*)\);") - if matches: - url = decode_powvideo_url(url, int(matches[0], 16), int(matches[1], 16)) - else: - matches = scrapertools.find_single_match(data, "\(0x([0-9a-fA-F]*),0x([0-9a-fA-F]*)\);") - if matches: - url = decode_powvideo_url(url, int(matches[0], 16), int(matches[1], 16)) - else: - logger.debug('No detectado splice! Revisar sistema de decode...') - # ~ logger.debug(data) - - itemlist.append([".mp4" + " [powvideo]", url]) + itemlist.append([".mp4" + " [powvideo]", decode_video_url(url)]) itemlist.sort(key=lambda x: x[0], reverse=True) return itemlist -def decode_powvideo_url(url, desde, num): +def decode_video_url(url): tria = re.compile('[0-9a-z]{40,}', re.IGNORECASE).findall(url)[0] gira = tria[::-1] - if desde == 0: - x = gira[num:] - else: - x = gira[:desde] + gira[(desde+num):] + x = gira[1:] return re.sub(tria, x, url) diff --git a/plugin.video.alfa/servers/rapidvideo.py b/plugin.video.alfa/servers/rapidvideo.py index 1b80d819..052bc9d0 100755 --- a/plugin.video.alfa/servers/rapidvideo.py +++ b/plugin.video.alfa/servers/rapidvideo.py @@ -7,22 +7,16 @@ from platformcode import config, logger def test_video_exists(page_url): logger.info("(page_url='%s')" % page_url) - try: - response = httptools.downloadpage(page_url) - except: - pass - + response = httptools.downloadpage(page_url) if response.code == 404: return False, config.get_localized_string(70449) % "RapidVideo" if not response.data or "urlopen error [Errno 1]" in str(response.code): - from platformcode import config if config.is_xbmc(): return False, config.get_localized_string(70302) % "RapidVideo" elif config.get_platform() == "plex": return False, config.get_localized_string(70303) % "RapidVideo" elif config.get_platform() == "mediaserver": return False, config.get_localized_string(70304) % "RapidVideo" - if "Object not found" in response.data: return False, config.get_localized_string(70449) % "RapidVideo" if response.code == 500: diff --git a/plugin.video.alfa/servers/rutube.json b/plugin.video.alfa/servers/rutube.json deleted file mode 100755 index 4dc196b2..00000000 --- a/plugin.video.alfa/servers/rutube.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "rutube.ru\\/(?:video\\/([\\da-zA-Z]{32})|play\\/embed\\/([\\d]+))", - "url": "http://rutube.ru/api/play/options/\\1/?format=json" - } - ] - }, - "free": true, - "id": "rutube", - "name": "rutube", - "premium": [ - "realdebrid" - ], - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ], - "thumbnail": "server_rutube.png" -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/rutube.py b/plugin.video.alfa/servers/rutube.py deleted file mode 100755 index 74b0824f..00000000 --- a/plugin.video.alfa/servers/rutube.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- - -from core import jsontools -from core import scrapertools -from platformcode import logger - - -def test_video_exists(page_url): - logger.info("(page_url='%s')" % page_url) - - data = scrapertools.cachePage(page_url) - if ("File was deleted" or "Not Found") in data: return False, "[rutube] 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) - - data = scrapertools.cachePage(page_url) - if "embed" in page_url: - link = scrapertools.find_single_match(data, '<link rel="canonical" href="https://rutube.ru/video/([\da-z]{32})') - url = "http://rutube.ru/api/play/options/%s/?format=json" % link - data = scrapertools.cachePage(url) - - data = jsontools.load(data) - m3u8 = data['video_balancer']['m3u8'] - data = scrapertools.downloadpageGzip(m3u8) - video_urls = [] - mediaurls = scrapertools.find_multiple_matches(data, '(http://.*?)\?i=(.*?)_') - for media_url, label in mediaurls: - video_urls.append([scrapertools.get_filename_from_url(media_url)[-4:] + " (" + label + ") [rutube]", media_url]) - - for video_url in video_urls: - logger.info("%s - %s" % (video_url[0], video_url[1])) - - return video_urls diff --git a/plugin.video.alfa/servers/streame.json b/plugin.video.alfa/servers/streame.json deleted file mode 100755 index 4aa906de..00000000 --- a/plugin.video.alfa/servers/streame.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "streame.net/(?:embed-|)([a-z0-9]+)", - "url": "http://streame.net/embed-\\1.html" - } - ] - }, - "free": true, - "id": "streame", - "name": "streame", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ] -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/streame.py b/plugin.video.alfa/servers/streame.py deleted file mode 100755 index fedde614..00000000 --- a/plugin.video.alfa/servers/streame.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from core import scrapertools -from platformcode import logger - - -def test_video_exists(page_url): - logger.info("(page_url='%s')" % page_url) - - data = scrapertools.cache_page(page_url) - if ("File was deleted" or "Not Found") in data: return False, "[Streame] 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) - - data = scrapertools.cache_page(page_url) - media_urls = scrapertools.find_multiple_matches(data, '\{file:"([^"]+)",label:"([^"]+)"\}') - video_urls = [] - for media_url, label in media_urls: - video_urls.append( - [scrapertools.get_filename_from_url(media_url)[-4:] + " (" + label + ") [streame]", media_url]) - - for video_url in video_urls: - logger.info("%s - %s" % (video_url[0], video_url[1])) - - return video_urls diff --git a/plugin.video.alfa/servers/thevideome.py b/plugin.video.alfa/servers/thevideome.py index 99f1bc10..8cc8b425 100755 --- a/plugin.video.alfa/servers/thevideome.py +++ b/plugin.video.alfa/servers/thevideome.py @@ -3,14 +3,14 @@ import urllib from core import httptools from core import scrapertools -from platformcode import logger +from platformcode import logger, config def test_video_exists(page_url): logger.info("(page_url='%s')" % page_url) - return True, "" + page_url = httptools.downloadpage(page_url, follow_redirects=False, only_headers=True).headers.get("location", "") data = httptools.downloadpage(page_url).data - if "File was deleted" in data or "Page Cannot Be Found" in data: + if "File was deleted" in data or "Page Cannot Be Found" in data or "<title>Video not found" in data: return False, "[thevideo.me] El archivo ha sido eliminado o no existe" return True, "" @@ -18,7 +18,7 @@ def test_video_exists(page_url): def get_video_url(page_url, premium=False, user="", password="", video_password=""): logger.info("url=" + page_url) video_urls = [] - post= {} + post = {} post = urllib.urlencode(post) if not "embed" in page_url: page_url = page_url.replace("https://thevideo.me/", "https://thevideo.me/embed-") + ".html" diff --git a/plugin.video.alfa/servers/veoh.json b/plugin.video.alfa/servers/veoh.json deleted file mode 100755 index 4ee14cb7..00000000 --- a/plugin.video.alfa/servers/veoh.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "href=\"http://www.veoh.com/.*?permalinkId=([^&\"]+)\"", - "url": "\\1" - }, - { - "pattern": "pattern=\"http://www.veoh.com/static/swf/webplayer/WebPlayer.swf.*?permalinkId=([^&]+)=videodetailsembedded=0=anonymous\"", - "url": "\\1" - } - ] - }, - "free": true, - "id": "veoh", - "name": "veoh", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ] -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/veoh.py b/plugin.video.alfa/servers/veoh.py deleted file mode 100755 index 52dd43be..00000000 --- a/plugin.video.alfa/servers/veoh.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from core import scrapertools -from platformcode import logger - - -# Returns an array of possible video url's from the page_url -def get_video_url(page_url, premium=False, user="", password="", video_password=""): - logger.info("(page_url='%s')" % page_url) - - video_urls = [] - - # Lo extrae a partir de flashvideodownloader.org - if page_url.startswith("http://"): - url = 'http://www.flashvideodownloader.org/download.php?u=' + page_url - else: - url = 'http://www.flashvideodownloader.org/download.php?u=http://www.veoh.com/watch/' + page_url - logger.info("url=" + url) - data = scrapertools.cachePage(url) - - # Extrae el vídeo - patronvideos = '<a href="(http://content.veoh.com.*?)"' - matches = re.compile(patronvideos, re.DOTALL).findall(data) - if len(matches) > 0: - video_urls.append(["[veoh]", matches[0]]) - - for video_url in video_urls: - logger.info("%s - %s" % (video_url[0], video_url[1])) - - return video_urls diff --git a/plugin.video.alfa/servers/vidabc.json b/plugin.video.alfa/servers/vidabc.json deleted file mode 100755 index 58201916..00000000 --- a/plugin.video.alfa/servers/vidabc.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "vidabc.com/(?:embed-|)([a-z0-9]+)", - "url": "http://vidabc.com/embed-\\1.html" - } - ] - }, - "free": true, - "id": "vidabc", - "name": "vidabc", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ] -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/vidabc.py b/plugin.video.alfa/servers/vidabc.py deleted file mode 100755 index 5b4b4550..00000000 --- a/plugin.video.alfa/servers/vidabc.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -from core.httptools import downloadpage -from core.scrapertools import get_match, find_multiple_matches -from platformcode import logger - -host = "http://vidabc.com" -id_server = "vidabc" - - -def test_video_exists(page_url): - logger.info("(page_url='%s')" % page_url) - data = downloadpage(page_url).data - if "Video is processing now" in data: - return False, "[vidabc] El archivo se está procesando" - if "File was deleted" in data: - return False, "[vidabc] El archivo ha sido borrado" - return True, "" - - -def get_video_url(page_url, premium=False, user="", password="", video_password=""): - logger.info("(page_url='%s')" % page_url) - - data = downloadpage(page_url).data - - try: - sources = get_match(data, 'sources\s*:\s* \[([^\]]+)\]') - except: - from lib import jsunpack - sources = jsunpack.unpack(get_match(data, '<script[^>]*>(eval.function.p,a,c,k,e,.*?)</script>')) - sources = get_match(sources, 'sources\s*:\s*\[([^\]]+)\]') - - video_urls = [] - for media_url in find_multiple_matches(sources, '"([^"]+)"'): - if media_url.endswith(".mp4"): - video_urls.append([".mp4 [%s]" % id_server, media_url]) - - if media_url.endswith(".m3u8"): - video_urls.append(["M3U8 [%s]" % id_server, media_url]) - - if media_url.endswith(".smil"): - smil_data = downloadpage(media_url).data - - rtmp = get_match(smil_data, 'base="([^"]+)"') - playpaths = find_multiple_matches(smil_data, 'src="([^"]+)" height="(\d+)"') - - for playpath, inf in playpaths: - h = get_match(playpath, 'h=([a-z0-9]+)') - video_urls.append(["RTMP [%s] %s" % (id_server, inf), "%s playpath=%s" % (rtmp, playpath)]) - - for video_url in video_urls: - logger.info("video_url: %s - %s" % (video_url[0], video_url[1])) - - return video_urls diff --git a/plugin.video.alfa/servers/videowood.json b/plugin.video.alfa/servers/videowood.json deleted file mode 100755 index 80c1d189..00000000 --- a/plugin.video.alfa/servers/videowood.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "(https?://(?:www.)?videowood.tv/)(?:embed|video)(/[0-9a-z]+)", - "url": "\\1embed\\2" - } - ] - }, - "free": true, - "id": "videowood", - "name": "videowood", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ] -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/videowood.py b/plugin.video.alfa/servers/videowood.py deleted file mode 100755 index e9d86825..00000000 --- a/plugin.video.alfa/servers/videowood.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -from aadecode import decode as aadecode -from core import scrapertools -from core import httptools -from platformcode import logger - - -def test_video_exists(page_url): - logger.info("(page_url='%s')" % page_url) - data = httptools.downloadpage(page_url).data - if "This video doesn't exist." in data: - return False, '[videowood] El video no puede ser encontrado o ha sido eliminado.' - 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 - text_encode = scrapertools.find_single_match(data, "(eval\(function\(p,a,c,k,e,d.*?)</script>") - text_decode = aadecode(text_encode) - patron = "'([^']+)'" - media_url = scrapertools.find_single_match(text_decode, patron) - video_urls.append([media_url[-4:] + " [Videowood]", media_url]) - return video_urls diff --git a/plugin.video.alfa/servers/vidgg.json b/plugin.video.alfa/servers/vidgg.json deleted file mode 100755 index 37e9820f..00000000 --- a/plugin.video.alfa/servers/vidgg.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "(?:vidgg.to|vid.gg)/(?:embed/|video/)([a-z0-9]+)", - "url": "http://vidgg.to/video/\\1" - } - ] - }, - "free": true, - "id": "vidgg", - "name": "vidgg", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ] -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/vidgg.py b/plugin.video.alfa/servers/vidgg.py deleted file mode 100755 index bee86e1e..00000000 --- a/plugin.video.alfa/servers/vidgg.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -from core import httptools -from core import jsontools -from core import scrapertools -from platformcode import logger - - -def test_video_exists(page_url): - logger.info("(page_url='%s')" % page_url) - data = jsontools.load(httptools.downloadpage("http://www.vidgg.to/api-v2/alive.php?link=" + page_url).data) - if data["data"] == "NOT_FOUND" or data["data"] == "FAILED": - return False, "[Vidgg] El archivo no existe o ha sido borrado" - elif data["data"] == "CONVERTING": - return False, "[Vidgg] El archivo se está procesando" - else: - return True, "" - - -def get_video_url(page_url, premium=False, user="", password="", video_password=""): - logger.info("(page_url='%s')" % page_url) - - video_urls = [] - data = httptools.downloadpage(page_url).data - - mediaurls = scrapertools.find_multiple_matches(data, '<source src="([^"]+)"') - if not mediaurls: - id_file = page_url.rsplit("/", 1)[1] - key = scrapertools.find_single_match(data, 'flashvars\.filekey\s*=\s*"([^"]+)"') - if not key: - varkey = scrapertools.find_single_match(data, 'flashvars\.filekey\s*=\s*([^;]+);') - key = scrapertools.find_single_match(data, varkey + '\s*=\s*"([^"]+)"') - - # Primera url, se extrae una url erronea necesaria para sacar el enlace - url = "http://www.vidgg.to//api/player.api.php?cid2=undefined&cid=undefined&numOfErrors=0&user=undefined&cid3=undefined&key=%s&file=%s&pass=undefined" % ( - key, id_file) - data = httptools.downloadpage(url).data - - url_error = scrapertools.find_single_match(data, 'url=([^&]+)&') - url = "http://www.vidgg.to//api/player.api.php?cid2=undefined&cid=undefined&numOfErrors=1&errorUrl=%s&errorCode=404&user=undefined&cid3=undefined&key=%s&file=%s&pass=undefined" % ( - url_error, key, id_file) - data = httptools.downloadpage(url).data - mediaurls = scrapertools.find_multiple_matches(data, 'url=([^&]+)&') - - for i, mediaurl in enumerate(mediaurls): - title = scrapertools.get_filename_from_url(mediaurl)[-4:] + " Mirror %s [vidgg]" % str(i + 1) - mediaurl += "|User-Agent=Mozilla/5.0" - video_urls.append([title, mediaurl]) - - for video_url in video_urls: - logger.info(" %s - %s" % (video_url[0], video_url[1])) - - return video_urls diff --git a/plugin.video.alfa/servers/vidgot.py b/plugin.video.alfa/servers/vidgot.py deleted file mode 100755 index 2feaf315..00000000 --- a/plugin.video.alfa/servers/vidgot.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- - -from core import httptools -from core import scrapertools -from lib import jsunpack -from platformcode import logger - - -def test_video_exists(page_url): - logger.info("(page_url='%s')" % page_url) - - data = httptools.downloadpage(page_url).data - - if "File was deleted" in data: - return False, "[Vidgot] El fichero ha sido borrado de novamov" - - return True, "" - - -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 - data_js = scrapertools.find_single_match(data, "<script type='text/javascript'>(eval\(function.*?)</script>") - data_js = jsunpack.unpack(data_js) - - mediaurls = scrapertools.find_multiple_matches(data_js, '\{file\s*:\s*"([^"]+)"\}') - - video_urls = [] - for mediaurl in mediaurls: - ext = scrapertools.get_filename_from_url(mediaurl)[-4:] - if "mp4" not in ext and "m3u8" not in ext: - continue - video_urls.append([ext + " [vidgot]", mediaurl]) - - return video_urls diff --git a/plugin.video.alfa/servers/vidlox.json b/plugin.video.alfa/servers/vidlox.json index e5774ed9..12c4c071 100644 --- a/plugin.video.alfa/servers/vidlox.json +++ b/plugin.video.alfa/servers/vidlox.json @@ -1,42 +1,42 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "(?i)(https://vidlox.(?:tv|me)/embed-.*?.html)", - "url": "\\1" - } - ] - }, - "free": true, - "id": "vidlox", - "name": "vidlox", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ], - "thumbnail": "https://s1.postimg.cc/wathgtvin/logo-vidlox1.png" -} +{ + "active": true, + "find_videos": { + "ignore_urls": [], + "patterns": [ + { + "pattern": "(?i)(https://vidlox.(?:tv|me)/embed-.*?.html)", + "url": "\\1" + } + ] + }, + "free": true, + "id": "vidlox", + "name": "vidlox", + "settings": [ + { + "default": false, + "enabled": true, + "id": "black_list", + "label": "@60654", + "type": "bool", + "visible": true + }, + { + "default": 0, + "enabled": true, + "id": "favorites_servers_list", + "label": "@60655", + "lvalues": [ + "No", + "1", + "2", + "3", + "4", + "5" + ], + "type": "list", + "visible": false + } + ], + "thumbnail": "https://s1.postimg.cc/wathgtvin/logo-vidlox1.png" +} diff --git a/plugin.video.alfa/servers/vidzella.json b/plugin.video.alfa/servers/vidzella.json deleted file mode 100644 index e84d80bf..00000000 --- a/plugin.video.alfa/servers/vidzella.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "https://vidzella.me/e/([a-zA-Z0-9]+)", - "url": "https://vidzella.me/e/\\1" - } - ] - }, - "free": true, - "id": "vidzella", - "name": "vidzella", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ], - "thumbnail": "https://s15.postimg.cc/albqao5pn/vidzella.png" -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/vidzella.py b/plugin.video.alfa/servers/vidzella.py deleted file mode 100644 index a83b1b66..00000000 --- a/plugin.video.alfa/servers/vidzella.py +++ /dev/null @@ -1,33 +0,0 @@ -# Conector Vidzella By Alfa development Group -# -------------------------------------------------------- - -import re -from core import httptools -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, "[Vidzella] 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=([^ ]+) type='.*?/(.*?)'" - matches = re.compile(patron, re.DOTALL).findall(data) - - for url, type in matches: - video_urls.append(['vidzella %s' % type, url]) - - return video_urls diff --git a/plugin.video.alfa/servers/watchers.json b/plugin.video.alfa/servers/watchers.json deleted file mode 100755 index 726b6510..00000000 --- a/plugin.video.alfa/servers/watchers.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "watchers.to/(?:embed-|)([A-z0-9]+)", - "url": "http://watchers.to/embed-\\1.html" - } - ] - }, - "free": true, - "id": "watchers", - "name": "watchers", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@60654", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ], - "thumbnail": "http://i.imgur.com/WApzSMn.png?1" -} \ No newline at end of file diff --git a/plugin.video.alfa/servers/watchers.py b/plugin.video.alfa/servers/watchers.py deleted file mode 100755 index 286afa86..00000000 --- a/plugin.video.alfa/servers/watchers.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- - -from core import httptools -from core import scrapertools -from lib import jsunpack -from platformcode import logger - - -def test_video_exists(page_url): - logger.info("(page_url='%s')" % page_url) - - data = httptools.downloadpage(page_url).data - if "File Not Found" in data: - return False, "[Watchers] 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=%s" % page_url) - video_urls = [] - - data = httptools.downloadpage(page_url).data - packed = scrapertools.find_single_match(data, '(eval\(function\(p,a,c,k,e.*?)</script>').strip() - unpack = jsunpack.unpack(packed) - - bloque = scrapertools.find_single_match(unpack, 'sources:\[(.*?)\}\]') - matches = scrapertools.find_multiple_matches(bloque, 'file:"([^"]+)"(?:,label:"([^"]+)"|\})') - for media_url, calidad in matches: - ext = scrapertools.get_filename_from_url(media_url)[-4:] - if calidad: - ext += " " + calidad + "p" - media_url += "|Referer=%s" % page_url - video_urls.append([ext + ' [watchers]', media_url]) - - return video_urls diff --git a/plugin.video.alfa/servers/watchvideo.py b/plugin.video.alfa/servers/watchvideo.py index 43bea8fc..d38c039e 100755 --- a/plugin.video.alfa/servers/watchvideo.py +++ b/plugin.video.alfa/servers/watchvideo.py @@ -18,8 +18,13 @@ 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 - media_urls = scrapertools.find_multiple_matches(data, 'file:"([^"]+)"') + packed = scrapertools.find_single_match(data, "text/javascript'>(.*?)\s*</script>") + unpacked = jsunpack.unpack(packed) + media_urls = scrapertools.find_multiple_matches(unpacked, 'file:"([^"]+)"') for media_url in media_urls: + media_url += "|Referer=%s" %page_url + if ".png" in media_url: + continue ext = "mp4" if "m3u8" in media_url: ext = "m3u8" diff --git a/plugin.video.alfa/servers/wholecloud.py b/plugin.video.alfa/servers/wholecloud.py deleted file mode 100755 index 5905f9d2..00000000 --- a/plugin.video.alfa/servers/wholecloud.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -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).data - - if "This file no longer exists on our servers" in data: - return False, "[wholecloud] El archivo ha sido eliminado o no existe" - if "This video is not yet ready" in data: - return False, "[wholecloud] El archivo no está listo, se está subiendo o convirtiendo" - - return True, "" - - -def get_video_url(page_url, premium=False, user="", password="", video_password=""): - logger.info("url=" + page_url) - - data = httptools.downloadpage(page_url).data - - video_urls = [] - media_urls = scrapertools.find_multiple_matches(data, '<source src="([^"]+)"') - if not media_urls: - media_url = scrapertools.find_single_match(data, 'src="/api/toker.php\?f=([^"]+)"') - ext = scrapertools.get_filename_from_url(media_url)[-4:] - media_url = "http://wholecloud.net/download.php?file=%s|User-Agent=Mozilla/5.0" % media_url - video_urls.append([ext + " [wholecloud]", media_url]) - else: - for media_url in media_urls: - ext = scrapertools.get_filename_from_url(media_url)[-4:] - media_url += "|User-Agent=Mozilla/5.0" - video_urls.append([ext + " [wholecloud]", media_url]) - - return video_urls