From 2ef4234a42e1187c072787d38acfaa4cc68b4197 Mon Sep 17 00:00:00 2001 From: pipcat Date: Fri, 13 Apr 2018 09:40:54 +0200 Subject: [PATCH 1/6] Cambios para capturar la url Mantengo rutina anterior, ya que ha servido de base para hacer la nueva, que es parecida. --- plugin.video.alfa/servers/flashx.py | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/plugin.video.alfa/servers/flashx.py b/plugin.video.alfa/servers/flashx.py index 33d9a8d3..7ad3a1a7 100644 --- a/plugin.video.alfa/servers/flashx.py +++ b/plugin.video.alfa/servers/flashx.py @@ -18,6 +18,58 @@ def test_video_exists(page_url): def get_video_url(page_url, premium=False, user="", password="", video_password=""): logger.info("url=" + page_url) + + data = httptools.downloadpage(page_url).data + + cgi_counter = scrapertools.find_single_match(data, """(?is)src=.(https://www.flashx.bz/counter.cgi.*?[^(?:'|")]+)""") + cgi_counter = cgi_counter.replace("%0A","").replace("%22","") + httptools.downloadpage(cgi_counter, cookies=False) + + time.sleep(6) + + url_playitnow = "https://www.flashx.bz/dl?playitnow" + fid = scrapertools.find_single_match(data, 'input type="hidden" name="id" value="([^"]*)"') + fname = scrapertools.find_single_match(data, 'input type="hidden" name="fname" value="([^"]*)"') + fhash = scrapertools.find_single_match(data, 'input type="hidden" name="hash" value="([^"]*)"') + + headers = {'Content': 'application/x-www-form-urlencoded'} + post_parameters = { + "op": "download1", + "usr_login": "", + "id": fid, + "fname": fname, + "referer": "https://www.flashx.bz/", + "hash": fhash, + "imhuman": "Continue To Video" + } + data = httptools.downloadpage(url_playitnow, urllib.urlencode(post_parameters), headers=headers).data + + video_urls = [] + media_urls = scrapertools.find_multiple_matches(data, "{src: '([^']+)'.*?,label: '([^']+)'") + subtitle = "" + for media_url, label in media_urls: + if media_url.endswith(".srt") and label == "Spanish": + try: + from core import filetools + data = httptools.downloadpage(media_url) + subtitle = os.path.join(config.get_data_path(), 'sub_flashx.srt') + filetools.write(subtitle, data) + except: + import traceback + logger.info("Error al descargar el subtítulo: " + traceback.format_exc()) + + for media_url, label in media_urls: + if not media_url.endswith("png") and not media_url.endswith(".srt"): + video_urls.append(["." + media_url.rsplit('.', 1)[1] + " [flashx]", media_url, 0, subtitle]) + + for video_url in video_urls: + logger.info("%s - %s" % (video_url[0], video_url[1])) + + return video_urls + + +def get_video_url_anterior(page_url, premium=False, user="", password="", video_password=""): + logger.info("url=" + page_url) pfxfx = "" data = httptools.downloadpage(page_url, cookies=False).data data = data.replace("\n","") From 4fcbc82af978d7ae96d34b52932368827b83be4b Mon Sep 17 00:00:00 2001 From: pipcat Date: Thu, 26 Apr 2018 11:06:40 +0200 Subject: [PATCH 2/6] igualar con repo alfa --- plugin.video.alfa/servers/flashx.py | 52 ----------------------------- 1 file changed, 52 deletions(-) diff --git a/plugin.video.alfa/servers/flashx.py b/plugin.video.alfa/servers/flashx.py index ce543c25..e657ab05 100644 --- a/plugin.video.alfa/servers/flashx.py +++ b/plugin.video.alfa/servers/flashx.py @@ -18,58 +18,6 @@ def test_video_exists(page_url): def get_video_url(page_url, premium=False, user="", password="", video_password=""): logger.info("url=" + page_url) - - data = httptools.downloadpage(page_url).data - - cgi_counter = scrapertools.find_single_match(data, """(?is)src=.(https://www.flashx.bz/counter.cgi.*?[^(?:'|")]+)""") - cgi_counter = cgi_counter.replace("%0A","").replace("%22","") - httptools.downloadpage(cgi_counter, cookies=False) - - time.sleep(6) - - url_playitnow = "https://www.flashx.bz/dl?playitnow" - fid = scrapertools.find_single_match(data, 'input type="hidden" name="id" value="([^"]*)"') - fname = scrapertools.find_single_match(data, 'input type="hidden" name="fname" value="([^"]*)"') - fhash = scrapertools.find_single_match(data, 'input type="hidden" name="hash" value="([^"]*)"') - - headers = {'Content': 'application/x-www-form-urlencoded'} - post_parameters = { - "op": "download1", - "usr_login": "", - "id": fid, - "fname": fname, - "referer": "https://www.flashx.bz/", - "hash": fhash, - "imhuman": "Continue To Video" - } - data = httptools.downloadpage(url_playitnow, urllib.urlencode(post_parameters), headers=headers).data - - video_urls = [] - media_urls = scrapertools.find_multiple_matches(data, "{src: '([^']+)'.*?,label: '([^']+)'") - subtitle = "" - for media_url, label in media_urls: - if media_url.endswith(".srt") and label == "Spanish": - try: - from core import filetools - data = httptools.downloadpage(media_url) - subtitle = os.path.join(config.get_data_path(), 'sub_flashx.srt') - filetools.write(subtitle, data) - except: - import traceback - logger.info("Error al descargar el subtítulo: " + traceback.format_exc()) - - for media_url, label in media_urls: - if not media_url.endswith("png") and not media_url.endswith(".srt"): - video_urls.append(["." + media_url.rsplit('.', 1)[1] + " [flashx]", media_url, 0, subtitle]) - - for video_url in video_urls: - logger.info("%s - %s" % (video_url[0], video_url[1])) - - return video_urls - - -def get_video_url_anterior(page_url, premium=False, user="", password="", video_password=""): - logger.info("url=" + page_url) pfxfx = "" data = httptools.downloadpage(page_url, cookies=False).data data = data.replace("\n","") From b57dd2989a16c7c261824b5445107ec20b8f3ab1 Mon Sep 17 00:00:00 2001 From: pipcat Date: Thu, 26 Apr 2018 18:04:38 +0200 Subject: [PATCH 3/6] Bug interno en episodios --- plugin.video.alfa/channels/cinefox.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/plugin.video.alfa/channels/cinefox.py b/plugin.video.alfa/channels/cinefox.py index 264afbd2..a1f355be 100644 --- a/plugin.video.alfa/channels/cinefox.py +++ b/plugin.video.alfa/channels/cinefox.py @@ -535,29 +535,24 @@ def episodios(item): item.url += "/episodios" data = httptools.downloadpage(item.url).data - data_season = data[:] #if "episodios" in item.extra or not __menu_info__ or item.path: action = "findvideos" # else: # action = "menu_info_episode" - seasons = scrapertools.find_single_match(data, ']+>.*?href="([^"]+)">([^<]+).*?([^<]+)' - matches = scrapertools.find_multiple_matches(data_season, patron) - for scrapedurl, episode, scrapedtitle in matches: - new_item = item.clone(action=action, url=scrapedurl, text_color=color2, contentType="episode") - new_item.contentSeason = episode.split("x")[0] - new_item.contentEpisodeNumber = episode.split("x")[1] + patron = '
.*?href="([^"]+)">([^<]+).*?([^<]+)' + matches = scrapertools.find_multiple_matches(data, patron) + for scrapedurl, episode, scrapedtitle in matches: + new_item = item.clone(action=action, url=scrapedurl, text_color=color2, contentType="episode") + new_item.contentSeason = episode.split("x")[0] + new_item.contentEpisodeNumber = episode.split("x")[1] - new_item.title = episode + " - " + scrapedtitle - new_item.extra = "episode" - if "episodios" in item.extra or item.path: - new_item.extra = "episode|" - itemlist.append(new_item) + new_item.title = episode + " - " + scrapedtitle + new_item.extra = "episode" + if "episodios" in item.extra or item.path: + new_item.extra = "episode|" + itemlist.append(new_item) tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) From 7de371161403da2e9056fa6c92bb8a9c1e957b7e Mon Sep 17 00:00:00 2001 From: t1254362 Date: Fri, 27 Apr 2018 21:45:38 +0200 Subject: [PATCH 4/6] Fix regex --- plugin.video.alfa/channels/yespornplease.py | 200 ++++++++++---------- 1 file changed, 100 insertions(+), 100 deletions(-) diff --git a/plugin.video.alfa/channels/yespornplease.py b/plugin.video.alfa/channels/yespornplease.py index 015bf1d1..c2aa1841 100644 --- a/plugin.video.alfa/channels/yespornplease.py +++ b/plugin.video.alfa/channels/yespornplease.py @@ -1,100 +1,100 @@ -# -*- coding: utf-8 -*- - -import re - -from core import httptools -from core.item import Item -from platformcode import logger -from urlparse import urljoin -from core import servertools - - -HOST="http://yespornplease.com" - -def mainlist(item): - logger.info() - itemlist = [] - itemlist.append(item.clone(action="links", title="Novedades", url=HOST)) - itemlist.append(item.clone(action="categories", title="Categorías", url=urljoin(HOST, "categories"))) - itemlist.append(item.clone(action="search", title="Buscar", url=urljoin(HOST, "search"))) - return itemlist - - -def search(item, texto): - logger.info("texto = %s" %(texto)) - - item.url = urljoin(HOST, "search&q=" + texto) - try: - return links(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) - return [] - -def categories(item): - logger.info() - data = httptools.downloadpage(item.url).data - - result = [] - - categories = re.findall("href=[\"'](?P/search[^\"']+).*?>(?P[^<>]+)
.*?badge[^>]+>(?P\d+)", data, re.DOTALL | re.MULTILINE) - for url, name, counter in categories: - result.append(item.clone(action = "links", title = "%s (%s videos)" % (name, counter), url = urljoin(item.url, url))) - - return result - -def get_page(url): - page = re.search("p=(\d+)", url) - if page: - return int(page.group(1)) - return 1 - -def get_page_url(url, page): - logger.debug("URL: %s to page %d" % (url, page)) - resultURL = re.sub("([&\?]p=)(?:\d+)", "\g<1>%d" % page, url) - if resultURL == url: - resultURL += ("&" if "?" in url else "?") + "p=%d" % (page) - - logger.debug("Result: %s" % (resultURL)) - return resultURL - - -def links(item): - logger.info() - data = httptools.downloadpage(item.url).data - - reExpr = "[^'\"]+)[^>]+title[^'\"]*['\"](?P[^\"]+)[^>]+id[^'\"]*['\"](?P<id>[^'\"]+)[^>]*>(?:[^<]*<[^>]+>(?P<quality>[^<]+)<)?[^<]*<[^>]*duration[^>]*>(?P<duration>[^<]+)" - reResults = re.findall(reExpr, data, re.MULTILINE | re.DOTALL) - result = [] - - for img, title, vID, quality, duration in reResults: - logger.info("[link] %(title)s [%(quality)s] [%(duration)s]: %(vid)s (%(img)s" % ({"title": title, "duration": duration, "vid": vID, "img": img, "quality": quality if quality else "--"})) - - formattedQuality = "" - if quality: - formattedQuality += " [%s]" % (quality) - - titleFormatted = "%(title)s%(quality)s [%(duration)s]" % ({"title": title, "quality": formattedQuality, "duration": duration}) - result.append(item.clone(action = "play", title = titleFormatted, url = urljoin(item.url, "/view/%s" % (vID)), thumbnail = urljoin(item.url, img), vID = vID)) - - # Has pagination - paginationOccurences = data.count('class="prevnext"') - if paginationOccurences: - page = get_page(item.url) - logger.info("Page " + str(page) + " Ocurrences: " + str(paginationOccurences)) - if page > 1: - result.append(item.clone(action = "links", title = "<< Anterior", url = get_page_url(item.url, page - 1))) - - if paginationOccurences > 1 or page == 1: - result.append(item.clone(action = "links", title = "Siguiente >>", url = get_page_url(item.url, page + 1))) - - - return result - -def play(item): - logger.info(item) - embededURL = urljoin(item.url, "/e/%s/width-650/height-400/autoplay-0/" % (item.vID)) - itemlist = servertools.find_video_items(item.clone(url = embededURL)) - return itemlist +# -*- coding: utf-8 -*- + +import re + +from core import httptools +from core.item import Item +from platformcode import logger +from urlparse import urljoin +from core import servertools + + +HOST="http://yespornplease.com" + +def mainlist(item): + logger.info() + itemlist = [] + itemlist.append(item.clone(action="links", title="Novedades", url=HOST)) + itemlist.append(item.clone(action="categories", title="Categorías", url=urljoin(HOST, "categories"))) + itemlist.append(item.clone(action="search", title="Buscar", url=urljoin(HOST, "search"))) + return itemlist + + +def search(item, texto): + logger.info("texto = %s" %(texto)) + + item.url = urljoin(HOST, "search&q=" + texto) + try: + return links(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) + return [] + +def categories(item): + logger.info() + data = httptools.downloadpage(item.url).data + + result = [] + + categories = re.findall("href=[\"'](?P<url>/search[^\"']+).*?>(?P<name>[^<>]+)</div>.*?badge[^>]+>(?P<counter>\d+)", data, re.DOTALL | re.MULTILINE) + for url, name, counter in categories: + result.append(item.clone(action = "links", title = "%s (%s videos)" % (name, counter), url = urljoin(item.url, url))) + + return result + +def get_page(url): + page = re.search("p=(\d+)", url) + if page: + return int(page.group(1)) + return 1 + +def get_page_url(url, page): + logger.debug("URL: %s to page %d" % (url, page)) + resultURL = re.sub("([&\?]p=)(?:\d+)", "\g<1>%d" % page, url) + if resultURL == url: + resultURL += ("&" if "?" in url else "?") + "p=%d" % (page) + + logger.debug("Result: %s" % (resultURL)) + return resultURL + + +def links(item): + logger.info() + data = httptools.downloadpage(item.url).data + + reExpr = "<img\s+src=['\"](?P<img>[^'\"]+)[^>]+(?:title|alt)[^'\"]*['\"](?P<title>[^\"]+)[^>]+id[^'\"]*['\"](?P<id>[^'\"]+)[^>]*>(?:[^<]*<[^>]+>(?P<quality>[^<]+)<)?[^<]*<[^>]*duration[^>]*>(?P<duration>[^<]+)" + reResults = re.findall(reExpr, data, re.MULTILINE | re.DOTALL) + result = [] + + for img, title, vID, quality, duration in reResults: + logger.info("[link] %(title)s [%(quality)s] [%(duration)s]: %(vid)s (%(img)s" % ({"title": title, "duration": duration, "vid": vID, "img": img, "quality": quality if quality else "--"})) + + formattedQuality = "" + if quality: + formattedQuality += " [%s]" % (quality) + + titleFormatted = "%(title)s%(quality)s [%(duration)s]" % ({"title": title, "quality": formattedQuality, "duration": duration}) + result.append(item.clone(action = "play", title = titleFormatted, url = urljoin(item.url, "/view/%s" % (vID)), thumbnail = urljoin(item.url, img), vID = vID)) + + # Has pagination + paginationOccurences = data.count('class="prevnext"') + if paginationOccurences: + page = get_page(item.url) + logger.info("Page " + str(page) + " Ocurrences: " + str(paginationOccurences)) + if page > 1: + result.append(item.clone(action = "links", title = "<< Anterior", url = get_page_url(item.url, page - 1))) + + if paginationOccurences > 1 or page == 1: + result.append(item.clone(action = "links", title = "Siguiente >>", url = get_page_url(item.url, page + 1))) + + + return result + +def play(item): + logger.info(item) + embededURL = urljoin(item.url, "/view/%s" % (item.vID)) + itemlist = servertools.find_video_items(item.clone(url = embededURL)) + return itemlist From da684f98dd1a93ab8f4948019878bbbe43563f2e Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Wed, 2 May 2018 14:43:30 -0500 Subject: [PATCH 5/6] plusdede: fix --- plugin.video.alfa/channels/plusdede.py | 54 +++++++++++++++++++------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/plugin.video.alfa/channels/plusdede.py b/plugin.video.alfa/channels/plusdede.py index bfccb74d..729b16a3 100644 --- a/plugin.video.alfa/channels/plusdede.py +++ b/plugin.video.alfa/channels/plusdede.py @@ -4,6 +4,7 @@ import os import re import sys import urlparse +from time import sleep from core import channeltools from core import httptools @@ -14,7 +15,7 @@ from core.item import Item from platformcode import config, logger from platformcode import platformtools -HOST = 'http://www.plusdede.com' +HOST = 'https://www.plusdede.com' __channel__ = 'plusdede' parameters = channeltools.get_channel_parameters(__channel__) fanart_host = parameters['fanart'] @@ -23,20 +24,48 @@ color1, color2, color3 = ['0xFFB10021', '0xFFB10021', '0xFFB10004'] def login(): - url_origen = "https://www.plusdede.com/login?popup=1" - data = httptools.downloadpage(url_origen, follow_redirects=True).data + url_origen = HOST+"/login?popup=1" + try: + data = httptools.downloadpage(url_origen).data + except: + data = httptools.downloadpage(url_origen, follow_redirects=False).data + if re.search(r'(?i)%s' % config.get_setting("plusdedeuser", "plusdede"), data): - return True - + return True token = scrapertools.find_single_match(data, '<input name="_token" type="hidden" value="([^"]+)"') + if re.search('Escribe los números de la imagen', data): + captcha_url = scrapertools.find_single_match(data, '<img src="([^"]+)" alt="captcha">') + imagen_data = httptools.downloadpage(captcha_url).data + ficheropng = os.path.join(config.get_data_path(), "captcha_plusdede.png") + outfile=open(ficheropng,'wb') + outfile.write(imagen_data) + outfile.close() + img = xbmcgui.ControlImage(450,15,400,130,ficheropng) + wdlg = xbmcgui.WindowDialog() + wdlg.addControl(img) + wdlg.show() + sleep(1) + kb = platformtools.dialog_numeric(0, "Escribe los números de la imagen") - post = "_token=" + str(token) + "&email=" + str( - config.get_setting("plusdedeuser", "plusdede")) + "&password=" + str( - config.get_setting("plusdedepassword", "plusdede")) + "&app=2131296469" - url = "https://www.plusdede.com/" - headers = {"User-Agent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) " - "Chrome/61.0.3163.100 Safari/537.36","Referer": url, "X-Requested-With": "XMLHttpRequest", "X-CSRF-TOKEN": token} - data = httptools.downloadpage("https://www.plusdede.com/login", post=post, headers=headers, + postcaptcha = "" + if kb !='': + solution = kb + postcaptcha = "&captcha=" + str(solution) + else: + return False + wdlg.close() + else: + postcaptcha="" + + post = "_token=" + str(token) + "&email=" + str(config.get_setting("plusdedeuser", "plusdede")) + \ + "&password=" + str(config.get_setting("plusdedepassword", "plusdede")) + postcaptcha\ + #+ "&app=2131296469" + + url = HOST + headers = {"User-Agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/66.0.3163.100 Safari/537.36", "Referer": url, "X-Requested-With": "XMLHttpRequest","X-CSRF-TOKEN": + token} + data = httptools.downloadpage(HOST+"/login", post=post, headers=headers, replace_headers=False).data if "redirect" in data: return True @@ -785,7 +814,6 @@ def checkseen(item): "Chrome/61.0.3163.100 Safari/537.36", "Referer": "https://www.plusdede.com/serie/", "X-Requested-With": "XMLHttpRequest", "X-CSRF-TOKEN": item.token} data = httptools.downloadpage(url_temp, post="id=" + item.idtemp, headers=headers, replace_headers=True).data - #logger.debug(data) return True From 12b54f1e1cdf580e9f33c984bfa38d678884b294 Mon Sep 17 00:00:00 2001 From: Alfa <30527549+alfa-addon@users.noreply.github.com> Date: Wed, 2 May 2018 15:09:28 -0500 Subject: [PATCH 6/6] v2.5.12 --- plugin.video.alfa/addon.xml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/plugin.video.alfa/addon.xml b/plugin.video.alfa/addon.xml index ab5bc485..65bac5cd 100755 --- a/plugin.video.alfa/addon.xml +++ b/plugin.video.alfa/addon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.alfa" name="Alfa" version="2.5.11" provider-name="Alfa Addon"> +<addon id="plugin.video.alfa" name="Alfa" version="2.5.12" provider-name="Alfa Addon"> <requires> <import addon="xbmc.python" version="2.1.0"/> <import addon="script.module.libtorrent" optional="true"/> @@ -19,16 +19,11 @@ </assets> <news>[B]Estos son los cambios para esta versión:[/B] [COLOR green][B]Canales agregados y arreglos[/B][/COLOR] - » vidlox » downace - » tvvip » clipwatching - » hdfull » peliculasaudiolatino - » descargas2020 » mispelisyseries - » torrentloculra » torrentrapid - » tumejortorrent » tvsinpagar - + » plusdede » yespornplease + » cinefox ¤ arreglos internos - ¤ Gracias al equipo SOD, @lopezvg, @f_y_m por colaborar en ésta versión + ¤ Gracias a @fcammed y @t1254362 por colaborar en ésta versión </news> <description lang="es">Navega con Kodi por páginas web para ver sus videos de manera fácil.</description> <summary lang="en">Browse web pages using Kodi</summary>