From ae2058b5e95410b60566716bfaac0ebe8a5933d7 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sat, 30 Sep 2017 16:01:40 -0500 Subject: [PATCH 01/14] Actualizado allpeliculas: fix --- plugin.video.alfa/channels/allpeliculas.py | 511 ++++----------------- 1 file changed, 97 insertions(+), 414 deletions(-) diff --git a/plugin.video.alfa/channels/allpeliculas.py b/plugin.video.alfa/channels/allpeliculas.py index 089ad59f..303f80ff 100644 --- a/plugin.video.alfa/channels/allpeliculas.py +++ b/plugin.video.alfa/channels/allpeliculas.py @@ -1,10 +1,12 @@ # -*- coding: utf-8 -*- -import string +import urlparse 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 @@ -22,6 +24,7 @@ SERVERS = {"26": "powvideo", "45": "okru", "75": "openload", "12": "netutv", "65 "67": "spruto", "71": "stormo", "73": "idowatch", "48": "okru", "55": "openload", "20": "nowvideo", "84": "fastplay", "96": "raptu", "94": "tusfiles"} +host = "http://allpeliculas.com/" def mainlist(item): logger.info() @@ -29,32 +32,111 @@ def mainlist(item): item.text_color = color1 itemlist.append(item.clone(title="Películas", action="lista", fanart="http://i.imgur.com/c3HS8kj.png", - url="http://allpeliculas.co/Movies/fullView/1/0/&ajax=1")) - itemlist.append(item.clone(title="Series", action="lista", fanart="http://i.imgur.com/9loVksV.png", extra="tv", - url="http://allpeliculas.co/Movies/fullView/1/86/?ajax=1&withoutFilter=1", )) - itemlist.append(item.clone(title="Géneros", action="subindice", fanart="http://i.imgur.com/ymazCWq.jpg")) - itemlist.append(item.clone(title="Índices", action="indices", fanart="http://i.imgur.com/c3HS8kj.png")) + url= host + "movies/newmovies?page=1", extra1 = 0)) + itemlist.append(item.clone(title="Por genero", action="generos", fanart="http://i.imgur.com/c3HS8kj.png", + url= host + "movies/getGanres")) itemlist.append(item.clone(title="", action="")) itemlist.append(item.clone(title="Buscar...", action="search")) - itemlist.append(item.clone(action="configuracion", title="Configurar canal...", text_color="gold", folder=False)) return itemlist -def configuracion(item): - from platformcode import platformtools - ret = platformtools.show_channel_settings() - platformtools.itemlist_refresh() - return ret +def generos(item): + logger.info() + itemlist = [] + data = httptools.downloadpage(item.url).data + dict_data = jsontools.load(data) + for it in dict_data: + itemlist.append(Item( + channel = item.channel, + action = "lista", + title = it['label'], + url = host + "movies/newmovies?page=1", + extra1 = it['id'] + )) + return itemlist + +def findvideos(item): + logger.info() + itemlist = [] + data = httptools.downloadpage(item.url).data + patron = 'data-link="([^"]+).*?' + patron += '>([^<]+)' + matches = scrapertools.find_multiple_matches(data, patron) + for url, calidad in matches: + itemlist.append(Item( + channel = item.channel, + action = "play", + title = calidad, + url = url, + )) + itemlist = servertools.get_servers_itemlist(itemlist) + itemlist.append(Item(channel=item.channel)) + if config.get_videolibrary_support(): + itemlist.append(Item(channel=item.channel, title="Añadir a la videoteca", text_color="green", + filtro=True, action="add_pelicula_to_library", url=item.url, thumbnail = item.thumbnail, + infoLabels={'title': item.fulltitle}, fulltitle=item.fulltitle, + extra="library")) + try: + tmdb.set_infoLabels(itemlist, __modo_grafico__) + except: + pass + + return itemlist + + +def lista(item): + logger.info() + itemlist = [] + dict_param = dict() + item.infoLabels = {} + item.text_color = color2 + + params = '{}' + if item.extra1 != 0: + dict_param["genero"] = [item.extra1] + params = jsontools.dump(dict_param) + + data = httptools.downloadpage(item.url, post=params).data + dict_data = jsontools.load(data) + + for it in dict_data["items"]: + title = it["title"] + plot = it["slogan"] + rating = it["imdb"] + year = it["year"] + url = host + "pelicula/" + it["slug"] + thumb = urlparse.urljoin(host, it["image"]) + item.infoLabels['year'] = year + itemlist.append(item.clone(action="findvideos", title=title, fulltitle=title, url=url, thumbnail=thumb, + plot=plot, context=["buscar_trailer"], contentTitle=title, contentType="movie")) + + pagina = scrapertools.find_single_match(item.url, 'page=([0-9]+)') + item.url = item.url.replace(pagina, "") + if pagina == "": + pagina = "0" + pagina = int(pagina) + 1 + item.url = item.url + "%s" %pagina + if item.extra != "busqueda": + itemlist.append(Item(channel = item.channel, action="lista", title="Pagina %s" %pagina, url=item.url, extra1 = item.extra1 + )) + try: + # Obtenemos los datos basicos de todas las peliculas mediante multihilos + tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__) + except: + pass + + return itemlist def search(item, texto): logger.info() if texto != "": texto = texto.replace(" ", "+") - item.url = "http://allpeliculas.co/Search/advancedSearch?searchType=movie&movieName=" + texto + "&ajax=1" + item.url = host + "/movies/search/" + texto + item.extra = "busqueda" try: - return busqueda(item) + return lista(item) except: import sys for line in sys.exc_info(): @@ -68,7 +150,7 @@ def newest(categoria): item = Item() try: if categoria == "peliculas": - item.url = "http://allpeliculas.co/Movies/fullView/1/0/&ajax=1" + item.url = host + "movies/newmovies?page=1" item.action = "lista" itemlist = lista(item) @@ -83,402 +165,3 @@ def newest(categoria): return [] return itemlist - - -def busqueda(item): - logger.info() - itemlist = [] - item.infoLabels = {} - item.text_color = color2 - - data = httptools.downloadpage(item.url).data - data = data.replace("\n", "").replace("\t", "") - data = scrapertools.decodeHtmlentities(data) - - patron = '(.*?)/.*?' \ - ' (.*?)

.*?Género: (.*?)

