From 8a5550cfc6cd7099cd0154572954b0b305c5a9a3 Mon Sep 17 00:00:00 2001 From: Dexter Morgan <9434916+32Dexter@users.noreply.github.com> Date: Mon, 6 May 2019 15:20:40 +0200 Subject: [PATCH 1/5] Update ToonItalia Channel Risolto problema visualizzazione solo prima puntata in sezione Anime --- channels/toonitalia.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/channels/toonitalia.py b/channels/toonitalia.py index dd509fcc..7af084db 100644 --- a/channels/toonitalia.py +++ b/channels/toonitalia.py @@ -259,7 +259,8 @@ def episodios(item): scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle).replace("×", "x") scrapedtitle = scrapedtitle.replace("_", " ") scrapedtitle = scrapedtitle.replace(".mp4", "") - puntata = scrapertools.find_single_match(scrapedtitle, '[0-9]+x[0-9]+') + # puntata = scrapertools.find_single_match(scrapedtitle, '[0-9]+x[0-9]+') + puntata = scrapedtitle for i in itemlist: if i.args == puntata: #è già stata aggiunta i.url += " " + scrapedurl From 64d8822e4d7da8a60628f864f27c77269dc942d3 Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Mon, 6 May 2019 16:15:49 +0200 Subject: [PATCH 2/5] Bullet Point for check video link --- core/servertools.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/servertools.py b/core/servertools.py index 956e1721..089d2fc1 100644 --- a/core/servertools.py +++ b/core/servertools.py @@ -714,7 +714,7 @@ def check_list_links(itemlist, numero='', timeout=3): for it in itemlist: if numero > 0 and it.server != '' and it.url != '': verificacion = check_video_link(it.url, it.server, timeout) - it.title = verificacion + ', ' + it.title.strip() + it.title = verificacion + ' ' + it.title.strip() it.alive = verificacion numero -= 1 return itemlist @@ -735,14 +735,15 @@ def check_video_link(url, server, timeout=3): if hasattr(server_module, 'test_video_exists'): ant_timeout = httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = timeout # Limitar tiempo de descarga + try: video_exists, message = server_module.test_video_exists(page_url=url) if not video_exists: logger.info("[check_video_link] No existe! %s %s %s" % (message, server, url)) - resultado = "[COLOR red][B]NO[/B][/COLOR]" + resultado = "[COLOR 0xffc20000][B]" + u'\u25cf' + "[/B][/COLOR]" else: logger.info("[check_video_link] comprobacion OK %s %s" % (server, url)) - resultado = "[COLOR green][B]OK[/B][/COLOR]" + resultado = "[COLOR 0xff00c289][B]" + u'\u25cf' + "[/B][/COLOR]" except: logger.info("[check_video_link] No se puede comprobar ahora! %s %s" % (server, url)) resultado = "??" From 3ed2c59b082ac5b1ce472bfc619e63de6502df28 Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Mon, 6 May 2019 17:37:26 +0200 Subject: [PATCH 3/5] Added Yellow bullet point fon not cheked links --- core/servertools.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/servertools.py b/core/servertools.py index 089d2fc1..4fd2822a 100644 --- a/core/servertools.py +++ b/core/servertools.py @@ -725,12 +725,17 @@ def check_video_link(url, server, timeout=3): :param url, server: Link y servidor :return: str(2) '??':No se ha podido comprobar. 'Ok':Parece que el link funciona. 'NO':Parece que no funciona. """ + + NK = "[COLOR 0xFFF9B613][B]" + u'\u25cf' + "[/B][/COLOR]" + OK = "[COLOR 0xFF00C289][B]" + u'\u25cf' + "[/B][/COLOR]" + KO = "[COLOR 0xFFC20000][B]" + u'\u25cf' + "[/B][/COLOR]" + try: server_module = __import__('servers.%s' % server, None, None, ["servers.%s" % server]) except: server_module = None logger.info("[check_video_link] No se puede importar el servidor! %s" % server) - return "??" + return NK if hasattr(server_module, 'test_video_exists'): ant_timeout = httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT @@ -740,17 +745,17 @@ def check_video_link(url, server, timeout=3): video_exists, message = server_module.test_video_exists(page_url=url) if not video_exists: logger.info("[check_video_link] No existe! %s %s %s" % (message, server, url)) - resultado = "[COLOR 0xffc20000][B]" + u'\u25cf' + "[/B][/COLOR]" + resultado = KO else: logger.info("[check_video_link] comprobacion OK %s %s" % (server, url)) - resultado = "[COLOR 0xff00c289][B]" + u'\u25cf' + "[/B][/COLOR]" + resultado = OK except: logger.info("[check_video_link] No se puede comprobar ahora! %s %s" % (server, url)) - resultado = "??" + resultado = NK finally: httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = ant_timeout # Restaurar tiempo de descarga return resultado logger.info("[check_video_link] No hay test_video_exists para servidor: %s" % server) - return "??" + return NK From 404a2e140a576687700473dc62fedf1e3063a96f Mon Sep 17 00:00:00 2001 From: mac12m99 Date: Mon, 6 May 2019 19:55:45 +0200 Subject: [PATCH 4/5] support:autocomplete host if not present in scrapedurl-thumb or nextpage --- channels/altadefinizione01.py | 4 ++-- channels/support.py | 10 ++++++---- channels/vedohd.py | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/channels/altadefinizione01.py b/channels/altadefinizione01.py index 9f92b624..f117eae5 100644 --- a/channels/altadefinizione01.py +++ b/channels/altadefinizione01.py @@ -45,12 +45,12 @@ def mainlist(item): def categories(item): support.log(item) - itemlist = support.scrape(item,'
  • (.*?)
  • ',['url','title'],headers,'Altadefinizione01',patron_block='
      (.*?)
    ',action='peliculas',url_host=host) + itemlist = support.scrape(item,'
  • (.*?)
  • ',['url','title'],headers,'Altadefinizione01',patron_block='
      (.*?)
    ',action='peliculas') return support.thumb(itemlist) def AZlist(item): support.log() - return support.scrape(item,r'(.*?)<\/div>',action='peliculas_list',url_host=host) + return support.scrape(item,r'(.*?)<\/div>',action='peliculas_list') def newest(categoria): diff --git a/channels/support.py b/channels/support.py index cbbbdf30..0e5ef638 100644 --- a/channels/support.py +++ b/channels/support.py @@ -86,7 +86,7 @@ def color(text, color): def scrape(item, patron = '', listGroups = [], headers="", blacklist="", data="", patron_block="", - patronNext="", action="findvideos", url_host="", addVideolibrary = True): + patronNext="", action="findvideos", addVideolibrary = True): # patron: the patron to use for scraping page, all capturing group must match with listGroups # listGroups: a list containing the scraping info obtained by your patron, in order # accepted values are: url, title, thumb, quality, year, plot, duration, genre, rating @@ -144,8 +144,8 @@ def scrape(item, patron = '', listGroups = [], headers="", blacklist="", data="" scraped = {} for kk in known_keys: val = match[listGroups.index(kk)] if kk in listGroups else '' - if kk == "url": - val = url_host + val + if val and (kk == "url" or kk == 'thumb') and 'http' not in val: + val = scrapertoolsV2.find_single_match(item.url, 'https?://[a-z0-9.-]+') + val scraped[kk] = val title = scrapertoolsV2.decodeHtmlentities(scraped["title"]).strip() @@ -462,7 +462,9 @@ def nextPage(itemlist, item, data, patron, function_level=1): # If the call is direct, leave it blank next_page = scrapertoolsV2.find_single_match(data, patron) - log('NEXT= ',next_page) + if 'http' not in next_page: + next_page = scrapertoolsV2.find_single_match(item.url, 'https?://[a-z0-9.-]+') + next_page + log('NEXT= ', next_page) if next_page != "": itemlist.append( diff --git a/channels/vedohd.py b/channels/vedohd.py index a0fc6439..c42dd0db 100644 --- a/channels/vedohd.py +++ b/channels/vedohd.py @@ -103,13 +103,13 @@ def findvideos(item): def generos(item): findhost() patron = '([a-zA-Z]+)' - return support.scrape(item, patron, ['url', 'title'], patron_block='Genere', action='peliculas', url_host=host) + return support.scrape(item, patron, ['url', 'title'], patron_block='Genere', action='peliculas') def year(item): findhost() patron = r'(\d+)' - return support.scrape(item, patron, ['url', 'title'], patron_block='Anno', action='peliculas', url_host=host) + return support.scrape(item, patron, ['url', 'title'], patron_block='Anno', action='peliculas') def play(item): From 0a124e05c7f96f0d410f85874ca5dab5047a9303 Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Mon, 6 May 2019 20:26:47 +0200 Subject: [PATCH 5/5] Added Aplay(autoplay) and link check in server def --- channels/support.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/channels/support.py b/channels/support.py index 0e5ef638..1f77809c 100644 --- a/channels/support.py +++ b/channels/support.py @@ -7,6 +7,7 @@ import urllib from lib import unshortenit from platformcode import logger, config from channelselector import thumb +from channels import autoplay def hdpass_get_servers(item): @@ -479,7 +480,10 @@ def nextPage(itemlist, item, data, patron, function_level=1): return itemlist -def server(item, data='', headers=''): +def server(item, data='', headers='', AutoPlay=True): + + __comprueba_enlaces__ = config.get_setting('comprueba_enlaces', item.channel) + __comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', item.channel) if not data: data = httptools.downloadpage(item.url, headers=headers).data @@ -494,9 +498,23 @@ def server(item, data='', headers=''): videoitem.channel = item.channel videoitem.contentType = item.contentType + if __comprueba_enlaces__: + itemlist = servertools.check_list_links(itemlist, __comprueba_enlaces_num__) + + if AutoPlay == True: + autoplay.start(itemlist, item) + return itemlist +def aplay(item, itemlist, list_servers='', list_quality=''): + if inspect.stack()[1][3] == 'mainlist': + autoplay.init(item.channel, list_servers, list_quality) + autoplay.show_option(item.channel, itemlist) + else: + autoplay.start(itemlist, item) + + def log(stringa1="", stringa2="", stringa3="", stringa4="", stringa5=""): # Function to simplify the log # Automatically returns File Name and Function Name