' - matches = scrapertools.find_multiple_matches(data, patron) - for thumbnail, vote, url, title, year, genre in matches: - url = "http://allpeliculas.co" + url.replace("#", "") + "&ajax=1" - thumbnail = thumbnail.replace("/105/", "/400/").replace("/141/", "/600/").replace(" ", "%20") - titulo = title + " (" + year + ")" - item.infoLabels['year'] = year - item.infoLabels['genre'] = genre - item.infoLabels['rating'] = vote - if "Series" not in genre: - itemlist.append(item.clone(action="findvideos", title=titulo, fulltitle=title, url=url, thumbnail=thumbnail, - context=["buscar_trailer"], contentTitle=title, contentType="movie")) - else: - itemlist.append(item.clone(action="temporadas", title=titulo, fulltitle=title, url=url, thumbnail=thumbnail, - context=["buscar_trailer"], contentTitle=title, contentType="tvshow")) - - # Paginacion - next_page = scrapertools.find_single_match(data, 'class="pagination-active".*?href="([^"]+)"') - if next_page != "": - url = next_page.replace("#", "") + "&ajax=1" - itemlist.append(item.clone(action="lista", title=">> Siguiente", url=url, text_color=color3)) - - return itemlist - - -def indices(item): - logger.info() - itemlist = [] - item.text_color = color1 - - itemlist.append(item.clone(title="Alfabético", action="subindice")) - itemlist.append(item.clone(title="Por idioma", action="subindice")) - itemlist.append(item.clone(title="Por valoración", action="lista", - url="http://allpeliculas.co/Movies/fullView/1/0/rating:imdb|date:1900-3000|" - "alphabet:all|?ajax=1&withoutFilter=1")) - itemlist.append(item.clone(title="Por año", action="subindice")) - itemlist.append(item.clone(title="Por calidad", action="subindice")) - - return itemlist - - -def lista(item): - logger.info() - itemlist = [] - item.infoLabels = {} - item.text_color = color2 - - data = httptools.downloadpage(item.url).data - data = data.replace("\n", "").replace("\t", "") - data = scrapertools.decodeHtmlentities(data) - - bloque = scrapertools.find_single_match(data, '
([^<]+)<\/span>|
)' \ - '.*?
(.*?).*?Year.*?">(.*?).*?' \ - '(?:Género|Genre).*?(.*?).*?Language.*?(.*?).*?' \ - '
(.*?)<.*?
(.*?)<.*?' \ - '
(.*?)<' - - if bloque == "": - bloque = data[:] - matches = scrapertools.find_multiple_matches(bloque, patron) - for thumbnail, url, trailer, vote, year, genre, idioma, sinopsis, calidad, title in matches: - url = url.replace("#", "") + "&ajax=1" - thumbnail = thumbnail.replace("/157/", "/400/").replace("/236/", "/600/").replace(" ", "%20") - idioma = idioma.replace(" ", "").split(",") - idioma.sort() - titleidioma = "[" + "/".join(idioma) + "]" - - titulo = title + " " + titleidioma + " [" + calidad + "]" - item.infoLabels['plot'] = sinopsis - item.infoLabels['year'] = year - item.infoLabels['genre'] = genre - item.infoLabels['rating'] = vote - item.infoLabels['trailer'] = trailer.replace("youtu.be/", "http://www.youtube.com/watch?v=") - if item.extra != "tv" or "Series" not in genre: - itemlist.append(item.clone(action="findvideos", title=titulo, fulltitle=title, url=url, thumbnail=thumbnail, - context=["buscar_trailer"], contentTitle=title, contentType="movie")) - else: - itemlist.append(item.clone(action="temporadas", title=titulo, fulltitle=title, url=url, thumbnail=thumbnail, - context=["buscar_trailer"], contentTitle=title, show=title, - contentType="tvshow")) - - try: - from core import tmdb - # Obtenemos los datos basicos de todas las peliculas mediante multihilos - tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__) - except: - pass - # Paginacion - next_page = scrapertools.find_single_match(data, 'class="pagination-active".*?href="([^"]+)"') - if next_page != "": - url = next_page.replace("#", "") + "&ajax=1" - itemlist.append(item.clone(action="lista", title=">> Siguiente", url=url, text_color=color3)) - - return itemlist - - -def subindice(item): - logger.info() - itemlist = [] - - url_base = "http://allpeliculas.co/Movies/fullView/1/0/date:1900-3000|alphabet:all|?ajax=1&withoutFilter=1" - indice_genero, indice_alfa, indice_idioma, indice_year, indice_calidad = dict_indices() - if "Géneros" in item.title: - for key, value in indice_genero.items(): - url = url_base.replace("/0/", "/" + key + "/") - itemlist.append(item.clone(action="lista", title=value, url=url)) - itemlist.sort(key=lambda item: item.title) - - elif "Alfabético" in item.title: - for i in range(len(indice_alfa)): - url = url_base.replace(":all", ":" + indice_alfa[i]) - itemlist.append(item.clone(action="lista", title=indice_alfa[i], url=url)) - - elif "Por idioma" in item.title: - for key, value in indice_idioma.items(): - url = url_base.replace("3000|", "3000|language:" + key) - itemlist.append(item.clone(action="lista", title=value, url=url)) - itemlist.sort(key=lambda item: item.title) - - elif "Por año" in item.title: - for i in range(len(indice_year)): - year = indice_year[i] - url = url_base.replace("1900-3000", year + "-" + year) - itemlist.append(item.clone(action="lista", title=year, url=url)) - - elif "Por calidad" in item.title: - for key, value in indice_calidad.items(): - url = "http://allpeliculas.co/Search/advancedSearch?searchType=movie&movieName=&movieDirector=&movieGenre" \ - "=&movieActor=&movieYear=&language=&movieTypeId=" + key + "&ajax=1" - itemlist.append(item.clone(action="busqueda", title=value, url=url)) - itemlist.sort(key=lambda item: item.title) - - return itemlist - - -def findvideos(item): - logger.info() - itemlist = [] - item.text_color = color3 - - # Rellena diccionarios idioma y calidad - idiomas_videos, calidad_videos = dict_videos() - - data = httptools.downloadpage(item.url).data - data = data.replace("\n", "").replace("\t", "") - data = scrapertools.decodeHtmlentities(data) - - if item.extra != "library": - try: - from core import tmdb - tmdb.set_infoLabels(item, __modo_grafico__) - except: - pass - - # Enlaces Online - patron = '([^<]+)') - item.infoLabels['trailer'] = trailer_url.replace("youtu.be/", "http://www.youtube.com/watch?v=") - - itemlist.append(item.clone(channel="trailertools", action="buscartrailer", title="Buscar Tráiler", - text_color="magenta", context="")) - if item.extra != "library": - if config.get_videolibrary_support(): - itemlist.append(Item(channel=item.channel, title="Añadir película a la videoteca", - action="add_pelicula_to_library", url=item.url, text_color="green", - infoLabels={'title': item.fulltitle}, fulltitle=item.fulltitle, - extra="library")) - - return itemlist - - -def temporadas(item): - logger.info() - itemlist = [] - data = httptools.downloadpage(item.url).data - try: - from core import tmdb - tmdb.set_infoLabels_item(item, __modo_grafico__) - except: - pass - - matches = scrapertools.find_multiple_matches(data, '([^<]+)') - item.infoLabels['trailer'] = trailer_url.replace("youtu.be/", "http://www.youtube.com/watch?v=") - - itemlist.append(item.clone(channel="trailertools", action="buscartrailer", title="Buscar Tráiler", - text_color="magenta", context="")) - - return itemlist - - -def episodios(item): - logger.info() - itemlist = [] - - # Rellena diccionarios idioma y calidad - idiomas_videos, calidad_videos = dict_videos() - - data = httptools.downloadpage(item.url).data - data = data.replace("\n", "").replace("\t", "") - data = scrapertools.decodeHtmlentities(data) - - patron = '
  • ]+season="' + str(item.infoLabels['season']) + '"[^>]+>([^<]+)
  • ' - matches = scrapertools.find_multiple_matches(data, patron) - capitulos = [] - for title in matches: - if not title in capitulos: - episode = int(title.split(" ")[1]) - capitulos.append(title) - itemlist.append( - item.clone(action="findvideostv", title=title, contentEpisodeNumber=episode, contentType="episode")) - - itemlist.sort(key=lambda item: item.contentEpisodeNumber) - try: - from core import tmdb - tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__) - except: - pass - for item in itemlist: - if item.infoLabels["episodio_titulo"]: - item.title = "%dx%02d: %s" % ( - item.contentSeason, item.contentEpisodeNumber, item.infoLabels["episodio_titulo"]) - else: - item.title = "%dx%02d: %s" % (item.contentSeason, item.contentEpisodeNumber, item.title) - - return itemlist - - -def findvideostv(item): - logger.info() - itemlist = [] - - # Rellena diccionarios idioma y calidad - idiomas_videos, calidad_videos = dict_videos() - - data = httptools.downloadpage(item.url).data - data = data.replace("\n", "").replace("\t", "") - data = scrapertools.decodeHtmlentities(data) - - patron = '') - matches = scrapertools.find_multiple_matches(bloque_idioma, '') - for key1, key2 in matches: - idiomas_videos[key1] = unicode(key2, "utf8").capitalize().encode("utf8") - bloque_calidad = scrapertools.find_single_match(data, '') - matches = scrapertools.find_multiple_matches(bloque_genero, '') - for key1, key2 in matches: - if key2 != "Series": - if key2 == "Mystery": - key2 = "Misterio" - indice_genero[key1] = key2 - bloque_year = scrapertools.find_single_match(data, '') - matches = scrapertools.find_multiple_matches(bloque_calidad, '') - for key1, key2 in matches: - indice_calidad[key1] = key2 - - return indice_genero, indice_alfa, indice_idioma, indice_year, indice_calidad From d09200ebad2c99253cecd3415892647ff636357c Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sat, 30 Sep 2017 16:12:40 -0500 Subject: [PATCH 02/14] Update allpeliculas.py --- plugin.video.alfa/channels/allpeliculas.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.video.alfa/channels/allpeliculas.py b/plugin.video.alfa/channels/allpeliculas.py index 303f80ff..63481210 100644 --- a/plugin.video.alfa/channels/allpeliculas.py +++ b/plugin.video.alfa/channels/allpeliculas.py @@ -76,8 +76,8 @@ def findvideos(item): if config.get_videolibrary_support(): itemlist.append(Item(channel=item.channel, title="Añadir a la videoteca", text_color="green", filtro=True, action="add_pelicula_to_library", url=item.url, thumbnail = item.thumbnail, - infoLabels={'title': item.fulltitle}, fulltitle=item.fulltitle, - extra="library")) + infoLabels={'title': item.fulltitle}, fulltitle=item.fulltitle + )) try: tmdb.set_infoLabels(itemlist, __modo_grafico__) except: From fb4044b5b4358a6fc2fc3e62d60d4b6d7f8552d7 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 08:46:36 -0500 Subject: [PATCH 03/14] Add files via upload --- plugin.video.alfa/channels/zonatorrent.json | 24 ++++ plugin.video.alfa/channels/zonatorrent.py | 150 ++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 plugin.video.alfa/channels/zonatorrent.json create mode 100644 plugin.video.alfa/channels/zonatorrent.py diff --git a/plugin.video.alfa/channels/zonatorrent.json b/plugin.video.alfa/channels/zonatorrent.json new file mode 100644 index 00000000..f752dadf --- /dev/null +++ b/plugin.video.alfa/channels/zonatorrent.json @@ -0,0 +1,24 @@ +{ + "id": "zonatorrent", + "name": "ZonaTorrent", + "active": true, + "adult": false, + "language": ["cast", "lat"], + "banner": "", + "thumbnail": "https://zonatorrent.org/wp-content/uploads/2017/04/zonatorrent-New-Logo.png", + "version": 1, + "categories": [ + "torrent", + "movie" + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": true, + "enabled": true, + "visible": true + } + ] +} \ No newline at end of file diff --git a/plugin.video.alfa/channels/zonatorrent.py b/plugin.video.alfa/channels/zonatorrent.py new file mode 100644 index 00000000..2f410e90 --- /dev/null +++ b/plugin.video.alfa/channels/zonatorrent.py @@ -0,0 +1,150 @@ +# -*- coding: utf-8 -*- + +import re + +from channelselector import get_thumb +from core import httptools +from core import scrapertools +from core import servertools +from core.item import Item +from platformcode import logger + +HOST = 'https://zonatorrent.org' + + +def mainlist(item): + logger.info() + + itemlist = list() + itemlist.append(Item(channel=item.channel, title="Últimas Películas", action="listado", url=HOST, page=False)) + itemlist.append(Item(channel=item.channel, title="Alfabético", action="alfabetico")) + itemlist.append(Item(channel=item.channel, title="Géneros", action="generos", url=HOST)) + itemlist.append(Item(channel=item.channel, title="Más vistas", action="listado", url=HOST + "/peliculas-mas-vistas/")) + itemlist.append(Item(channel=item.channel, title="Más votadas", action="listado", url=HOST + "/peliculas-mas-votadas/")) + itemlist.append(Item(channel=item.channel, title="Castellano", action="listado", url=HOST + "/?s=spanish", + page=True)) + itemlist.append(Item(channel=item.channel, title="Latino", action="listado", url=HOST + "/?s=latino", page=True)) + itemlist.append(Item(channel=item.channel, title="Subtitulado", action="listado", url=HOST + "/?s=Subtitulado", + page=True)) + itemlist.append(Item(channel=item.channel, title="Con Torrent", action="listado", url=HOST + "/?s=torrent", + page=True)) + itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=HOST + "/?s=", + page=False)) + + return itemlist + + +def alfabetico(item): + logger.info() + + itemlist = [] + + for letra in "#ABCDEFGHIJKLMNOPQRSTUVWXYZ": + itemlist.append(Item(channel=item.channel, action="listado", title=letra, page=True, + url=HOST + "/letters/%s/" % letra.replace("#", "0-9"))) + + return itemlist + + +def generos(item): + logger.info() + + itemlist = [] + + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + data = scrapertools.find_single_match(data, 'Generos(.*?)') + matches = scrapertools.find_multiple_matches(data, '(.*?)') + + for url, title in matches: + itemlist.append(Item(channel=item.channel, action="listado", title=title, url=url, page=True)) + + return itemlist + + +def search(item, texto): + logger.info() + item.url = item.url + texto.replace(" ", "+") + + try: + itemlist = listado(item) + except: + import sys + for line in sys.exc_info(): + logger.error("%s" % line) + return [] + + return itemlist + + +def listado(item): + logger.info() + + itemlist = [] + + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + + pattern = ']+>]+>]+src="(?P[^"]+)"[^>]+>
    ' \ + '

    (?P.*?)</h2>.*?<span class="Time[^>]+>(?P<duration>.*?)</span><span ' \ + 'class="Date[^>]+>(?P<year>.*?)</span><span class="Qlty">(?P<quality>.*?)</span></p><div ' \ + 'class="Description"><p>.*?\:\s*(?P<plot>.*?)</p>' + matches = re.compile(pattern, re.DOTALL).findall(data) + + for url, thumb, title, duration, year, quality, plot in matches: + title = title.strip().replace("Spanish Online Torrent", "").replace("Latino Online Torrent", "") + infoLabels = {"year": year} + + aux = scrapertools.find_single_match(duration, "(\d+)h\s*(\d+)m") + duration = "%s" % ((int(aux[0]) * 3600) + (int(aux[1]) * 60)) + infoLabels["duration"] = duration + + itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumb, + plot=plot, infoLabels=infoLabels)) + + if item.page: + pattern = "<span class='page-numbers current'>[^<]+</span><a class='page-numbers' href='([^']+)'" + url = scrapertools.find_single_match(data, pattern) + + itemlist.append(Item(channel=item.channel, action="listado", title=">> Página siguiente", url=url, page=True, + thumbnail=get_thumb("next.png"))) + + return itemlist + + +def findvideos(item): + logger.info() + + itemlist = [] + + data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)", "", httptools.downloadpage(item.url).data) + data = re.sub(r""", '"', data) + data = re.sub(r"<", '<', data) + + titles = re.compile('data-TPlayerNv="Opt\d+">.*? <span>(.*?)</span></li>', re.DOTALL).findall(data) + urls = re.compile('id="Opt\d+"><iframe[^>]+src="([^"]+)"', re.DOTALL).findall(data) + + if len(titles) == len(urls): + for i in range(0, len(titles)): + if i > 0: + title = "Online %s " % titles[i].strip() + else: + title = titles[0] + + if "goo.gl" in urls[i]: + urls[i] = httptools.downloadpage(urls[i], follow_redirects=False, only_headers=True)\ + .headers.get("location", "") + videourl = servertools.findvideos(urls[i]) + if len(videourl) > 0: + itemlist.append(Item(channel=item.channel, action="play", title=title, url=videourl[0][1], + server=videourl[0][0], thumbnail=videourl[0][3], fulltitle=item.title)) + + pattern = '<a[^>]+href="([^"]+)"[^<]+</a></td><td><span><img[^>]+>(.*?)</span></td><td><span><img[^>]+>(.*?)' \ + '</span></td><td><span>(.*?)</span>' + torrents = re.compile(pattern, re.DOTALL).findall(data) + + if len(torrents) > 0: + for url, text, lang, quality in torrents: + title = "%s %s - %s" % (text, lang, quality) + itemlist.append(Item(channel=item.channel, action="play", title=title, url=url, server="torrent", + fulltitle=item.title, thumbnail=get_thumb("channels_torrent.png"))) + + return itemlist From dff33d85eda4e8cc1746f2718411069beca54c53 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 08:49:37 -0500 Subject: [PATCH 04/14] Update pasateatorrent.json --- .../channels/pasateatorrent.json | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/plugin.video.alfa/channels/pasateatorrent.json b/plugin.video.alfa/channels/pasateatorrent.json index 71883a91..ebd133b2 100755 --- a/plugin.video.alfa/channels/pasateatorrent.json +++ b/plugin.video.alfa/channels/pasateatorrent.json @@ -6,23 +6,12 @@ "language": ["cast"], "thumbnail": "http://imgur.com/iLeISt0.png", "banner": "pasateatorrent.png", + "fanart": "http://imgur.com/uexmGEg.png", "version": 1, "changes": [ { - "date": "06/12/2016", - "description": "Release" - }, - { - "date": "13/01/2017", - "description": "Arreglo sagas en peliculas que no se mostraban.Mejoras en series/info-capitulos" - }, - { - "date": "04/04/2017", - "description": "Migración httptools.Adaptación proxy según Kodi sea igual o menor v.17.Pequeñas mejoras código" - }, - { - "date": "28/06/2017", - "description": "Correciones código y algunas mejoras" + "date": "25/08/2017", + "description": "Revamp" } ], "categories": [ @@ -38,6 +27,14 @@ "default": true, "enabled": true, "visible": true + }, + { + "id": "modo_grafico", + "type": "bool", + "label": "Buscar información extra (TMDB)", + "default": true, + "enabled": true, + "visible": true } ] -} \ No newline at end of file +} From 41a14f86cc651cf4b863b1b94d598f54887e1120 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 08:50:34 -0500 Subject: [PATCH 05/14] Update pasateatorrent.py --- plugin.video.alfa/channels/pasateatorrent.py | 1982 ++---------------- 1 file changed, 217 insertions(+), 1765 deletions(-) diff --git a/plugin.video.alfa/channels/pasateatorrent.py b/plugin.video.alfa/channels/pasateatorrent.py index d3b12fb6..5e2671ea 100755 --- a/plugin.video.alfa/channels/pasateatorrent.py +++ b/plugin.video.alfa/channels/pasateatorrent.py @@ -1,1821 +1,273 @@ # -*- coding: utf-8 -*- -import os import re -import unicodedata -import urllib -import xbmc -import xbmcgui +from channelselector import get_thumb from core import httptools from core import scrapertools from core.item import Item -from core.scrapertools import decodeHtmlentities as dhe from platformcode import config, logger -from platformcode import platformtools -ACTION_SHOW_FULLSCREEN = 36 -ACTION_GESTURE_SWIPE_LEFT = 511 -ACTION_SELECT_ITEM = 7 -ACTION_PREVIOUS_MENU = 10 -ACTION_MOVE_LEFT = 1 -ACTION_MOVE_RIGHT = 2 -ACTION_MOVE_DOWN = 4 -ACTION_MOVE_UP = 3 -OPTION_PANEL = 6 -OPTIONS_OK = 5 +host = "https://pasateatorrent.com/" -krypton = False - - -# Proxy para acceder a datos(Este canal usa cloudflare con https) -def get_page(url): - logger.info() - global krypton - xbmc_version = xbmc.getInfoLabel("System.BuildVersion") - check_xbmc_version = scrapertools.get_match(xbmc_version, '(\d+).') - - if check_xbmc_version >= 17: - krypton = True - data = httptools.downloadpage(url).data - else: - data = httptools.downloadpage("http://ssl-proxy.my-addr.org/myaddrproxy.php/" + url).data - - return data - - -# Para la busqueda en bing evitando baneos - -def browser(url): - import mechanize - - # Utilizamos Browser mechanize para saltar problemas con la busqueda en bing - br = mechanize.Browser() - # Browser options - br.set_handle_equiv(False) - br.set_handle_gzip(True) - br.set_handle_redirect(True) - br.set_handle_referer(False) - br.set_handle_robots(False) - # Follows refresh 0 but not hangs on refresh > 0 - br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1) - # Want debugging messages? - # br.set_debug_http(True) - # br.set_debug_redirects(True) - # br.set_debug_responses(True) - - # User-Agent (this is cheating, ok?) - br.addheaders = [('User-agent', - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/7.1.7 Safari/537.85.16')] - # br.addheaders =[('Cookie','SRCHD=AF=QBRE; domain=.bing.com; expires=25 de febrero de 2018 13:00:28 GMT+1; MUIDB=3B942052D204686335322894D3086911; domain=www.bing.com;expires=24 de febrero de 2018 13:00:28 GMT+1')] - # Open some site, let's pick a random one, the first that pops in mind - r = br.open(url) - response = r.read() - print response - if "img,divreturn" in response: - r = br.open("http://ssl-proxy.my-addr.org/myaddrproxy.php/" + url) - print "prooooxy" - response = r.read() - - return response - - -api_key = "2e2160006592024ba87ccdf78c28f49f" -api_fankey = "dffe90fba4d02c199ae7a9e71330c987" +dict_url_seasons = dict() +__modo_grafico__ = config.get_setting('modo_grafico', 'pasateatorrent') def mainlist(item): logger.info() - check_bg = item.action - if str(check_bg) == "": - check_bg = "bglobal" - itemlist = [] - itemlist.append(Item(channel=item.channel, title="[COLOR yellow][B]Peliculas[/B][/COLOR]", action="peliculas", - url="http://pasateatorrent.com/", - thumbnail="https://s6.postimg.org/j9amymu1d/dxtorrentpelo.png", - fanart="http://imgur.com/uexmGEg.png")) - itemlist.append(Item(channel=item.channel, title="[COLOR skyblue][B]Series[/B][/COLOR]", action="peliculas", - url="http://pasateatorrent.com//series/", - thumbnail="https://s6.postimg.org/6vxsrq4cx/dxtorrentselo.png", - fanart="http://imgur.com/vQTyY6r.png")) - itemlist.append(Item(channel=item.channel, title="[COLOR green][B]Buscar[/B][/COLOR]", action="", url="", - thumbnail="https://s6.postimg.org/hy2vq5yfl/dxtorrentbpelo.png", - fanart="http://imgur.com/P9jol7f.png")) + thumb_movie = get_thumb("channels_movie.png") + thumb_tvshow = get_thumb("channels_tvshow.png") + itemlist = list() itemlist.append( - Item(channel=item.channel, title=" " + "[COLOR yellow]Peliculas[/COLOR]", action="search", url="", - thumbnail="https://s6.postimg.org/79z4rbogh/dxtorrentpbselo.png", fanart="http://imgur.com/W7iwPvD.png", - extra="peliculas" + "|" + check_bg)) + Item(channel=item.channel, title="Peliculas", action="peliculas", thumbnail=thumb_movie)) itemlist.append( - Item(channel=item.channel, title=" " + "[COLOR skyblue]Series[/COLOR]", action="search", url="", - thumbnail="https://s6.postimg.org/hy2vq5yfl/dxtorrentbpelo.png", fanart="http://imgur.com/BD86Wdn.png", - extra="series" + "|" + check_bg)) + Item(channel=item.channel, title="Series", action="series", thumbnail=thumb_tvshow)) + + return itemlist + + +def peliculas(item): + logger.info() + + thumb_search = get_thumb("search.png") + + itemlist = list() + itemlist.append(item.clone(channel=item.channel, title="Novedades", action="listado", url=host)) + # itemlist.append(item.clone(channel=item.channel, title="Filtrar películas", action="listado", url=host)) + itemlist.append(item.clone(channel=item.channel, title="Buscar", action="search", url=host, media="película", + thumbnail=thumb_search)) + + return itemlist + + +def series(item): + logger.info() + + thumb_search = get_thumb("search.png") + + itemlist = list() + itemlist.append(item.clone(channel=item.channel, title="Novedades", action="listado", url=host + "series/")) + # itemlist.append(item.clone(channel=item.channel, title="Filtrar series", action="listado", url=host)) + itemlist.append(item.clone(channel=item.channel, title="Buscar", action="search", url=host + "series/", + media="serie", thumbnail=thumb_search)) return itemlist def search(item, texto): - logger.info() + logger.info("texto:" + texto) texto = texto.replace(" ", "+") - check_bg = item.action - if item.extra: - if item.extra.split("|")[0] == "series": - item.url = "http://pasateatorrent.com/series/?s=%s&post_type=Buscar+serie" % (texto) - check_sp = "tvshow" - else: - item.url = "http://pasateatorrent.com/?s=%s&post_type=Buscar+película" % (texto) - check_sp = "peliculas" - item.extra = "search" + "|" + item.extra.split("|")[1] + "|" + texto + "|" + check_sp - - try: - return peliculas(item) - # Se captura la excepciÛn, para no interrumpir al buscador global si un canal falla - except: - import sys - for line in sys.exc_info(): - logger.error("%s" % line) - else: - if item.contentType != "movie": - item.url = "http://pasateatorrent.com/series/?s=%s&post_type=Buscar+serie" % (texto) - check_sp = "tvshow" - else: - item.url = "http://pasateatorrent.com/?s=%s&post_type=Buscar+película" % (texto) - check_sp = "peliculas" - item.extra = "search" + "|" + "bglobal" + "|" + texto + "|" + check_sp - - try: - return peliculas(item) - # Se captura la excepciÛn, para no interrumpir al buscador global si un canal falla - except: - import sys - for line in sys.exc_info(): - logger.error("%s" % line) - - -def peliculas(item): - logger.info() itemlist = [] - global krypton - check_url = "" - # Descarga la página - data = get_page(item.url) - # data =re.sub("-"," ",data) - if "serie" in item.url: - data = re.sub(r"&#.*?;", "x", data) - if item.extra.split("|")[0] == "search": - check_bg = item.action - bloque_enlaces = scrapertools.find_single_match(data, - '<div class="contenedor_imagenes">(.*?)<center><\/center>') - bloque_enlaces = bloque_enlaces.strip() - if item.extra.split("|")[1] != "bglobal" and check_bg != "info": - if str(bloque_enlaces) == "</div>": - if item.extra.split("|")[3] == "peliculas": - dialog = xbmcgui.Dialog() - if dialog.yesno( - '[COLOR crimson][B]Sin resultados en[/B][/COLOR]' + '[COLOR gold][B] Pasate[/B][/COLOR]' + '[COLOR floralwhite][B]A[/B][/COLOR]' + '[COLOR yellow][B]Torrent[/B][/COLOR]', - '[COLOR cadetblue]¿Quieres hacer una busqueda en Alfa?[/COLOR]', - '', "", '[COLOR crimson][B]No,gracias[/B][/COLOR]', - '[COLOR yellow][B]Si[/B][/COLOR]'): - item.extra = "movie" + "|" + item.extra.split("|")[2] - return busqueda(item) - else: - xbmc.executebuiltin('Action(Back)') - xbmc.sleep(500) - else: - dialog = xbmcgui.Dialog() - if dialog.yesno( - '[COLOR crimson][B]Sin resultados en[/B][/COLOR]' + '[COLOR slateblue][B] Pasate[/B][/COLOR]' + '[COLOR floralwhite][B]A[/B][/COLOR]' + '[COLOR slateblue][B]Torrent[/B][/COLOR]', - '[COLOR cadetblue]¿Quieres hacer una busqueda en Alfa?[/COLOR]', - '', "", '[COLOR crimson][B]No,gracias[/B][/COLOR]', - '[COLOR yellow][B]Si[/B][/COLOR]'): - item.extra = "serie" + "|" + item.extra.split("|")[2] - return busqueda(item) - else: - xbmc.executebuiltin('Action(Back)') - xbmc.sleep(500) - else: - bloque_enlaces = scrapertools.find_single_match(data, - '<div class="contenedor_imagenes">(.*?)<center><div class="navigation">') - if krypton: - patron = '<a href="https://([^"]+)/".*?src="https://([^"]+)".*?class="bloque_inferior">(.*?)<\/div>' - matches = re.compile(patron, re.DOTALL).findall(bloque_enlaces) - else: - - patron = '<a href="\/myaddrproxy.php\/https\/([^"]+)/".*?src="\/myaddrproxy.php\/https\/([^"]+)".*?class="bloque_inferior">(.*?)<\/div>' - matches = re.compile(patron, re.DOTALL).findall(bloque_enlaces) - - for scrapedurl, scrapedthumbnail, scrapedtitle in matches: - if not item.extra == "search": - calidad = scrapertools.find_single_match(data, 'class="bloque_superior">(.*?)<\/div>') - - if "search" in item.extra: - scrapedtitle = re.sub(r'La Saga|Saga|Tetralogía|Tetralogia|Trilogía|Triloga|Pentalogía|Pentalogia', '', - scrapedtitle) - scrapedtitle = re.sub('<br>', '', scrapedtitle) - scrapedurl = "http://" + scrapedurl - if "serie" in item.url: - scrapedurl = re.sub(r' \d+x\d+| \d+', '', scrapedurl).strip() - scrapedurl = re.sub(r' ', '-', scrapedurl).strip() - scrapedthumbnail = "http://" + scrapedthumbnail - scrapedthumbnail = re.sub(r' ', '-', scrapedthumbnail) - title_fan = re.sub( - r"\[.*?\]|\(.*?\)|\d+x\d+.*?Final|-\d+|-|\d+x\d+|Temporada.*?Completa| ;|Serie Completa|Especial.*", "", - scrapedtitle).strip() - if not "100" in scrapedtitle: - title_fan = re.sub(r"\d+", "", title_fan) - title_serie = re.sub('<br>.*', '', scrapedtitle) - if "serie" in item.url: - try: - check_temp, check_serie = scrapertools.find_single_match(title_serie, '(\d+)x\d+ (\d+)') - if check_serie: - title_serie = title_serie.replace(" " + check_serie, "-" + check_serie) - if check_temp: - scrapedurl = scrapedurl + "-temporada-" + check_temp - except: - try: - check_temp, check_serie = scrapertools.find_single_match(title_serie, '(\d+)x\d+-(\d+)') - except: - try: - check_temp, check_serie = scrapertools.find_single_match(title_serie, '(\d+)-(\d+)') - except: - check_serie = "" - - title = scrapedtitle.title() - if "series" in scrapedurl: - # title_fan= re.sub(r'') - trailer = title_fan + " " + "series" + "trailer" - title = "[COLOR skyblue][B]" + title_serie + "[/B][/COLOR]" - - else: - title = "[COLOR yellow][B]" + scrapedtitle + "[/B][/COLOR]" - trailer = title_fan + " " + "trailer" - - trailer = urllib.quote(trailer) - extra = trailer + "|" + title_fan + "|" + "pelicula" + "|" + item.extra - if "Saga" in title or "Serie Completa" in title or "Tetralogía" in title or "Tetralogia" in title or "Trilogía" in title or "Trilogia" in title or "Pentalogía" in title or "Pentalogia" in title or "Pack Peliculas" in title or "Pack Películas" in title or "Duología" in title or "Duologia" in title: - if "serie" in item.url: - if krypton: - l_scrapedurl = re.sub(r"http://", "http/", scrapedurl) - l_scrapedurl = "http://ssl-proxy.my-addr.org/myaddrproxy.php/" + scrapedurl - else: - l_scrapedurl = scrapedurl - url = scrapertools.get_header_from_response(l_scrapedurl, header_to_get="location") - check_url = scrapertools.get_header_from_response(url, header_to_get="location") - if "series/?s" in check_url: - scrapedurl = re.sub(r" ", "-", scrapedurl.strip()) - action = "peliculas" - pepe = "search" + "|" + " " - check_bg = "" - else: - check_url = "capitulos" - action = "fanart" - pepe = extra - else: - scrapedurl = re.sub(r" ", "-", scrapedurl.strip()) - action = "peliculas" - pepe = "search" + "|" + " " - check_bg = "" - else: - action = "fanart" - pepe = extra - itemlist.append( - Item(channel=item.channel, title=title, url=scrapedurl, action=action, thumbnail=scrapedthumbnail, - fanart=item.fanart, extra=pepe, folder=True)) - - if "series" in item.url and not "Completa" in scrapedtitle and check_serie == "" and not "Temporada" in title_serie: - xbmc.log("pocoyoespajo") - xbmc.log(scrapedtitle) - url_1 = re.compile('([^<]+) (\d+).*?(\d+)', re.DOTALL).findall(scrapedtitle) - for title_capitulo, temp, epi in url_1: - xbmc.log("pocoyoespajo") - xbmc.log(scrapedtitle) - if "serie-completa" in scrapedurl: - title = "[COLOR cyan] Ver capitulos de temporada[/COLOR]" - else: - title = "[COLOR cyan]Ver capitulo[/COLOR]" + " " + "[COLOR slateblue]" + temp + "x" + epi + "[/COLOR]" - # url = "http://descargaportorrent.net/series/"+url_2+"-temporada-"+temp - extra = temp + "|" + epi + "|" + scrapedtitle - if "Especial" in scrapedtitle: - title = "[COLOR cyan] Ver capitulo especial[/COLOR]" - extra = "" + "|" + "Especial" + "|" + scrapedtitle - itemlist.append(Item(channel=item.channel, title=" " + title, url=scrapedurl, action="ver_capitulo", - thumbnail=scrapedthumbnail, fanart=item.fanart, extra=extra, folder=True)) - else: - if item.extra != "search" or item.extra == "search" and not "Saga" in title and not "Serie Completa" in title and not "Tetralogia" in title and not "Tetralogia" in title and not "Trilogía" in title and not "Trilogia" in title and not "Pentalogía" in title and not "Pentalogia" in title and not "Pack Peliculas" in title and not "Pack Películas" in title or not "Duología" in title or not "Duologia" in title: - if "series" in scrapedurl and not "Serie Completa" in title: - - if "Temporada" in scrapedtitle: - title = "[COLOR cyan] Ver capitulos de temporada[/COLOR]" - else: - title = "[COLOR cyan] Ver Capitulos[/COLOR]" - - else: - - if not "Completa" in title and not "Tetralogía" in title and not "Tetralogia" in title and not "Saga" in title and not "Trilogía" in title and not "Trilogia" in title and not "Pentalogía" in title and not "Pentalogia" in title and not "Pack Películas" in title and not "Pack Peliculas" in title and not "Duología" in title and not "Duologia" in title: - title = "[COLOR khaki] Ver pelicula[/COLOR]" - else: - if "Serie Completa" in title and check_url == "capitulos": - title = "[COLOR cyan] Ver Capitulos[/COLOR]" - else: - continue - itemlist.append(Item(channel=item.channel, title=title, url=scrapedurl, action="ver_capitulo", - thumbnail=scrapedthumbnail, fanart=item.fanart, extra=extra, folder=True)) - ## Paginación - if krypton: - patronvideos = '<li class="barranav"><a href="([^"]+)" >P' - matches = re.compile(patronvideos, re.DOTALL).findall(data) - - else: - patronvideos = '<li class="barranav">.*?<a href="/myaddrproxy.php/https/([^"]+)" >Página siguiente ' - matches = re.compile(patronvideos, re.DOTALL).findall(data) - scrapertools.printMatches(matches) - if len(matches) > 0: - scrapedurl = matches[0] - if krypton: - url = scrapedurl - else: - url = "http://" + scrapedurl - title = "siguiente>>" - title = "[COLOR slategray]" + title + "[/COLOR]" - itemlist.append(Item(channel=item.channel, action="peliculas", title=title, url=url, - thumbnail="http://s6.postimg.org/drfhhwrtd/muarrow.png", fanart=item.fanart, folder=True)) - - return itemlist - - -def fanart(item): - logger.info() - itemlist = [] - url = item.url - data = get_page(url) - title_fan = item.extra.split("|")[1] - title = re.sub(r'Serie Completa|Temporada.*', '', title_fan) - if "series" in item.url and not "temporada" in item.url: - item.title = re.sub(r'\d+x\d+.*?Final|-\d+|-|\d+x\d+|\d+', '', item.title) - item.title = re.sub(r'Especial.*?\[', '[', item.title) - title = title.replace(' ', '%20') - title = ''.join((c for c in unicodedata.normalize('NFD', unicode(title.decode('utf-8'))) if - unicodedata.category(c) != 'Mn')).encode("ascii", "ignore") - - item.plot = item.extra.split("|")[0] try: - year = scrapertools.get_match(data, '<div class="ano_page_exit">(\d\d\d\d)') + url = "%s?s=%s&post_type=Buscar+%s" % (item.url, texto, item.media) + data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(url).data) + # logger.debug("data %s \n\n" % data) + + video_section = scrapertools.find_single_match(data, '<div class="contenedor_imagenes">(.*?)</div><center>') + + pattern = '<a href="(?P<url>[^"]+)">.*?<img.*?src="(?P<thumb>[^"]+)".*?class="bloque_inferior">' \ + '(?P<title>.*?)</div>' + + matches = re.compile(pattern, re.DOTALL).findall(video_section) + + for url, thumb, title in matches: + if item.media == "serie": + action = "episodios" + else: + action = "findvideos" + itemlist.append(Item(channel=item.channel, action=action, title=title, url=url, thumbnail=thumb, + contentTitle=title, contentType="movie")) + + return itemlist + + # Se captura la excepción, para no interrumpir al buscador global si un canal falla except: - year = "" - try: - sinopsis = scrapertools.get_match(data, 'Sinopsis.*?<p>(.*?)</p>') - except: - sinopsis = "" - if not "series" in item.url: + import sys + for line in sys.exc_info(): + logger.error("%s" % line) + return [] - # filmafinity - url = "http://www.filmaffinity.com/es/advsearch.php?stext={0}&stype%5B%5D=title&country=&genre=&fromyear={1}&toyear={1}".format( - title, year) - data = httptools.downloadpage(url).data - url_filmaf = scrapertools.find_single_match(data, '<div class="mc-poster">\s*<a title="[^"]*" href="([^"]+)"') - if url_filmaf: - url_filmaf = "http://www.filmaffinity.com%s" % url_filmaf - data = httptools.downloadpage(url_filmaf).data - else: - - try: - url_bing = "http://www.bing.com/search?q=%s+%s+site:filmaffinity.com" % (title.replace(' ', '+'), year) - data = browser(url_bing) - data = re.sub(r'\n|\r|\t|\s{2}| ', '', data) - - if "myaddrproxy.php" in data: - subdata_bing = scrapertools.get_match(data, - 'li class="b_algo"><div class="b_title"><h2>(<a href="/ myaddrproxy.php/http/www.filmaffinity.com/es/film.*?)"') - subdata_bing = re.sub(r'\/myaddrproxy.php\/http\/', '', subdata_bing) - else: - subdata_bing = scrapertools.get_match(data, - 'li class="b_algo"><h2>(<a href="http://www.filmaffinity.com/es/film.*?)"') - - url_filma = scrapertools.get_match(subdata_bing, '<a href="([^"]+)') - - if not "http" in url_filma: - data = httptools.downloadpage("http://" + url_filma).data - else: - data = httptools.downloadpage(url_filma).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - - except: - pass - if sinopsis == " ": - try: - sinopsis = scrapertools.find_single_match(data, '<dd itemprop="description">(.*?)</dd>') - sinopsis = sinopsis.replace("<br><br />", "\n") - sinopsis = re.sub(r"\(FILMAFFINITY\)<br />", "", sinopsis) - except: - pass - try: - rating_filma = scrapertools.get_match(data, 'itemprop="ratingValue" content="(.*?)">') - except: - rating_filma = "Sin puntuacion" - - critica = "" - patron = '<div itemprop="reviewBody">(.*?)</div>.*?itemprop="author">(.*?)\s*<i alt="([^"]+)"' - matches_reviews = scrapertools.find_multiple_matches(data, patron) - - if matches_reviews: - for review, autor, valoracion in matches_reviews: - review = dhe(scrapertools.htmlclean(review)) - review += "\n" + autor + "[CR]" - review = re.sub(r'Puntuac.*?\)', '', review) - if "positiva" in valoracion: - critica += "[COLOR green][B]%s[/B][/COLOR]\n" % review - elif "neutral" in valoracion: - critica += "[COLOR yellow][B]%s[/B][/COLOR]\n" % review - else: - critica += "[COLOR red][B]%s[/B][/COLOR]\n" % review - else: - critica = "[COLOR floralwhite][B]Esta película no tiene críticas todavía...[/B][/COLOR]" - print "ozuu" - print critica - - url = "http://api.themoviedb.org/3/search/movie?api_key=" + api_key + "&query=" + title + "&year=" + year + "&language=es&include_adult=false" - data = httptools.downloadpage(url).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '"page":1.*?,"id":(.*?),.*?"backdrop_path":(.*?),' - matches = re.compile(patron, re.DOTALL).findall(data) - - if len(matches) == 0: - - title = re.sub(r":.*|\(.*?\)", "", title) - url = "http://api.themoviedb.org/3/search/movie?api_key=" + api_key + "&query=" + title + "&language=es&include_adult=false" - - data = httptools.downloadpage(url).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '"page":1.*?,"id":(.*?),.*?"backdrop_path":(.*?),' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - extra = item.thumbnail + "|" + "" + "|" + "" + "|" + "Sin puntuacón" + "|" + rating_filma + "|" + critica - show = "http://imgur.com/c3rzL6x.jpg" + "|" + "" + "|" + sinopsis - posterdb = item.thumbnail - fanart_info = "http://imgur.com/c3rzL6x.jpg" - fanart_3 = "" - fanart_2 = "http://imgur.com/c3rzL6x.jpg" - category = item.thumbnail - id_scraper = "" - - itemlist.append(Item(channel=item.channel, title=item.title, url=item.url, action="findvideos", - thumbnail=item.thumbnail, fanart="http://imgur.com/c3rzL6x.jpg", extra=extra, - show=show, category=category, folder=True)) - - for id, fan in matches: - - fan = re.sub(r'\\|"', '', fan) - - try: - rating = scrapertools.find_single_match(data, '"vote_average":(.*?),') - except: - rating = "Sin puntuación" - - id_scraper = id + "|" + "peli" + "|" + rating + "|" + rating_filma + "|" + critica - try: - posterdb = scrapertools.get_match(data, '"page":1,.*?"poster_path":"\\\(.*?)"') - posterdb = "https://image.tmdb.org/t/p/original" + posterdb - except: - posterdb = item.thumbnail - - if "null" in fan: - fanart = "http://imgur.com/c3rzL6x.jpg" - else: - fanart = "https://image.tmdb.org/t/p/original" + fan - item.extra = fanart - - url = "http://api.themoviedb.org/3/movie/" + id + "/images?api_key=" + api_key + "" - data = httptools.downloadpage(url).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - - patron = '"backdrops".*?"file_path":".*?",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)"' - matches = re.compile(patron, re.DOTALL).findall(data) - - if len(matches) == 0: - patron = '"backdrops".*?"file_path":"(.*?)",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)"' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - fanart_info = item.extra - fanart_3 = "" - fanart_2 = item.extra - for fanart_info, fanart_3, fanart_2 in matches: - fanart_info = "https://image.tmdb.org/t/p/original" + fanart_info - fanart_3 = "https://image.tmdb.org/t/p/original" + fanart_3 - fanart_2 = "https://image.tmdb.org/t/p/original" + fanart_2 - - # clearart, fanart_2 y logo - url = "http://webservice.fanart.tv/v3/movies/" + id + "?api_key=" + api_fankey - data = httptools.downloadpage(url).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '"hdmovielogo":.*?"url": "([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(data) - - if '"moviedisc"' in data: - disc = scrapertools.get_match(data, '"moviedisc":.*?"url": "([^"]+)"') - if '"movieposter"' in data: - poster = scrapertools.get_match(data, '"movieposter":.*?"url": "([^"]+)"') - if '"moviethumb"' in data: - thumb = scrapertools.get_match(data, '"moviethumb":.*?"url": "([^"]+)"') - if '"moviebanner"' in data: - banner = scrapertools.get_match(data, '"moviebanner":.*?"url": "([^"]+)"') - - if len(matches) == 0: - extra = posterdb - # "http://es.seaicons.com/wp-content/uploads/2015/11/Editing-Overview-Pages-1-icon.png" - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis - category = posterdb - - itemlist.append( - Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, server="torrent", - thumbnail=posterdb, fanart=item.extra, extra=extra, show=show, category=category, folder=True)) - for logo in matches: - if '"hdmovieclearart"' in data: - clear = scrapertools.get_match(data, '"hdmovieclearart":.*?"url": "([^"]+)"') - if '"moviebackground"' in data: - - extra = clear - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis - if '"moviedisc"' in data: - category = disc - else: - category = clear - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=logo, fanart=item.extra, extra=extra, - show=show, category=category, folder=True)) - else: - extra = clear - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis - if '"moviedisc"' in data: - category = disc - else: - category = clear - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=logo, fanart=item.extra, extra=extra, - show=show, category=category, folder=True)) - - if '"moviebackground"' in data: - - if '"hdmovieclearart"' in data: - clear = scrapertools.get_match(data, '"hdmovieclearart":.*?"url": "([^"]+)"') - extra = clear - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis - if '"moviedisc"' in data: - category = disc - else: - category = clear - else: - extra = logo - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis - if '"moviedisc"' in data: - category = disc - else: - category = logo - - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=logo, fanart=item.extra, extra=extra, - show=show, category=category, folder=True)) - - if not '"hdmovieclearart"' in data and not '"moviebackground"' in data: - extra = logo - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis - if '"moviedisc"' in data: - category = disc - else: - category = item.extra - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=logo, fanart=item.extra, extra=extra, show=show, - category=category, folder=True)) - - - else: - - # filmafinity - url = "http://www.filmaffinity.com/es/advsearch.php?stext={0}&stype%5B%5D=title&country=&ggenre=TV_SE&fromyear={1}&toyear={1}".format( - title, year) - data = httptools.downloadpage(url).data - - url_filmaf = scrapertools.find_single_match(data, '<div class="mc-poster">\s*<a title="[^"]*" href="([^"]+)"') - if url_filmaf: - url_filmaf = "http://www.filmaffinity.com%s" % url_filmaf - data = httptools.downloadpage(url_filmaf).data - else: - - try: - url_bing = "http://www.bing.com/search?q=%s+%s+site:filmaffinity.com" % (title.replace(' ', '+'), year) - data = browser(url_bing) - data = re.sub(r'\n|\r|\t|\s{2}| ', '', data) - - if "myaddrproxy.php" in data: - subdata_bing = scrapertools.get_match(data, - 'li class="b_algo"><div class="b_title"><h2>(<a href="/ myaddrproxy.php/http/www.filmaffinity.com/es/film.*?)"') - subdata_bing = re.sub(r'\/myaddrproxy.php\/http\/', '', subdata_bing) - else: - subdata_bing = scrapertools.get_match(data, - 'li class="b_algo"><h2>(<a href="http://www.filmaffinity.com/es/film.*?)"') - - url_filma = scrapertools.get_match(subdata_bing, '<a href="([^"]+)') - if not "http" in url_filma: - data = httptools.downloadpage("http://" + url_filma).data - else: - data = httptools.downloadpage(url_filma).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - - except: - pass - if sinopsis == " ": - try: - sinopsis = scrapertools.find_single_match(data, '<dd itemprop="description">(.*?)</dd>') - sinopsis = sinopsis.replace("<br><br />", "\n") - sinopsis = re.sub(r"\(FILMAFFINITY\)<br />", "", sinopsis) - except: - pass - try: - rating_filma = scrapertools.get_match(data, 'itemprop="ratingValue" content="(.*?)">') - except: - rating_filma = "Sin puntuacion" - - critica = "" - patron = '<div itemprop="reviewBody">(.*?)</div>.*?itemprop="author">(.*?)\s*<i alt="([^"]+)"' - matches_reviews = scrapertools.find_multiple_matches(data, patron) - - if matches_reviews: - for review, autor, valoracion in matches_reviews: - review = dhe(scrapertools.htmlclean(review)) - review += "\n" + autor + "[CR]" - review = re.sub(r'Puntuac.*?\)', '', review) - if "positiva" in valoracion: - critica += "[COLOR green][B]%s[/B][/COLOR]\n" % review - elif "neutral" in valoracion: - critica += "[COLOR yellow][B]%s[/B][/COLOR]\n" % review - else: - critica += "[COLOR red][B]%s[/B][/COLOR]\n" % review - else: - critica = "[COLOR floralwhite][B]Esta serie no tiene críticas[/B][/COLOR]" - - ###Busqueda en tmdb - - url_tmdb = "http://api.themoviedb.org/3/search/tv?api_key=" + api_key + "&query=" + title + "&language=es&include_adult=false&first_air_date_year=" + year - data_tmdb = scrapertools.cachePage(url_tmdb) - data_tmdb = re.sub(r"\n|\r|\t|\s{2}| ", "", data_tmdb) - patron = '"page":1.*?,"id":(.*?)".*?"backdrop_path":(.*?),' - matches = re.compile(patron, re.DOTALL).findall(data_tmdb) - ###Busqueda en bing el id de imdb de la serie - if len(matches) == 0: - url_tmdb = "http://api.themoviedb.org/3/search/tv?api_key=" + api_key + "&query=" + title + "&language=es" - data_tmdb = scrapertools.cachePage(url_tmdb) - data_tmdb = re.sub(r"\n|\r|\t|\s{2}| ", "", data_tmdb) - patron = '"page":1.*?,"id":(.*?),"backdrop_path":(.*?),' - matches = re.compile(patron, re.DOTALL).findall(data_tmdb) - if len(matches) == 0: - urlbing_imdb = "http://www.bing.com/search?q=%s+%s+tv+series+site:imdb.com" % ( - title.replace(' ', '+'), year) - data = browser(urlbing_imdb) - data = re.sub(r"\n|\r|\t|\s{2}| |http://ssl-proxy.my-addr.org/myaddrproxy.php/", "", data) - try: - subdata_imdb = scrapertools.find_single_match(data, - '<li class="b_algo">(.*?)h="ID.*?<strong>.*?TV Series') - except: - pass - - try: - imdb_id = scrapertools.get_match(subdata_imdb, '<a href=.*?http.*?imdb.com/title/(.*?)/.*?"') - except: - imdb_id = "" - ###Busca id de tvdb y tmdb mediante imdb id - - urlremotetbdb = "https://api.themoviedb.org/3/find/" + imdb_id + "?api_key=" + api_key + "&external_source=imdb_id&language=es" - data_tmdb = scrapertools.cachePage(urlremotetbdb) - matches = scrapertools.find_multiple_matches(data_tmdb, - '"tv_results":.*?"id":(.*?),.*?"poster_path":(.*?),') - - if len(matches) == 0: - id_tmdb = "" - fanart_3 = "" - extra = item.thumbnail + "|" + year + "|" + "no data" + "|" + "no data" + "|" + "Sin puntuación" + "|" + "" + "|" + "" + "|" + id_tmdb - show = "http://imgur.com/ldWNcHm.jpg" + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + item.thumbnail + "|" + id_tmdb - fanart_info = "http://imgur.com/ldWNcHm.jpg" - fanart_2 = "http://imgur.com/ldWNcHm.jpg" - id_scraper = "" - category = "" - posterdb = item.thumbnail - itemlist.append(Item(channel=item.channel, title=item.title, url=item.url, action="findvideos", - thumbnail=item.thumbnail, fanart="http://imgur.com/ldWNcHm.jpg", extra=extra, - category=category, show=show, folder=True)) - - for id_tmdb, fan in matches: - ###Busca id tvdb - urlid_tvdb = "https://api.themoviedb.org/3/tv/" + id_tmdb + "/external_ids?api_key=" + api_key + "&language=es" - data_tvdb = scrapertools.cachePage(urlid_tvdb) - id = scrapertools.find_single_match(data_tvdb, 'tvdb_id":(.*?),"tvrage_id"') - if id == "null": - id = "" - category = id - ###Busqueda nºepisodios y temporadas,status - url_status = "http://api.themoviedb.org/3/tv/" + id_tmdb + "?api_key=" + api_key + "&append_to_response=credits&language=es" - data_status = scrapertools.cachePage(url_status) - season_episodes = scrapertools.find_single_match(data_status, - '"(number_of_episodes":\d+,"number_of_seasons":\d+,)"') - season_episodes = re.sub(r'"', '', season_episodes) - season_episodes = re.sub(r'number_of_episodes', 'Episodios ', season_episodes) - season_episodes = re.sub(r'number_of_seasons', 'Temporadas', season_episodes) - season_episodes = re.sub(r'_', ' ', season_episodes) - status = scrapertools.find_single_match(data_status, '"status":"(.*?)"') - if status == "Ended": - status = "Finalizada" - else: - status = "En emisión" - status = status + " (" + season_episodes + ")" - status = re.sub(r',', '.', status) - ####### - - fan = re.sub(r'\\|"', '', fan) - try: - # rating tvdb - url_rating_tvdb = "http://thetvdb.com/api/1D62F2F90030C444/series/" + id + "/es.xml" - print "pepote" - print url_rating_tvdb - data = httptools.downloadpage(url_rating_tvdb).data - rating = scrapertools.find_single_match(data, '<Rating>(.*?)<') - except: - ratintg_tvdb = "" - try: - rating = scrapertools.get_match(data, '"vote_average":(.*?),') - except: - - rating = "Sin puntuación" - - id_scraper = id_tmdb + "|" + "serie" + "|" + rating_filma + "|" + critica + "|" + rating + "|" + status # +"|"+emision - posterdb = scrapertools.find_single_match(data_tmdb, '"poster_path":(.*?)",') - - if "null" in posterdb: - posterdb = item.thumbnail - else: - posterdb = re.sub(r'\\|"', '', posterdb) - posterdb = "https://image.tmdb.org/t/p/original" + posterdb - if "null" in fan: - fanart = "http://imgur.com/ldWNcHm.jpg" - else: - fanart = "https://image.tmdb.org/t/p/original" + fan - - item.extra = fanart - - url = "http://api.themoviedb.org/3/tv/" + id_tmdb + "/images?api_key=" + api_key - - data = httptools.downloadpage(url).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - - patron = '"backdrops".*?"file_path":".*?",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)"' - matches = re.compile(patron, re.DOTALL).findall(data) - - if len(matches) == 0: - patron = '"backdrops".*?"file_path":"(.*?)",.*?"file_path":"(.*?)",.*?"file_path":"(.*?)"' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - fanart_info = item.extra - fanart_3 = "" - fanart_2 = item.extra - for fanart_info, fanart_3, fanart_2 in matches: - if fanart == "http://imgur.com/ldWNcHm.jpg": - fanart = "https://image.tmdb.org/t/p/original" + fanart_info - fanart_info = "https://image.tmdb.org/t/p/original" + fanart_info - fanart_3 = "https://image.tmdb.org/t/p/original" + fanart_3 - fanart_2 = "https://image.tmdb.org/t/p/original" + fanart_2 - url = "http://webservice.fanart.tv/v3/tv/" + id + "?api_key=" + api_fankey - data = httptools.downloadpage(url).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '"clearlogo":.*?"url": "([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(data) - if '"tvbanner"' in data: - tvbanner = scrapertools.get_match(data, '"tvbanner":.*?"url": "([^"]+)"') - tfv = tvbanner - elif '"tvposter"' in data: - tvposter = scrapertools.get_match(data, '"tvposter":.*?"url": "([^"]+)"') - tfv = tvposter - else: - tfv = posterdb - if '"tvthumb"' in data: - tvthumb = scrapertools.get_match(data, '"tvthumb":.*?"url": "([^"]+)"') - if '"hdtvlogo"' in data: - hdtvlogo = scrapertools.get_match(data, '"hdtvlogo":.*?"url": "([^"]+)"') - if '"hdclearart"' in data: - hdtvclear = scrapertools.get_match(data, '"hdclearart":.*?"url": "([^"]+)"') - if len(matches) == 0: - if '"hdtvlogo"' in data: - if "showbackground" in data: - - if '"hdclearart"' in data: - thumbnail = hdtvlogo - extra = hdtvclear + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - else: - thumbnail = hdtvlogo - extra = thumbnail + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, fanart=item.extra, - category=category, extra=extra, show=show, folder=True)) - - - else: - if '"hdclearart"' in data: - thumbnail = hdtvlogo - extra = hdtvclear + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - else: - thumbnail = hdtvlogo - extra = thumbnail + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, fanart=item.extra, extra=extra, - show=show, category=category, folder=True)) - else: - extra = "" + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=posterdb, fanart=fanart, extra=extra, show=show, - category=category, folder=True)) - - for logo in matches: - if '"hdtvlogo"' in data: - thumbnail = hdtvlogo - elif not '"hdtvlogo"' in data: - if '"clearlogo"' in data: - thumbnail = logo - else: - thumbnail = item.thumbnail - if '"clearart"' in data: - clear = scrapertools.get_match(data, '"clearart":.*?"url": "([^"]+)"') - if "showbackground" in data: - - extra = clear + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, fanart=item.extra, extra=extra, - show=show, category=category, folder=True)) - else: - extra = clear + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, fanart=item.extra, extra=extra, - show=show, category=category, folder=True)) - - if "showbackground" in data: - - if '"clearart"' in data: - clear = scrapertools.get_match(data, '"clearart":.*?"url": "([^"]+)"') - extra = clear + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - else: - extra = logo + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, fanart=item.extra, extra=extra, - show=show, category=category, folder=True)) - - if not '"clearart"' in data and not '"showbackground"' in data: - if '"hdclearart"' in data: - extra = hdtvclear + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - else: - extra = thumbnail + "|" + year - show = fanart_2 + "|" + fanart_3 + "|" + sinopsis + "|" + title_fan + "|" + tfv + "|" + id_tmdb - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, fanart=item.extra, extra=extra, - show=show, category=category, folder=True)) - - if not "series" in item.url: - thumbnail = posterdb - title_info = "[COLOR khaki]Info[/COLOR]" - if "series" in item.url: - title_info = "[COLOR skyblue]Info[/COLOR]" - if '"tvposter"' in data: - thumbnail = scrapertools.get_match(data, '"tvposter":.*?"url": "([^"]+)"') - else: - thumbnail = posterdb - - if "tvbanner" in data: - category = tvbanner - else: - category = show - if '"tvthumb"' in data: - plot = item.plot + "|" + tvthumb - else: - plot = item.plot + "|" + item.thumbnail - if '"tvbanner"' in data: - plot = plot + "|" + tvbanner - elif '"tvthumb"' in data: - plot = plot + "|" + tvthumb - else: - plot = plot + "|" + item.thumbnail - else: - if '"moviethumb"' in data: - plot = item.plot + "|" + thumb - else: - plot = item.plot + "|" + posterdb - - if '"moviebanner"' in data: - plot = plot + "|" + banner - else: - if '"hdmovieclearart"' in data: - plot = plot + "|" + clear - - else: - plot = plot + "|" + posterdb - - id = id_scraper - - extra = extra + "|" + id + "|" + title.encode('utf8') - - itemlist.append( - Item(channel=item.channel, action="info", title=title_info, plot=plot, url=item.url, thumbnail=thumbnail, - fanart=fanart_info, extra=extra, category=category, show=show, viewmode="movie_with_plot", folder=False)) - - return itemlist - - -def ver_capitulo(item): +def listado(item): logger.info() + itemlist = [] - data = get_page(item.url) - data = re.sub(r"&#.*?;", "x", data) - patronbloque_enlaces = '<tr class="lol">(.*?)ha sido descargada' - matchesenlaces = re.compile(patronbloque_enlaces, re.DOTALL).findall(data) - for enlaces in matchesenlaces: - enlaces = re.sub(r"alt=.*?<a href=.*?rar.*?>Click", "", enlaces) - enlaces = re.sub(r"\(Contrase.*?\).*?", "NO REPRODUCIBLE-RAR", enlaces) - if "Serie Completa" in item.extra.split("|")[2] or "pelicula" in item.extra.split("|")[2]: - patron = 'alt="[^<]+".*?".*?Click' - matches = re.compile(patron, re.DOTALL).findall(enlaces) + data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) + # logger.debug("data %s \n\n" % data) - scrapertools.printMatches(matches) - if krypton: - catchurl = re.compile('<a href="([^"]+)"', re.DOTALL).findall(str(matches)) - else: - catchurl = re.compile('<a href="/myaddrproxy.php/http/([^"]+)"', re.DOTALL).findall(str(matches)) + video_section = scrapertools.find_single_match(data, '<div class="contenedor_imagenes">(.*?)</div><center>') + # logger.debug("data %s \n\n" % video_section) - for datos in matches: + pattern = '<a href="(?P<url>[^"]+)">.*?<img.*?src="(?P<thumb>[^"]+)".*?class="bloque_superior">\s*' \ + '(?P<quality>.*?)\s*</div>.*?src="(?P<lang>[^"]+)".*?class="bloque_inferior">\s*(?P<title>.*?)\s*' \ + '</div>.*?class="div_inferior_date">\s*(?P<date>.*?)\s*</div>' - if "x Temporada" in item.extra.split("|")[2]: + matches = re.compile(pattern, re.DOTALL).findall(video_section) - for (a, b) in enumerate(matches): + for url, thumb, quality, lang, title, date in matches: + title = scrapertools.htmlclean(title) + title = re.sub(r"\s{2}", " ", title) - calidad = re.compile('alt="[^<]+" title=.*?;">(.*?)</span>', re.DOTALL).findall(b) - idioma = re.compile('alt="[^<]+" title=.*?;">[^<]+</span>.*?;">(.*?)</span>', - re.DOTALL).findall(b) + if "/series" in item.url: + if quality: + title2 = "%s [%s]" % (title, quality) - for (c, d) in enumerate(calidad): - xbmc.log("calidaddd") - xbmc.log(str(c)) - xbmc.log(str(d)) - - for (f, g) in enumerate(idioma): - xbmc.log("idiomaaaa") - xbmc.log(str(f)) - - xbmc.log("topotamadre") - xbmc.log(str(g)) - matches[a] = b.replace(b, "[COLOR orange][B]" + d + "[/B][/COLOR]") + "--" + b.replace(b, - "[COLOR palegreen][B]" + g + "[/B][/COLOR]") - else: - for (a, b) in enumerate(matches): - - calidad = re.compile('alt=.*?<td>(.*?)<', re.DOTALL).findall(b) - idioma = re.compile('alt=.*?<td>.*?<.*?<td>(.*?)<\/td>', re.DOTALL).findall(b) - - for (c, d) in enumerate(calidad): - xbmc.log("calidaddd") - xbmc.log(str(c)) - xbmc.log(str(d)) - - for (f, g) in enumerate(idioma): - xbmc.log("idiomaaaa") - xbmc.log(str(f)) - - xbmc.log("topotamadre") - xbmc.log(str(g)) - matches[a] = b.replace(b, "[COLOR orange][B]" + g + "[/B][/COLOR]") + "--" + b.replace(b, - "[COLOR palegreen][B]" + d + "[/B][/COLOR]") + itemlist.append(Item(channel=item.channel, action="episodios", title=title2, url=url, thumbnail=thumb, + quality=quality, contentTitle=title, contentType="tvshow")) else: - if item.extra.split("|")[1] != "Especial": - check = item.extra.split("|")[0] + "x" + item.extra.split("|")[1] - else: - check = item.extra.split("|")[1] - patron = 'icono_espaniol\.png" title="[^<]+" alt="[^<]+"><\/td>\\n<td>' + check + '.*?<\/td>\\n<td>[^<]+<\/td>.*?Click' # 'icono_.*?png" alt="([^<]+)" .*?;">([^<]+)</span>.*?;">(.*?)</span>.*?<a href="/myaddrproxy.php/http/([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(enlaces) - '''patron ='alt="[^<]+" title="[^<]+"/></td><td style="text-align:center"><span style="font-family: \'Open Sans\';">[^<]+</span></td><td style="text-align:center"><span style="font-family: \'Open Sans\';">'+check+'.*?Click' #'icono_.*?png" alt="([^<]+)" .*?;">([^<]+)</span>.*?;">(.*?)</span>.*? <a href="/myaddrproxy.php/http/([^"]+)"' - matches = re.compile(patron,re.DOTALL).findall(enlaces)''' + if quality: + title2 = "%s [%s]" % (title, quality) - scrapertools.printMatches(matches) - if krypton: - catchurl = re.compile('<a href="([^"]+)"', re.DOTALL).findall(str(matches)) - else: - catchurl = re.compile('<a href="/myaddrproxy.php/http/([^"]+)"', re.DOTALL).findall(str(matches)) + itemlist.append(Item(channel=item.channel, action="findvideos", title=title2, url=url, thumbnail=thumb, + quality=quality, contentTitle=title, contentType="movie")) - for datos in matches: - - for (a, b) in enumerate(matches): - - calidad = scrapertools.find_multiple_matches(b, 'alt=".*?<td>.*?<td>(.*?)<') - idioma = re.compile('alt="([^<]+)">', re.DOTALL).findall(b) - peso = re.compile('alt="[^<]+"><\/td>\\n<td>(.*?)<\/td>\\n<td>.*?<\/td>', re.DOTALL).findall(b) - - for (c, d) in enumerate(calidad): - xbmc.log("calidaddd") - xbmc.log(str(c)) - xbmc.log(str(d)) - - for (f, g) in enumerate(idioma): - xbmc.log("idiomaaaa") - xbmc.log(str(f)) - - xbmc.log("topotamadre") - xbmc.log(str(g)) - - for (h, i) in enumerate(peso): - if "RAR" in i: - i = " (No reproducible--RAR)" - else: - i = "" - if not "x" in g: - xbmc.log("digiiiit") - g = check - matches[a] = "[COLOR crimson][B]Capitulo[/B][/COLOR]" + "--" + b.replace(b, - "[COLOR orange][B]" + g + "[/B][/COLOR]") + "--" + b.replace( - b, "[COLOR palegreen][B]" + d + i + "[/B][/COLOR]") - - get_url = [(z, x) for z, x in enumerate(catchurl)] - get_url = repr(get_url) - - index = xbmcgui.Dialog().select("[COLOR orange][B]Seleciona calidad...[/B][/COLOR]", matches) - - if index != -1: - index = str(index) - url = scrapertools.get_match(get_url, '\(' + index + ', \'(.*?)\'') - if krypton: - item.url = url - else: - item.url = "http://" + url - item.server = "torrent" - platformtools.play_video(item) - xbmc.executebuiltin('Action(Back)') - xbmc.sleep(100) - else: - xbmc.executebuiltin('Action(Back)') - xbmc.sleep(100) + pagination = scrapertools.find_single_match(data, '<div class="navigation">(.*?)</ul>') + if pagination: + next_page = scrapertools.find_single_match(pagination, 'class="active"><a.*?<a.*?href="([^"]+)') + # logger.debug("next %s" % next_page) + if next_page: + itemlist.append(Item(channel=item.channel, action="listado", title=">> Página siguiente", url=next_page, + thumbnail=get_thumb("next.png"))) return itemlist +def episodios(item): + logger.info() + + itemlist = [] + dict_data = dict() + dict_data, item = get_episodes(item, dict_data) + + for key in dict_data.keys(): + d = dict_data[key] + quality = "[%s]" % "][".join(d["quality"]) + + d["s_e"] = re.sub(r"\(Contrase.*?\)\s*", "NO REPRODUCIBLE-RAR", d["s_e"]) + title = "%s [%s] %s" % (d["s_e"], d["lang"], quality) + logger.debug("bla %s" % d["s_e"]) + + if "temporada" in d["s_e"].lower(): + regex = re.compile('temporada\s*', re.I) + d["s_e"] = regex.sub("", d["s_e"]) + season = scrapertools.find_single_match(d["s_e"], "(\d+)") + episode = 1 + else: + season, episode = scrapertools.find_single_match(d["s_e"], "(\d+)×(\d+)") + + itemlist.append(item.clone(action="findvideos", title=title, thumbnail=item.thumbnail, url=d["url"], + server="torrent", contentSeason=season, contentEpisodeNumber=episode, + contentType="tvshow", fulltitle=item.title, quality=d["quality"], lang=d["lang"])) + + # order list + if len(itemlist) > 1: + itemlist = sorted(itemlist, key=lambda it: (int(it.contentSeason), int(it.contentEpisodeNumber))) + + try: + from core import tmdb + tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__) + except: + pass + + return itemlist + + +def get_episodes(item, dict_data): + global dict_url_seasons + + data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) + # logger.debug("data %s \n\n" % data) + if item.contentTitle != "": + title = scrapertools.find_single_match(data, '<div class="titulo_page_exit">(.*?)[.]</div>') + year = scrapertools.find_single_match(data, '<div class="ano_page_exit">(\d+)</div>') + # logger.debug("title es %s" % title) + if title: + item.contentTitle = title + item.show = title + if year: + item.infoLabels['year'] = year + + links_section = scrapertools.find_single_match(data, 'div id="Tokyo" [^>]+>(.*?)</div>') + # logger.debug("data %s \n\n" % data) + + pattern = 'icono_.*?png" title="(?P<lang>.*?)" [^>]+></td><td>(?P<s_e>.*?)</td><td>(?P<quality>.*?)</td><td>' \ + '<a href="(?P<url>[^"]+)"' + matches = re.compile(pattern, re.DOTALL).findall(links_section) + for lang, s_e, quality, url in matches: + if s_e + lang not in dict_data: + dict_data[s_e + lang] = {"url": [url], "lang": lang, "s_e": s_e, + "quality": [quality]} + else: + if quality not in dict_data[s_e+lang]["quality"]: + dict_data[s_e + lang]["quality"].append(quality) + dict_data[s_e + lang]["url"].append(url) + + url_to_check = scrapertools.find_single_match(links_section, '</table><p><a .*?href="([^"]+)">Temporada.*?</a>') + # logger.debug("url es %s " % url_to_check) + + # if url doesn't exist we add it into the dict + if url_to_check not in dict_url_seasons: + dict_url_seasons[url_to_check] = False + + for key, value in dict_url_seasons.items(): + if not value: + item.url = key + dict_url_seasons[key] = True + dict_data, item = get_episodes(item, dict_data) + + # logger.debug("URL_LIST es %s " % dict_url_seasons) + + return dict_data, item + + def findvideos(item): logger.info() - check_iepi2 = " " itemlist = [] - data = get_page(item.url) - check_calidad = "" - check_epi = "" - check_especial = "" - if not "series" in item.url: - thumbnail = item.category - if "series" in item.url: + + if item.contentType == "movie": + + data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) + # logger.debug("data %s \n\n" % data) + + if item.contentTitle != "": + title = scrapertools.find_single_match(data, '<div class="titulo_page_exit">(.*?)[.]</div>') + year = scrapertools.find_single_match(data, '<div class="ano_page_exit">(\d+)</div>') + logger.debug("title es %s" % title) + if title: + item.contentTitle = title + item.show = title + if year: + item.infoLabels['year'] = year + + links_section = scrapertools.find_single_match(data, 'div id="Tokyo" [^>]+>(.*?)</div>') + # logger.debug("data %s \n\n" % data) + + pattern = 'icono_.*?png" title="(?P<lang>.*?)" [^>]+></td><td>(?P<quality>.*?)</td><td>(?P<size>.*?)</td><td>' \ + '<a href="(?P<url>[^"]+)"' + matches = re.compile(pattern, re.DOTALL).findall(links_section) + + for lang, quality, size, url in matches: + title = "[%s] [%s] (%s)" % (lang, quality, size) + + itemlist.append(item.clone(action="play", title=title, url=url, thumbnail=item.thumbnail, server="torrent", + fulltitle=item.title)) + try: - if krypton: - url = scrapertools.get_match(data, '<a style="float:left;" href="([^"]+)">Temporada Anterior') - else: - url = scrapertools.get_match(data, - '<a style="float:left;" href="/myaddrproxy.php/https/([^"]+)">Temporada Anterior') - url_a = "http://" + url - temp_a = scrapertools.get_match(url, 'temporada-(\d+)') - year = item.extra.split("|")[1] - - title_info = item.show.split("|")[3].replace(' ', '%20') - - try: - backdrop = scrapertools.get_match(data2, 'page":1.*?,"id".*?"backdrop_path":"\\\(.*?)"') - fanart = "https://image.tmdb.org/t/p/original" + backdrop - - except: - fanart = item.show.split("|")[0] - url_temp = "http://api.themoviedb.org/3/tv/" + item.show.split("|")[ - 5] + "/season/" + temp_a + "/images?api_key=" + api_key + "" - data2 = scrapertools.cachePage(url_temp) - data2 = re.sub(r"\n|\r|\t|\s{2}| ", "", data2) - patron = '{"id".*?"file_path":"(.*?)","height"' - matches = re.compile(patron, re.DOTALL).findall(data2) - if len(matches) == 0: - thumbnail = item.thumbnail - for thumtemp in matches: - thumbnail = "https://image.tmdb.org/t/p/original" + thumtemp - if "Temporada" in item.title: - new_temp = "Temporada " + temp_a - title = re.sub(r"Temporada.*?(\d+)", new_temp, item.title) - title = re.sub(r"skyblue", "tomato", title) - else: - title = "[COLOR darkturquoise][B]TEMPORADA ANTERIOR[/B][/COLOR]" - - itemlist.append( - Item(channel=item.channel, title=title, url=url_a, action="findvideos", thumbnail=thumbnail, - extra=item.extra, show=item.show, fanart=fanart, folder=True)) - + from core import tmdb + tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__) except: pass - patronbloque_enlaces = '<tr class="lol">(.*?)ha sido descargada' - matchesenlaces = re.compile(patronbloque_enlaces, re.DOTALL).findall(data) - for enlaces in matchesenlaces: - if "serie" in item.url: - try: - temp_check = scrapertools.find_single_match(enlaces, - 'icono_.*?png".*?alt=".*?".*?<td>(\d+&#\d+;\d+)<\/td>.*?<td>.*?<\/td>') - if temp_check == "": - temp_check = scrapertools.find_single_match(enlaces, - 'icono_.*?png".*?alt=".*?".*?<td>(\d+&#\d+;\d+-\d+)<\/td>.*?<td>.*?<\/td>') - if temp_check == "": - check = "" - else: - check = "yes" - else: - check = "yes" - except: - check = "" - - else: - check = "pelicula" - - if "Completa" in item.title and check == "" or not "Completa" in item.title and check == "": - if krypton: - patron = 'icono_.*?png" title="(.*?)".*?<td>.*?<.*?<td>(.*?)<.*?<a href="([^"]+)"' - else: - patron = 'icono_.*?png" title="(.*?)".*?<td>.*?<.*?<td>(.*?)<.*?<a href="/myaddrproxy.php/http/([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(enlaces) - scrapertools.printMatches(matches) - - for calidad, idioma, url in matches: - - year = item.extra.split("|")[1] - try: - temp = scrapertools.get_match(item.url, 'temporada-(\d+)') - except: - temp = "0" - url_tmdb2 = "http://api.themoviedb.org/3/tv/" + item.show.split("|")[ - 5] + "/season/" + temp + "/images?api_key=" + api_key + "" - data = httptools.downloadpage(url_tmdb2).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '{"id".*?"file_path":"(.*?)","height"' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - if "TEMPORADA ANTERIOR" in item.title: - fanart = item.fanart - thumbnail = item.thumbnail - title = "[COLOR steelblue][B]" + idioma + "[/B][/COLOR]" + "-" + "[COLOR lightskyblue][B]" + calidad + "[/B][/COLOR]" - title = re.sub(r"tomato", "skyblue", title) - itemlist.append( - Item(channel=item.channel, title=title, action="play", url="http://" + url, server="torrent", - thumbnail=thumbnail, extra=item.extra, show=item.show, fanart=item.show.split("|")[0], - folder=False)) - for thumtemp in matches: - thumbnail = "https://image.tmdb.org/t/p/original" + thumtemp - if "TEMPORADA ANTERIOR" in item.title: - fanart = item.fanart - - title = "[COLOR steelblue][B]" + idioma + "[/B][/COLOR]" + "-" + "[COLOR lightskyblue][B]" + calidad + "[/B][/COLOR]" - title = re.sub(r"tomato", "skyblue", title) - if not "http://" in url: - url = "http://" + url - itemlist.append(Item(channel=item.channel, title=title, action="play", url=url, server="torrent", - thumbnail=thumbnail, extra=item.extra, show=item.show, - fanart=item.show.split("|")[0], folder=False)) - else: - if krypton: - patron = 'icono_.*?png".*?alt="(.*?)".*?<td>(.*?)<\/td>.*?<td>(.*?)<\/td>.*?href="([^"]+)"' - else: - patron = 'icono_.*?png".*?alt="(.*?)".*?<td>(.*?)<\/td>.*?<td>(.*?)<\/td>.*?href="\/myaddrproxy.php\/http\/([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(enlaces) - scrapertools.printMatches(matches) - - for calidad, idioma, peso, url in matches: - if not "Especial:" in idioma: - check_especial = "" - if "Temporada" in item.title: - try: - temp_check = scrapertools.find_single_match(enlaces, - 'icono_.*?png".*?alt=".*?".*?<td>(\d+&#\d+;\d+)<\/td>.*?<td>.*?<\/td>') - if temp_check == "": - check = "" - else: - check = "yes" - except: - check = "" - - idioma = re.sub(r'\(Contra.*?\)', '', idioma) - if "Completa" in peso and check == "": - continue - if krypton: - url = url - else: - url = "http://" + url - torrents_path = config.get_videolibrary_path() + '/torrents' - if not os.path.exists(torrents_path): - os.mkdir(torrents_path) - try: - urllib.urlretrieve("http://anonymouse.org/cgi-bin/anon-www.cgi/" + url, - torrents_path + "/temp.torrent") - pepe = open(torrents_path + "/temp.torrent", "rb").read() - except: - pepe = "" - torrent = decode(pepe) - try: - name = torrent["info"]["name"] - sizet = torrent["info"]['length'] - sizet = convert_size(sizet) - except: - name = "no disponible" - try: - check_video = scrapertools.find_multiple_matches(str(torrent["info"]["files"]), "'length': (\d+)}") - size = max([int(i) for i in check_video]) - for file in torrent["info"]["files"]: - manolo = "%r - %d bytes" % ("/".join(file["path"]), file["length"]) - if str(size) in manolo: - video = manolo - size = convert_size(size) - ext_v = re.sub(r"-.*? bytes|.*?\[.*?\].|'|.*?COM.|.*?\[.*?\]|\(.*?\)|.*?\.", "", video) - try: - os.remove(torrents_path + "/temp.torrent") - except: - pass - except: - try: - size = sizet - ext_v = re.sub(r"-.*? bytes|.*?\[.*?\].|'|.*?COM.|.*?\.es.|.*?\[.*?\]|.*?\(.*?\)\.|.*?\.", "", - name) - except: - size = "NO REPRODUCIBLE" - ext_v = "" - try: - os.remove(torrents_path + "/temp.torrent") - except: - pass - if "rar" in ext_v: - ext_v = ext_v + " -- No reproducible" - size = "" - - title = "[COLOR gold][B]" + idioma + "[/B][/COLOR]" + "-" + "[COLOR lemonchiffon][B]" + calidad + "[/B][/COLOR]" + "-" + "[COLOR khaki] ( Video" + "[/COLOR]" + " " + "[COLOR khaki]" + ext_v + "[/COLOR]" + " " + "[COLOR khaki]" + size + " )" + "[/COLOR]" - - if "series" in item.url and not "Completa" in item.title or check != "" and check != "pelicula": - year = item.extra.split("|")[1] - # idioma= re.sub(r"-.*","",idioma) - check = calidad + "|" + peso + "|" + idioma - temp_epi = re.compile('(\d)&#.*?;(\d+)', re.DOTALL).findall(check) - - for temp, epi in temp_epi: - url_tmdb2 = "http://api.themoviedb.org/3/tv/" + item.show.split("|")[ - 5] + "/season/" + temp + "/images?api_key=" + api_key + "" - data = httptools.downloadpage(url_tmdb2).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '{"id".*?"file_path":"(.*?)","height"' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - thumbnail = item.thumbnail - for thumtemp in matches: - thumbnail = "https://image.tmdb.org/t/p/original" + thumtemp - - if check_epi == epi and check_calidad != peso and not "Especial:" in idioma or "Especial:" in idioma and check_especial == "yes": - check_info = "no" - title = " [COLOR mediumslateblue][B]Versión[/B][/COLOR]" + " " + "[COLOR royalblue][B]" + peso + "[/B][/COLOR]" + "[COLOR turquoise] ( Video" + "[/COLOR]" + " " + "[COLOR turquoise]" + ext_v + "[/COLOR]" + " " + "[COLOR turquoise]" + size + " )" + "[/COLOR]" - else: - check_info = "yes" - if "Especial:" in idioma: - check_especial = "yes" - title = "[COLOR steelblue][B]" + idioma + "[/B][/COLOR]" + "-" + "[COLOR lightskyblue][B]" + calidad + "[/B][/COLOR]" + "-" + "[COLOR royalblue][B]" + peso + "[/B][/COLOR]" + "[COLOR turquoise] ( Video" + "[/COLOR]" + " " + "[COLOR turquoise]" + ext_v + "[/COLOR]" + " " + "[COLOR turquoise]" + size + " )" + "[/COLOR]" - - check_epi = epi - check_calidad = peso - - itemlist.append(Item(channel=item.channel, title=title, action="play", url=url, server="torrent", - thumbnail=thumbnail, extra=item.extra, show=item.show, - fanart=item.show.split("|")[0], folder=False)) - - if "series" in item.url: - if check_info == "yes": - extra = item.extra + "|" + temp + "|" + epi - if "-" in idioma: - temp_epi2 = re.compile('\d&#.*?;\d+-(\d+)', re.DOTALL).findall(check) - for epi2 in temp_epi2: - len_epis = int(epi2) - int(epi) - if len_epis == 1: - check_iepi2 = "ok" - title_info = " Info Cap." + epi - title_info = "[COLOR skyblue]" + title_info + "[/COLOR]" - itemlist.append( - Item(channel=item.channel, action="info_capitulos", title=title_info, - url=item.url, thumbnail=thumbnail, fanart=item.show.split("|")[0], - extra=extra, show=item.show, category=item.category, folder=False)) - else: - epis_len = range(int(epi), int(epi2) + 1) - extra = item.extra + "|" + temp + "|" + str(epis_len) - title_info = " Info Capítulos" - title_info = "[COLOR skyblue]" + title_info + "[/COLOR]" - itemlist.append( - Item(channel=item.channel, action="capitulos", title=title_info, url=item.url, - thumbnail=thumbnail, fanart=item.show.split("|")[0], extra=extra, - show=item.show, category=item.category, folder=True)) - check_iepi2 = "" - else: - title_info = " Info" - title_info = "[COLOR skyblue]" + title_info + "[/COLOR]" - itemlist.append( - Item(channel=item.channel, action="info_capitulos", title=title_info, url=item.url, - thumbnail=thumbnail, fanart=item.show.split("|")[0], extra=extra, show=item.show, - category=item.category, folder=False)) - - if check_iepi2 == "ok": - extra = item.extra + "|" + temp + "|" + epi2 - title_info = " Info Cap." + epi2 - title_info = "[COLOR skyblue]" + title_info + "[/COLOR]" - itemlist.append( - Item(channel=item.channel, action="info_capitulos", title=title_info, url=item.url, - thumbnail=thumbnail, fanart=item.show.split("|")[0], extra=extra, show=item.show, - category=item.category, folder=False)) + else: + for index, url in enumerate(item.url): + title = "%sx%s [%s] [%s]" % (item.contentSeason, item.contentEpisodeNumber, item.lang, item.quality[index]) + itemlist.append(item.clone(action="play", title=title, url=url, thumbnail=item.thumbnail, server="torrent", + quality=item.quality[index])) return itemlist - - -def capitulos(item): - logger.info() - itemlist = [] - url = item.url - capis = item.extra.split("|")[3] - capis = re.sub(r'\[|\]', '', capis) - capis = [int(k) for k in capis.split(',')] - for i in capis: - extra = item.extra.split("|")[0] + "|" + item.extra.split("|")[1] + "|" + item.extra.split("|")[2] + "|" + str( - i) - itemlist.append( - Item(channel=item.channel, action="info_capitulos", title="[COLOR skyblue]Info Cap." + str(i) + "[/COLOR]", - url=item.url, thumbnail=item.thumbnail, fanart=item.show.split("|")[0], extra=extra, show=item.show, - category=item.category, folder=False)) - return itemlist - - -def info(item): - logger.info() - itemlist = [] - url = item.url - id = item.extra - - if "serie" in item.url: - try: - rating_tmdba_tvdb = item.extra.split("|")[6] - if item.extra.split("|")[6] == "": - rating_tmdba_tvdb = "Sin puntuación" - except: - rating_tmdba_tvdb = "Sin puntuación" - else: - rating_tmdba_tvdb = item.extra.split("|")[3] - rating_filma = item.extra.split("|")[4] - print "eztoquee" - print rating_filma - print rating_tmdba_tvdb - - filma = "http://s6.postimg.org/6yhe5fgy9/filma.png" - - try: - if "serie" in item.url: - title = item.extra.split("|")[8] - - else: - title = item.extra.split("|")[6] - title = title.replace("%20", " ") - title = "[COLOR yellow][B]" + title + "[/B][/COLOR]" - except: - title = item.title - - try: - if "." in rating_tmdba_tvdb: - check_rat_tmdba = scrapertools.get_match(rating_tmdba_tvdb, '(\d+).') - else: - check_rat_tmdba = rating_tmdba_tvdb - if int(check_rat_tmdba) >= 5 and int(check_rat_tmdba) < 8: - rating = "[COLOR springgreen][B]" + rating_tmdba_tvdb + "[/B][/COLOR]" - elif int(check_rat_tmdba) >= 8 or rating_tmdba_tvdb == 10: - rating = "[COLOR yellow][B]" + rating_tmdba_tvdb + "[/B][/COLOR]" - else: - rating = "[COLOR crimson][B]" + rating_tmdba_tvdb + "[/B][/COLOR]" - print "lolaymaue" - except: - rating = "[COLOR crimson][B]" + rating_tmdba_tvdb + "[/B][/COLOR]" - if "10." in rating: - rating = re.sub(r'10\.\d+', '10', rating) - try: - check_rat_filma = scrapertools.get_match(rating_filma, '(\d)') - print "paco" - print check_rat_filma - if int(check_rat_filma) >= 5 and int(check_rat_filma) < 8: - print "dios" - print check_rat_filma - rating_filma = "[COLOR springgreen][B]" + rating_filma + "[/B][/COLOR]" - elif int(check_rat_filma) >= 8: - - print check_rat_filma - rating_filma = "[COLOR yellow][B]" + rating_filma + "[/B][/COLOR]" - else: - rating_filma = "[COLOR crimson][B]" + rating_filma + "[/B][/COLOR]" - print "rojo??" - print check_rat_filma - except: - rating_filma = "[COLOR crimson][B]" + rating_filma + "[/B][/COLOR]" - - try: - if not "serie" in item.url: - url_plot = "http://api.themoviedb.org/3/movie/" + item.extra.split("|")[ - 1] + "?api_key=" + api_key + "&append_to_response=credits&language=es" - data_plot = scrapertools.cache_page(url_plot) - plot, tagline = scrapertools.find_single_match(data_plot, '"overview":"(.*?)",.*?"tagline":(".*?")') - if plot == "": - plot = item.show.split("|")[2] - - plot = "[COLOR moccasin][B]" + plot + "[/B][/COLOR]" - plot = re.sub(r"\\", "", plot) - - else: - plot = item.show.split("|")[2] - plot = "[COLOR moccasin][B]" + plot + "[/B][/COLOR]" - plot = re.sub(r"\\", "", plot) - - if item.extra.split("|")[7] != "": - tagline = item.extra.split("|")[7] - # tagline= re.sub(r',','.',tagline) - else: - tagline = "" - except: - title = "[COLOR red][B]LO SENTIMOS...[/B][/COLOR]" - plot = "Esta pelicula no tiene informacion..." - plot = plot.replace(plot, "[COLOR yellow][B]" + plot + "[/B][/COLOR]") - photo = "http://s6.postimg.org/nm3gk1xox/noinfosup2.png" - foto = "http://s6.postimg.org/ub7pb76c1/noinfo.png" - info = "" - - if "serie" in item.url: - check2 = "serie" - thumb_busqueda = "http://imgur.com/84pleyQ.png" - icon = "http://s6.postimg.org/hzcjag975/tvdb.png" - foto = item.show.split("|")[1] - if item.extra.split("|")[5] != "": - critica = item.extra.split("|")[5] - else: - critica = "Esta serie no tiene críticas..." - - photo = item.extra.split("|")[0].replace(" ", "%20") - try: - tagline = "[COLOR aquamarine][B]" + tagline + "[/B][/COLOR]" - except: - tagline = "" - - else: - thumb_busqueda = "http://imgur.com/Slbtn28.png" - critica = item.extra.split("|")[5] - if "%20" in critica: - critica = "No hay críticas" - icon = "http://imgur.com/SenkyxF.png" - - photo = item.extra.split("|")[0].replace(" ", "%20") - foto = item.show.split("|")[1] - if foto == item.thumbnail: - foto = "http://imgur.com/5jEL62c.jpg" - - try: - if tagline == "\"\"": - tagline = " " - except: - tagline = " " - tagline = "[COLOR aquamarine][B]" + tagline + "[/B][/COLOR]" - check2 = "pelicula" - # Tambien te puede interesar - peliculas = [] - if "serie" in item.url: - - url_tpi = "http://api.themoviedb.org/3/tv/" + item.show.split("|")[ - 5] + "/recommendations?api_key=" + api_key + "&language=es" - data_tpi = scrapertools.cachePage(url_tpi) - tpi = scrapertools.find_multiple_matches(data_tpi, - 'id":(.*?),.*?"original_name":"(.*?)",.*?"poster_path":(.*?),') - - else: - url_tpi = "http://api.themoviedb.org/3/movie/" + item.extra.split("|")[ - 1] + "/recommendations?api_key=" + api_key + "&language=es" - data_tpi = scrapertools.cachePage(url_tpi) - tpi = scrapertools.find_multiple_matches(data_tpi, - 'id":(.*?),.*?"original_title":"(.*?)",.*?"poster_path":(.*?),') - - for idp, peli, thumb in tpi: - - thumb = re.sub(r'"|}', '', thumb) - if "null" in thumb: - thumb = "http://s6.postimg.org/tw1vhymj5/noposter.png" - else: - thumb = "https://image.tmdb.org/t/p/original" + thumb - peliculas.append([idp, peli, thumb]) - - check2 = check2.replace("pelicula", "movie").replace("serie", "tvshow") - infoLabels = {'title': title, 'plot': plot, 'thumbnail': photo, 'fanart': foto, 'tagline': tagline, - 'rating': rating} - item_info = item.clone(info=infoLabels, icon=icon, extra=id, rating=rating, rating_filma=rating_filma, - critica=critica, contentType=check2, thumb_busqueda=thumb_busqueda) - from channels import infoplus - infoplus.start(item_info, peliculas) - - -def info_capitulos(item): - logger.info() - url = "https://api.themoviedb.org/3/tv/" + item.show.split("|")[5] + "/season/" + item.extra.split("|")[ - 2] + "/episode/" + item.extra.split("|")[3] + "?api_key=" + api_key + "&language=es" - - if "/0" in url: - url = url.replace("/0", "/") - - data = httptools.downloadpage(url).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - - patron = '],"name":"(.*?)","overview":"(.*?)".*?"still_path":(.*?),"vote_average":(\d+\.\d).*?,"' - matches = re.compile(patron, re.DOTALL).findall(data) - - if len(matches) == 0: - - url = "http://thetvdb.com/api/1D62F2F90030C444/series/" + item.category + "/default/" + item.extra.split("|")[ - 2] + "/" + item.extra.split("|")[3] + "/es.xml" - if "/0" in url: - url = url.replace("/0", "/") - data = httptools.downloadpage(url).data - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - - patron = '<Data>.*?<EpisodeName>([^<]+)</EpisodeName>.*?<Overview>(.*?)</Overview>.*?<Rating>(.*?)</Rating>' - - matches = re.compile(patron, re.DOTALL).findall(data) - - if len(matches) == 0: - - title = "[COLOR red][B]LO SENTIMOS...[/B][/COLOR]" - plot = "Este capitulo no tiene informacion..." - plot = "[COLOR yellow][B]" + plot + "[/B][/COLOR]" - image = "http://s6.postimg.org/ub7pb76c1/noinfo.png" - foto = "http://s6.postimg.org/nm3gk1xox/noinfosup2.png" - rating = "" - - - else: - - for name_epi, info, rating in matches: - if "<filename>episodes" in data: - foto = scrapertools.get_match(data, '<Data>.*?<filename>(.*?)</filename>') - fanart = "http://thetvdb.com/banners/" + foto - else: - fanart = "http://imgur.com/ZiEAVOD.png" - plot = info - plot = "[COLOR peachpuff][B]" + plot + "[/B][/COLOR]" - title = name_epi.upper() - title = "[COLOR bisque][B]" + title + "[/B][/COLOR]" - image = fanart - foto = item.extra.split("|")[0] - if not ".png" in foto: - if "serie" in item.url: - foto = "http://imgur.com/6uXGkrz.png" - else: - foto = "http://i.imgur.com/5jEL62c.png" - foto = re.sub(r'\(.*?\)|" "|" "', '', foto) - foto = re.sub(r' ', '', foto) - try: - - check_rating = scrapertools.get_match(rating, '(\d+).') - - if int(check_rating) >= 5 and int(check_rating) < 8: - rating = "Puntuación " + "[COLOR springgreen][B]" + rating + "[/B][/COLOR]" - elif int(check_rating) >= 8 and int(check_rating) < 10: - rating = "Puntuación " + "[COLOR yellow][B]" + rating + "[/B][/COLOR]" - elif int(check_rating) == 10: - rating = "Puntuación " + "[COLOR orangered][B]" + rating + "[/B][/COLOR]" - else: - rating = "Puntuación " + "[COLOR crimson][B]" + rating + "[/B][/COLOR]" - - except: - rating = "Puntuación " + "[COLOR crimson][B]" + rating + "[/B][/COLOR]" - if "10." in rating: - rating = re.sub(r'10\.\d+', '10', rating) - else: - for name_epi, info, fanart, rating in matches: - if info == "" or info == "\\": - info = "Sin informacion del capítulo aún..." - plot = info - plot = re.sub(r'/n', '', plot) - plot = "[COLOR peachpuff][B]" + plot + "[/B][/COLOR]" - title = name_epi.upper() - title = "[COLOR bisque][B]" + title + "[/B][/COLOR]" - image = fanart - image = re.sub(r'"|}', '', image) - if "null" in image: - image = "http://imgur.com/ZiEAVOD.png" - else: - image = "https://image.tmdb.org/t/p/original" + image - foto = item.extra.split("|")[0] - if not ".png" in foto: - if "serie" in item.url: - foto = "http://imgur.com/6uXGkrz.png" - else: - foto = "http://i.imgur.com/5jEL62c.png" - foto = re.sub(r'\(.*?\)|" "|" "', '', foto) - foto = re.sub(r' ', '', foto) - try: - - check_rating = scrapertools.get_match(rating, '(\d+).') - - if int(check_rating) >= 5 and int(check_rating) < 8: - rating = "Puntuación " + "[COLOR springgreen][B]" + rating + "[/B][/COLOR]" - elif int(check_rating) >= 8 and int(check_rating) < 10: - rating = "Puntuación " + "[COLOR yellow][B]" + rating + "[/B][/COLOR]" - elif int(check_rating) == 10: - rating = "Puntuación " + "[COLOR orangered][B]" + rating + "[/B][/COLOR]" - else: - rating = "Puntuación " + "[COLOR crimson][B]" + rating + "[/B][/COLOR]" - - except: - rating = "Puntuación " + "[COLOR crimson][B]" + rating + "[/B][/COLOR]" - if "10." in rating: - rating = re.sub(r'10\.\d+', '10', rating) - ventana = TextBox2(title=title, plot=plot, thumbnail=image, fanart=foto, rating=rating) - ventana.doModal() - - -class TextBox2(xbmcgui.WindowDialog): - """ Create a skinned textbox window """ - - def __init__(self, *args, **kwargs): - self.getTitle = kwargs.get('title') - self.getPlot = kwargs.get('plot') - self.getThumbnail = kwargs.get('thumbnail') - self.getFanart = kwargs.get('fanart') - self.getRating = kwargs.get('rating') - - self.background = xbmcgui.ControlImage(70, 20, 1150, 630, 'http://imgur.com/gh1GShA.jpg') - self.title = xbmcgui.ControlTextBox(120, 60, 430, 50) - self.rating = xbmcgui.ControlTextBox(145, 112, 1030, 45) - self.plot = xbmcgui.ControlTextBox(120, 150, 1056, 100) - self.thumbnail = xbmcgui.ControlImage(120, 300, 1056, 300, self.getThumbnail) - self.fanart = xbmcgui.ControlImage(780, 43, 390, 100, self.getFanart) - - self.addControl(self.background) - self.background.setAnimations( - [('conditional', 'effect=slide start=1000% end=0% time=1500 condition=true tween=bounce',), - ('WindowClose', 'effect=slide delay=800 start=0% end=1000% time=800 condition=true',)]) - self.addControl(self.thumbnail) - self.thumbnail.setAnimations([('conditional', - 'effect=zoom start=0% end=100% delay=2700 time=1500 condition=true tween=elastic easing=inout',), - ('WindowClose', 'effect=slide end=0,700% time=300 condition=true',)]) - self.addControl(self.plot) - self.plot.setAnimations( - [('conditional', 'effect=zoom delay=2000 center=auto start=0 end=100 time=800 condition=true ',), ( - 'conditional', - 'effect=rotate delay=2000 center=auto aceleration=6000 start=0% end=360% time=800 condition=true',), - ('WindowClose', 'effect=zoom center=auto start=100% end=-0% time=600 condition=true',)]) - self.addControl(self.fanart) - self.fanart.setAnimations( - [('WindowOpen', 'effect=slide start=0,-700 delay=1000 time=2500 tween=bounce condition=true',), ( - 'conditional', - 'effect=rotate center=auto start=0% end=360% delay=3000 time=2500 tween=bounce condition=true',), - ('WindowClose', 'effect=slide end=0,-700% time=1000 condition=true',)]) - self.addControl(self.title) - self.title.setText(self.getTitle) - self.title.setAnimations( - [('conditional', 'effect=slide start=-1500% end=0% delay=1000 time=2000 condition=true tween=elastic',), - ('WindowClose', 'effect=slide start=0% end=-1500% time=800 condition=true',)]) - self.addControl(self.rating) - self.rating.setText(self.getRating) - self.rating.setAnimations( - [('conditional', 'effect=fade start=0% end=100% delay=3000 time=1500 condition=true',), - ('WindowClose', 'effect=slide end=0,-700% time=600 condition=true',)]) - xbmc.sleep(200) - - try: - self.plot.autoScroll(7000, 6000, 30000) - except: - - xbmc.executebuiltin( - 'Notification([COLOR red][B]Actualiza Kodi a su última versión[/B][/COLOR], [COLOR skyblue]para mejor info[/COLOR],8000,"https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/kodi-icon.png")') - self.plot.setText(self.getPlot) - - def get(self): - self.show() - - def onAction(self, action): - if action == ACTION_PREVIOUS_MENU or action.getId() == ACTION_GESTURE_SWIPE_LEFT or action == 110 or action == 92: - self.close() - - -def test(): - return True - - -def translate(to_translate, to_langage="auto", langage="auto"): - '''Return the translation using google translate - you must shortcut the langage you define (French = fr, English = en, Spanish = es, etc...) - if you don't define anything it will detect it or use english by default - Example: - print(translate("salut tu vas bien?", "en")) - hello you alright?''' - agents = { - 'User-Agent': "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)"} - before_trans = 'class="t0">' - link = "http://translate.google.com/m?hl=%s&sl=%s&q=%s" % (to_langage, langage, to_translate.replace(" ", "+")) - import urllib2 - request = urllib2.Request(link, headers=agents) - page = urllib2.urlopen(request).read() - result = page[page.find(before_trans) + len(before_trans):] - result = result.split("<")[0] - return result - - -if __name__ == '__main__': - to_translate = 'Hola como estas?' - print("%s >> %s" % (to_translate, translate(to_translate))) - print("%s >> %s" % (to_translate, translate(to_translate, 'fr'))) - - -# should print Hola como estas >> Hello how are you -# and Hola como estas? >> Bonjour comment allez-vous? - - - -def tokenize(text, match=re.compile("([idel])|(\d+):|(-?\d+)").match): - i = 0 - while i < len(text): - m = match(text, i) - s = m.group(m.lastindex) - i = m.end() - if m.lastindex == 2: - yield "s" - yield text[i:i + int(s)] - i = i + int(s) - else: - yield s - - -def decode_item(next, token): - if token == "i": - # integer: "i" value "e" - data = int(next()) - if next() != "e": - raise ValueError - elif token == "s": - # string: "s" value (virtual tokens) - data = next() - elif token == "l" or token == "d": - # container: "l" (or "d") values "e" - data = [] - tok = next() - while tok != "e": - data.append(decode_item(next, tok)) - tok = next() - if token == "d": - data = dict(zip(data[0::2], data[1::2])) - else: - raise ValueError - return data - - -def decode(text): - try: - src = tokenize(text) - data = decode_item(src.next, src.next()) - for token in src: # look for more tokens - data = data - except (AttributeError, ValueError, StopIteration): - try: - data = data - except: - data = src - - return data - - -def convert_size(size): - import math - if (size == 0): - return '0B' - size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") - i = int(math.floor(math.log(size, 1024))) - p = math.pow(1024, i) - s = round(size / p, 2) - return '%s %s' % (s, size_name[i]) - - -def busqueda(item): - logger.info() - cat = [item.extra.split("|")[0].replace("tv", "serie"), 'torrent'] - new_item = Item() - new_item.extra = item.extra.split("|")[1].replace("+", " ") - new_item.category = item.extra.split("|")[0] - - from channels import search - return search.do_search(new_item, cat) From c7a87b50059d127394b545ca0ef47b688ba2f2dd Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 08:59:24 -0500 Subject: [PATCH 06/14] Update allcalidad.py --- plugin.video.alfa/channels/allcalidad.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.video.alfa/channels/allcalidad.py b/plugin.video.alfa/channels/allcalidad.py index 0894a0a5..ede804b0 100755 --- a/plugin.video.alfa/channels/allcalidad.py +++ b/plugin.video.alfa/channels/allcalidad.py @@ -138,8 +138,8 @@ def findvideos(item): if config.get_videolibrary_support(): itemlist.append(Item(channel=item.channel, title="Añadir a la videoteca", text_color="green", filtro=True, action="add_pelicula_to_library", url=item.url, thumbnail = item.thumbnail, - infoLabels={'title': item.fulltitle}, fulltitle=item.fulltitle, - extra="library")) + infoLabels={'title': item.fulltitle}, fulltitle=item.fulltitle + )) return itemlist From 5ba56221b0474331e84d49e92e39dff29a072ac4 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 09:05:30 -0500 Subject: [PATCH 07/14] Update okru.json --- plugin.video.alfa/servers/okru.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.video.alfa/servers/okru.json b/plugin.video.alfa/servers/okru.json index 8985c4ab..12e4973e 100755 --- a/plugin.video.alfa/servers/okru.json +++ b/plugin.video.alfa/servers/okru.json @@ -22,7 +22,7 @@ "ignore_urls": [], "patterns": [ { - "pattern": "//(?:www.)?ok.../(?:videoembed|video)/(\\d+)", + "pattern": "(?:www.)?ok.../(?:videoembed|video)/(\\d+)", "url": "http://ok.ru/videoembed/\\1" } ] @@ -63,4 +63,4 @@ ], "thumbnail": "server_okru.png", "version": 1 -} \ No newline at end of file +} From 410512fa8ff3187be3e170f70b20bf234731a0ee Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 09:37:00 -0500 Subject: [PATCH 08/14] Update openload.json --- plugin.video.alfa/servers/openload.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.video.alfa/servers/openload.json b/plugin.video.alfa/servers/openload.json index 4097199e..0fb0d7ef 100755 --- a/plugin.video.alfa/servers/openload.json +++ b/plugin.video.alfa/servers/openload.json @@ -18,7 +18,7 @@ "ignore_urls": [], "patterns": [ { - "pattern": "(?:openload|oload).../(?:embed|f)/([0-9a-zA-Z-_]+)", + "pattern": "(?:openload|oload).*?/(?:embed|f)/([0-9a-zA-Z-_]+)", "url": "https://openload.co/embed/\\1/" } ] @@ -57,4 +57,4 @@ ], "thumbnail": "server_openload.png", "version": 1 -} \ No newline at end of file +} From 427ae87549e6baa97eef48dff897d676c9dd82e5 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 09:38:49 -0500 Subject: [PATCH 09/14] Update vidz7.py --- plugin.video.alfa/channels/vidz7.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin.video.alfa/channels/vidz7.py b/plugin.video.alfa/channels/vidz7.py index adc38e80..410ac9f7 100755 --- a/plugin.video.alfa/channels/vidz7.py +++ b/plugin.video.alfa/channels/vidz7.py @@ -3,7 +3,9 @@ import re import urlparse +from core import httptools from core import scrapertools +from core import servertools from core.item import Item from platformcode import logger @@ -38,7 +40,7 @@ def search(item, texto): def categorias(item): logger.info() itemlist = [] - data = scrapertools.cache_page(item.url) + data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}", "", data) patron = '<li><a href="([^"]+)">(.*?)</a>' matches = re.compile(patron, re.DOTALL).findall(data) @@ -52,7 +54,7 @@ def lista(item): logger.info() # Descarga la página - data = scrapertools.cache_page(item.url) + data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}", "", data) # Extrae las entradas de la pagina seleccionada @@ -83,10 +85,8 @@ def play(item): logger.info() itemlist = [] # Descarga la página - data = scrapertools.cachePage(item.url) + data = httptools.downloadpage(item.url).data data = scrapertools.unescape(data) - logger.info(data) - from core import servertools itemlist.extend(servertools.find_video_items(data=data)) for videoitem in itemlist: videoitem.thumbnail = item.thumbnail From 8b96d4d9623fa2e412b839e89d411660b368d2b7 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 10:16:12 -0500 Subject: [PATCH 10/14] Update gvideo.json --- plugin.video.alfa/servers/gvideo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.video.alfa/servers/gvideo.json b/plugin.video.alfa/servers/gvideo.json index c185fcf8..a5d78fe4 100644 --- a/plugin.video.alfa/servers/gvideo.json +++ b/plugin.video.alfa/servers/gvideo.json @@ -14,7 +14,7 @@ "url": "http://docs.google.com/get_video_info?docid=\\1" }, { - "pattern": "(?s)https://drive.google.com/file/d/([^/]+)/preview", + "pattern": "(?s)https://(?:docs|drive).google.com/file/d/([^/]+)/preview", "url": "http://docs.google.com/get_video_info?docid=\\1" }, { From 70d1f45117192287f8cb7d5bf0ad29d0eddd0e6f Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 10:20:21 -0500 Subject: [PATCH 11/14] Update cartoonlatino.py --- plugin.video.alfa/channels/cartoonlatino.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin.video.alfa/channels/cartoonlatino.py b/plugin.video.alfa/channels/cartoonlatino.py index 1cc9d289..4ed18ee4 100644 --- a/plugin.video.alfa/channels/cartoonlatino.py +++ b/plugin.video.alfa/channels/cartoonlatino.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- import re @@ -174,10 +174,11 @@ def findvideos(item): data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) data_function = scrapertools.find_single_match(data, '<!\[CDATA\[function (.+?)\]\]') - data_id = scrapertools.find_single_match(data, - "<script>\(adsbygoogle = window\.adsbygoogle \|\| \[\]\)\.push\({}\);<\/script><\/div><br \/>(.+?)<\/ins>") + data_id = scrapertools.find_single_match(data, "<p><center><br />.*?</center>") itemla = scrapertools.find_multiple_matches(data_function, "src='(.+?)'") serverid = scrapertools.find_multiple_matches(data_id, '<script>([^"]+)\("([^"]+)"\)') + #logger.info("Intel33 %s" %data_function) + #logger.info("Intel44 %s" %data_id) for server, id in serverid: for link in itemla: if server in link: From b8836b3e0b6116f47ccec0caf364eeff7b7c7427 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 16:38:31 -0500 Subject: [PATCH 12/14] Update zonatorrent.json --- plugin.video.alfa/channels/zonatorrent.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugin.video.alfa/channels/zonatorrent.json b/plugin.video.alfa/channels/zonatorrent.json index f752dadf..c12b81c3 100644 --- a/plugin.video.alfa/channels/zonatorrent.json +++ b/plugin.video.alfa/channels/zonatorrent.json @@ -19,6 +19,14 @@ "default": true, "enabled": true, "visible": true - } + }, + { + "id": "modo_grafico", + "type": "bool", + "label": "Buscar información extra", + "default": true, + "enabled": true, + "visible": true + } ] -} \ No newline at end of file +} From ee90ca33908f4e97a5403aa3f13716552285a18e Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 16:39:03 -0500 Subject: [PATCH 13/14] Update zonatorrent.py --- plugin.video.alfa/channels/zonatorrent.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugin.video.alfa/channels/zonatorrent.py b/plugin.video.alfa/channels/zonatorrent.py index 2f410e90..8c637e7c 100644 --- a/plugin.video.alfa/channels/zonatorrent.py +++ b/plugin.video.alfa/channels/zonatorrent.py @@ -6,11 +6,19 @@ from channelselector import get_thumb from core import httptools from core import scrapertools from core import servertools +from core import tmdb from core.item import Item from platformcode import logger +__channel__ = "zonatorrent" + HOST = 'https://zonatorrent.org' +try: + __modo_grafico__ = config.get_setting('modo_grafico', __channel__) +except: + __modo_grafico__ = True + def mainlist(item): logger.info() @@ -90,7 +98,8 @@ def listado(item): matches = re.compile(pattern, re.DOTALL).findall(data) for url, thumb, title, duration, year, quality, plot in matches: - title = title.strip().replace("Spanish Online Torrent", "").replace("Latino Online Torrent", "") + #title = title.strip().replace("Spanish Online Torrent", "").replace("Latino Online Torrent", "").replace(r'\d{4}','') + title = re.sub('Online|Spanish|Latino|Torrent|\d{4}','',title) infoLabels = {"year": year} aux = scrapertools.find_single_match(duration, "(\d+)h\s*(\d+)m") @@ -98,8 +107,8 @@ def listado(item): infoLabels["duration"] = duration itemlist.append(Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=thumb, - plot=plot, infoLabels=infoLabels)) - + contentTitle=title, plot=plot, infoLabels=infoLabels)) + tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__) if item.page: pattern = "<span class='page-numbers current'>[^<]+</span><a class='page-numbers' href='([^']+)'" url = scrapertools.find_single_match(data, pattern) From c2c75b2fc4de1ae6b8eba64a42643992397c68f6 Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Sun, 1 Oct 2017 17:03:16 -0500 Subject: [PATCH 14/14] Update cartoonlatino.py --- plugin.video.alfa/channels/cartoonlatino.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin.video.alfa/channels/cartoonlatino.py b/plugin.video.alfa/channels/cartoonlatino.py index 4ed18ee4..98e1676d 100644 --- a/plugin.video.alfa/channels/cartoonlatino.py +++ b/plugin.video.alfa/channels/cartoonlatino.py @@ -174,11 +174,12 @@ def findvideos(item): data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) data_function = scrapertools.find_single_match(data, '<!\[CDATA\[function (.+?)\]\]') - data_id = scrapertools.find_single_match(data, "<p><center><br />.*?</center>") + data_id = scrapertools.find_single_match(data, + "<script>\(adsbygoogle = window\.adsbygoogle \|\| \[\]\)\.push\({}\);<\/script><\/div><br \/>(.+?)<\/ins>") + if data_id == "": + data_id = scrapertools.find_single_match(data, "<p><center><br />.*?</center>") itemla = scrapertools.find_multiple_matches(data_function, "src='(.+?)'") serverid = scrapertools.find_multiple_matches(data_id, '<script>([^"]+)\("([^"]+)"\)') - #logger.info("Intel33 %s" %data_function) - #logger.info("Intel44 %s" %data_id) for server, id in serverid: for link in itemla: if server in link: