From 693e7babca657766f3ef4ffd5f0200d64077469c Mon Sep 17 00:00:00 2001 From: greko17 Date: Sat, 2 Nov 2019 00:50:30 +0100 Subject: [PATCH 01/10] fix: ilgeniodellostreaming.py canale finito, da testare --- channels/ilgeniodellostreaming.json | 11 +- channels/ilgeniodellostreaming.py | 242 ++++++++++++++-------------- 2 files changed, 123 insertions(+), 130 deletions(-) diff --git a/channels/ilgeniodellostreaming.json b/channels/ilgeniodellostreaming.json index ae0dca45..49426164 100644 --- a/channels/ilgeniodellostreaming.json +++ b/channels/ilgeniodellostreaming.json @@ -7,14 +7,5 @@ "thumbnail": "https://i.imgur.com/Nsa81r0.png", "banner": "https://i.imgur.com/Nsa81r0.png", "categories": ["movie", "tvshow", "anime", "vos"], - "settings": [ - { - "id": "include_in_newest_anime", - "type": "bool", - "label": "Includi in Novità - Anime", - "default": false, - "enabled": false, - "visible": false - } - ] + "settings": [] } diff --git a/channels/ilgeniodellostreaming.py b/channels/ilgeniodellostreaming.py index 820328e7..965ce7dc 100644 --- a/channels/ilgeniodellostreaming.py +++ b/channels/ilgeniodellostreaming.py @@ -6,8 +6,7 @@ """ - Problemi noti che non superano il test del canale: - NESSUNO (update 13-9-2019) + Alcuni video non si aprono sul sito... Avvisi per il test: i link per le categorie non sono TUTTI visibili nella pagina del sito: @@ -22,17 +21,20 @@ genere-> televisione film https://ilgeniodellostreaming.se/genere/televisione-film - Non va abilitato per: - Novità -> Anime - La pagina "Aggiornamenti Anime" del sito è vuota (update 13-9-2019) + Novità -> Serietv e Aggiornamenti nel canale: + - le pagine sono di 25 titoli + + + ##### note per i dev ######### + - La pagina "Aggiornamenti Anime" del sito è vuota (update 13-9-2019) + - in url: film o serietv """ import re -from platformcode import logger -from core import scrapertoolsV2, httptools, tmdb, support -from core.support import log, menu, aplay +from core import scrapertoolsV2, httptools, support +from core.support import log from core.item import Item from platformcode import config @@ -49,136 +51,87 @@ def mainlist(item): support.log(item) film = ['/film/', - ('Film Per Categoria',['', 'category', 'genres']), - ('Film Per Anno',['', 'category', 'year']), - ('Film Per Lettera',['/film-a-z/', 'category', 'letter']), + ('Film Per Categoria',['', 'genres', 'genres']), + ('Film Per Anno',['', 'genres', 'year']), + ('Film Per Lettera',['/film-a-z/', 'genres', 'letter']), ('Popolari',['/trending/?get=movies', 'peliculas', 'populared']), ('Più Votati', ['/ratings/?get=movies', 'peliculas', 'populared']) - ] - - tvshow = ['/serie/', - ('Nuovi Episodi', ['/aggiornamenti-serie/', 'newep', 'tvshow']), - ('TV Show', ['/tv-show/', 'peliculas', 'showtv', 'tvshow']) ] - anime = ['/anime/'] + tvshow = ['/serie/', + ('Nuovi Episodi', ['/aggiornamenti-serie/', 'peliculas', 'update']), + ('Popolari',['/trending/?get=tv', 'peliculas', 'populared']), + ('Più Votati', ['/ratings/?get=tv', 'peliculas', 'populared']) + + ] + + anime = ['/anime/' + ] + + Tvshow = [ + ('Show TV', ['/tv-show/', 'peliculas', '', 'tvshow']) + ] search = '' return locals() -@support.scrape -def category(item): - log(item) - - action='peliculas' - if item.args == 'genres': - patronBlock = r'

Genere

(?P.*?)/li>
' - elif item.args == 'year': - patronBlock = r'

Anno di uscita

(?P.*?)/li>
' - elif item.args == 'letter': - patronBlock = r'
(?P.*?)
' - patron = r'.*?)"[ ]?>(?P.*?)<\/a>' - -## debug = True - return locals() - -def search(item, texto): - log(texto) - item.url = host + "/?s=" + texto - try: - return peliculas(item) - except: - import sys - for line in sys.exc_info(): - logger.error("%s" % line) - - return [] - @support.scrape def peliculas(item): - log(item) -## import web_pdb; web_pdb.set_trace() + log() + + if item.args == 'search': - if item.action == 'search': patronBlock = r'<div class="search-page">(?P<block>.*?)<footer class="main">' patron = r'<div class="thumbnail animation-2"><a href="(?P<url>[^"]+)">'\ '<img src="(?P<thumb>[^"]+)" alt="[^"]+" \/>[^>]+>(?P<type>[^<]+)'\ '<\/span>.*?<a href.*?>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?'\ '<\/a>[^>]+>(?:<span class="rating">IMDb\s*(?P<rating>[0-9.]+)<\/span>)?'\ '.+?(?:<span class="year">(?P<year>[0-9]+)<\/span>)?[^>]+>[^>]+><p>(?P<plot>.*?)<\/p>' - type_content_dict={'movie': ['film'], 'tvshow': ['tv']} - type_action_dict={'findvideos': ['film'], 'episodios': ['tv']} -## elif item.args == 'newest': -## patronBlock = r'<div class="content"><header><h1>Aggiornamenti Serie</h1>'\ -## '</header>(?P<block>.*?)</li></ul></div></div></div>' -## patron = r'src="(?P<thumb>[^"]+)".*?href="(?P<url>[^"]+)">[^>]+>(?P<episode>[^<]+)'\ -## '<.*?"c">(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?<.+?<span class='\ -## '"quality">(\5SUB-ITA|.+?)</span>' +## type_content_dict={'movie': ['film'], 'tvshow': ['tv']} +## type_action_dict={'findvideos': ['film'], 'episodios': ['tv']} + def itemHook(item): + if 'film' not in item.url: + item.contentType = 'tvshow' + item.action = 'episodios' + return item + else: - elif item.args == 'letter': - patron = r'<td class="mlnh-2"><a href="(?P<url>[^"]+)">(?P<title>.+?)'\ - '[ ]?(?:\[(?P<lang>Sub-ITA)\])?<[^>]+>[^>]+>[^>]+>(?P<year>\d{4})\s+<' - elif item.args == 'populared': - patron = r'<div class="poster"><a href="(?P<url>[^"]+)"><img src='\ - '"(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+> '\ - '(?P<rating>[0-9.]+)<[^>]+>[^>]+>'\ - '(?P<quality>[3]?[D]?[H]?[V]?[D]?[/]?[R]?[I]?[P]?)(?:SUB-ITA)?<'\ - '[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)(?:[ ]\[(?P<lang>Sub-ITA)\])?<'\ - '[^>]+>[^>]+>[^>]+>(?P<year>\d{4})?<' + if item.contentType == 'movie': + endBlock = '</article></div>' + else: + endBlock = '<footer class="main">' - elif item.args == 'showtv': - action = 'episodios' - patron = r'<div class="poster"><a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" '\ - 'alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+> (?P<rating>[0-9.]+)<[^>]+>[^>]+>[^>]+>'\ - '[^>]+>[^>]+>(?P<title>.+?)<[^>]+>[^>]+>[^>]+>(?P<year>\d{4})?<[^>]+>[^>]+>'\ - '[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<plot>.+?)<' + patronBlock = r'<header><h1>.+?</h1>(?P<block>.*?)'+endBlock - elif item.contentType == 'movie' and item.args != 'genres': - patronBlock = r'<header><h1>Film</h1>(?P<block>.*?)<div class="pagination">' - patron = r'<div class="poster">\s*<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" '\ - 'alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+>\s*(?P<rating>[0-9.]+)<\/div>'\ - '<span class="quality">(?:SUB-ITA|)?(?P<quality>|[^<]+)?'\ - '<\/span>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?'\ - '<\/a>[^>]+>'\ - '[^>]+>(?P<year>[^<]+)<\/span>[^>]+>[^>]+>'\ - '[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<plot>[^<]+)<div' + if item.contentType == 'movie': + if item.args == 'letter': + patronBlock = r'<table class="table table-striped">(?P<block>.+?)</table>' + patron = r'<img src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+><td class="mlnh-2"><a href="(?P<url>[^"]+)">(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?<[^>]+>[^>]+>[^>]+>(?P<year>\d{4})\s+<' + elif item.args == 'populared': + patron = r'<img src="(?P<thumb>[^"]+)" alt="[^"]+">[^>]+>[^>]+>[^>]+>[^>]+>\s+?(?P<rating>\d+.?\d+|\d+)<[^>]+>[^>]+>(?P<quality>[a-zA-Z\-]+)[^>]+>[^>]+>[^>]+>[^>]+><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<[^>]+>[^>]+>[^>]+>(?P<year>\d+)<' + else: - elif item.contentType == 'tvshow' or item.args == 'genres': - action = 'episodios' - patron = r'<div class="poster">\s*<a href="(?P<url>[^"]+)"><img '\ - 'src="(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+> '\ - '(?P<rating>[0-9.]+)<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>'\ - '(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA|Sub-ita)\])?<[^>]+>[^>]+>'\ - '[^>]+>(?P<year>[^<]+)<.*?<div class="texto">(?P<plot>[^<]+)' - -## else: -## patron = r'<div class="thumbnail animation-2"><a href="(?P<url>[^"]+)">'\ -## '<img src="(?P<thumb>[^"]+)" alt="[^"]+" \/>'\ -## '[^>]+>(?P<type>[^<]+)<\/span>.*?<a href.*?>(?P<title>[^<]+)'\ -## '<\/a>(?P<lang>[^>])+>[^>]+>(?:<span class="rating">IMDb\s*'\ -## '(?P<rating>[0-9.]+)<\/span>)?.*?(?:<span class="year">(?P<year>[0-9]+)'\ -## '<\/span>)?[^>]+>[^>]+><p>(?P<plot>.*?)<\/p>' -#### type_content_dict={'movie': ['film'], 'tvshow': ['tv']} -#### type_action_dict={'findvideos': ['film'], 'episodios': ['tv']} + patron = r'<div class="poster">\s*<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+>\s*(?P<rating>[0-9.]+)<\/div><span class="quality">(?:SUB-ITA|)?(?P<quality>|[^<]+)?<\/span>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?<\/a>[^>]+>[^>]+>(?P<year>[^<]+)<\/span>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<plot>[^<]+)<div' + else: + # TVSHOW + action = 'episodios' + if item.args == 'update': + action = 'findvideos' + patron = r'<div class="poster"><img src="(?P<thumb>[^"]+)"[^>]+>[^>]+><a href="(?P<url>[^"]+)">[^>]+>(?P<episode>[\d\-x]+)[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)(?:\[(?P<lang>Sub-ITA|Sub-ita)\])?<[^>]+>[^>]+>[^>]+>[^>]+>(?P<quality>[HD]+)?(?:.+?)?/span><p class="serie"' + pagination = 25 + def itemHook(item): + item.contentType = 'episode' + return item + else: + patron = r'<div class="poster">\s?<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+> (?P<rating>[0-9.]+)<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA|Sub-ita)\])?<[^>]+>[^>]+>[^>]+>(?P<year>[^<]+)(?:<.*?<div class="texto">(?P<plot>[^<]+))?' patronNext = '<span class="current">[^<]+<[^>]+><a href="([^"]+)"' -## debug = True - return locals() - - -@support.scrape -def newep(item): - - patron = r'<div class="poster"><img src="(?P<thumb>[^"]+)" alt="(?:.+?)[ ]?'\ - '(?:\[(?P<lang>Sub-ITA|Sub-ita)\])?">[^>]+><a href="(?P<url>[^"]+)">'\ - '[^>]+>(?P<episode>[^<]+)<[^>]+>[^>]+>[^>]+><span class="c">'\ - '(?P<title>.+?)[ ]?(?:\[Sub-ITA\]|)<' - pagination = 10 -## debug = True + #support.regexDbg(item, patron, headers) + #debug = True return locals() @@ -195,35 +148,62 @@ def episodios(item): # debug = True return locals() +@support.scrape +def genres(item): + log(item) + + action='peliculas' + if item.args == 'genres': + patronBlock = r'<div class="sidemenu"><h2>Genere</h2>(?P<block>.*?)/li></ul></div>' + elif item.args == 'year': + item.args = 'genres' + patronBlock = r'<div class="sidemenu"><h2>Anno di uscita</h2>(?P<block>.*?)/li></ul></div>' + elif item.args == 'letter': + patronBlock = r'<div class="movies-letter">(?P<block>.*?)<div class="clearfix">' + + patron = r'<a(?:.+?)?href="(?P<url>.*?)"[ ]?>(?P<title>.*?)<\/a>' + +## debug = True + return locals() + +def search(item, text): + log(text) + itemlist = [] + text = text.replace(' ', '+') + item.url = host + "/?s=" + text + try: + item.args = 'search' + return peliculas(item) + except: + import sys + for line in sys.exc_info(): + log("%s" % line) + + return [] def newest(categoria): log(categoria) itemlist = [] item = Item() - action = peliculas - if categoria == 'peliculas': item.contentType = 'movie' item.url = host + '/film/' elif categoria == 'series': - action = newep - #item.args = 'newest' + item.args = 'update' item.contentType = 'tvshow' item.url = host + '/aggiornamenti-serie/' ## elif categoria == 'anime': ## item.contentType = 'tvshow' ## item.url = host + '/anime/' try: - item.action = action - itemlist = action(item) + item.action = 'peliculas' + itemlist = peliculas(item) - if itemlist[-1].action == action: - itemlist.pop() except: import sys for line in sys.exc_info(): - logger.error("{0}".format(line)) + log("{0}".format(line)) return [] return itemlist @@ -232,9 +212,31 @@ def newest(categoria): def findvideos(item): log() itemlist =[] + matches, data = support.match(item, '<iframe class="metaframe rptss" src="([^"]+)"[^>]+>',headers=headers) for url in matches: html = httptools.downloadpage(url, headers=headers).data data += str(scrapertoolsV2.find_multiple_matches(html, '<meta name="og:url" content="([^"]+)">')) + itemlist = support.server(item, data) + + if item.args == 'update': + + data = httptools.downloadpage(item.url).data + patron = r'<div class="item"><a href="'+host+'/serietv/([^"\/]+)\/"><i class="icon-bars">' + series = scrapertoolsV2.find_single_match(data, patron) + titles = support.typo(series.upper().replace('-', ' '), 'bold color kod') + goseries = support.typo("Vai alla Serie:", ' bold color kod') + itemlist.append( + Item(channel=item.channel, + title=goseries + titles, + fulltitle=titles, + show=series, + contentType='tvshow', + contentSerieName=series, + url=host+"/serietv/"+series, + action='episodios', + contentTitle=titles, + plot = "Vai alla Serie " + titles + " con tutte le puntate", + )) return itemlist From 247aff2676f6d7bdba947facb750cee2da51224f Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Sat, 2 Nov 2019 11:20:53 +0100 Subject: [PATCH 02/10] fix: ilgeniodellostreaming fixati problemi --- channels/ilgeniodellostreaming.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/channels/ilgeniodellostreaming.py b/channels/ilgeniodellostreaming.py index 965ce7dc..5f79d839 100644 --- a/channels/ilgeniodellostreaming.py +++ b/channels/ilgeniodellostreaming.py @@ -7,7 +7,7 @@ """ Alcuni video non si aprono sul sito... - + Avvisi per il test: i link per le categorie non sono TUTTI visibili nella pagina del sito: vanno costruiti con i nomi dei generi che vedete nel CANALE. @@ -51,15 +51,15 @@ def mainlist(item): support.log(item) film = ['/film/', - ('Film Per Categoria',['', 'genres', 'genres']), - ('Film Per Anno',['', 'genres', 'year']), - ('Film Per Lettera',['/film-a-z/', 'genres', 'letter']), + ('Generi',['', 'genres', 'genres']), + ('Per Lettera',['/film-a-z/', 'genres', 'letter']), + ('Anni',['', 'genres', 'year']), ('Popolari',['/trending/?get=movies', 'peliculas', 'populared']), ('Più Votati', ['/ratings/?get=movies', 'peliculas', 'populared']) ] tvshow = ['/serie/', - ('Nuovi Episodi', ['/aggiornamenti-serie/', 'peliculas', 'update']), + ('Aggiornamenti', ['/aggiornamenti-serie/', 'peliculas', 'update']), ('Popolari',['/trending/?get=tv', 'peliculas', 'populared']), ('Più Votati', ['/ratings/?get=tv', 'peliculas', 'populared']) @@ -114,7 +114,8 @@ def peliculas(item): patron = r'<img src="(?P<thumb>[^"]+)" alt="[^"]+">[^>]+>[^>]+>[^>]+>[^>]+>\s+?(?P<rating>\d+.?\d+|\d+)<[^>]+>[^>]+>(?P<quality>[a-zA-Z\-]+)[^>]+>[^>]+>[^>]+>[^>]+><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<[^>]+>[^>]+>[^>]+>(?P<year>\d+)<' else: - patron = r'<div class="poster">\s*<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+>\s*(?P<rating>[0-9.]+)<\/div><span class="quality">(?:SUB-ITA|)?(?P<quality>|[^<]+)?<\/span>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?<\/a>[^>]+>[^>]+>(?P<year>[^<]+)<\/span>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<plot>[^<]+)<div' + #patron = r'<div class="poster">\s*<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+>\s*(?P<rating>[0-9.]+)<\/div><span class="quality">(?:SUB-ITA|)?(?P<quality>|[^<]+)?<\/span>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?<\/a>[^>]+>[^>]+>(?P<year>[^<]+)<\/span>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<plot>[^<]+)<div' + patron = r'<div class="poster">\s?<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)" alt="[^"]+"><\/a>[^>]+>[^>]+>[^>]+>\s*(?P<rating>[0-9.]+)<\/div>(?:<span class="quality">(?:SUB-ITA|)?(?P<quality>|[^<]+)?<\/span>)?[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)[ ]?(?:\[(?P<lang>Sub-ITA)\])?<\/a>[^>]+>[^>]+>(?P<year>[^<]+)<\/span>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<plot>[^<]+)<div' else: # TVSHOW action = 'episodios' @@ -226,7 +227,7 @@ def findvideos(item): patron = r'<div class="item"><a href="'+host+'/serietv/([^"\/]+)\/"><i class="icon-bars">' series = scrapertoolsV2.find_single_match(data, patron) titles = support.typo(series.upper().replace('-', ' '), 'bold color kod') - goseries = support.typo("Vai alla Serie:", ' bold color kod') + goseries = support.typo("Vai alla Serie:", ' bold') itemlist.append( Item(channel=item.channel, title=goseries + titles, @@ -237,6 +238,6 @@ def findvideos(item): url=host+"/serietv/"+series, action='episodios', contentTitle=titles, - plot = "Vai alla Serie " + titles + " con tutte le puntate", + plot = "Vai alla Serie :" + titles + " con tutte le puntate", )) return itemlist From 346467187432e62ac40eb23de79271497d99d2c6 Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Sat, 2 Nov 2019 11:32:23 +0100 Subject: [PATCH 03/10] fix: guardaserieclick.py fixata ricerca --- channels/guardaserieclick.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/channels/guardaserieclick.py b/channels/guardaserieclick.py index a9cdbe1c..1e129c45 100644 --- a/channels/guardaserieclick.py +++ b/channels/guardaserieclick.py @@ -47,7 +47,7 @@ def mainlist(item): ## ## action = 'episodios' ## block = r'(?P<block>.*?)<div\s+class="btn btn-lg btn-default btn-load-other-series">' -## +## ## if item.args == 'ined': ## deflang = 'SUB-ITA' ## patronBlock = r'<span\s+class="label label-default label-title-typology">'+block @@ -68,7 +68,7 @@ def mainlist(item): ## elif item.args == 'classic': ## patronBlock = r'<h2 class="title-typology styck-top" meta-class="title-serie-classiche">'+block ## patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>\s[^>]+>\s(?P<year>\d{4})?\s.+?class="strongText">(?P<title>.+?)<' -## pagination = 25 +## pagination = 25 ## else: ## patronBlock = r'<div\s+class="container container-title-serie-new container-scheda" meta-slug="new">'+block ## patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>\s[^>]+>\s(?P<year>\d{4})?\s.+?class="strongText">(?P<title>.+?)<' @@ -84,13 +84,13 @@ def peliculas(item): action = 'episodios' blacklist = ['DMCA'] - + if item.args == 'genres' or item.args == 'search': - patronBlock = r'<h2 style="color: white !important" class="title-typology">(?P<block>.+?)<div class="container-fluid whitebg" style="">' + patronBlock = r'<h2 style="color:\s?white !important;?" class="title-typology">(?P<block>.+?)<div class="container-fluid whitebg" style="">' patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)</p>' patronNext = r'rel="next" href="([^"]+)">' item.contentType = 'tvshow' -## elif item.args == 'search': +## elif item.args == 'search': ## patronBlock = r'<h2 style="color:\s?white !important.?" class="title-typology">(?P<block>.*?)<div class="container-fluid whitebg" style="">' ## patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)</p>' else: @@ -106,21 +106,23 @@ def peliculas(item): patronBlock = r'<div\s+class="container-fluid greybg title-serie-lastep title-last-ep fixed-title-wrapper containerBottomBarTitle">'+end_block patron = r'<a(?: rel="[^"]+")? href="(?P<url>[^"]+)"(?: class="[^"]+")?>[ ]<img class="[^"]+"[ ]title="[^"]+"[ ]alt="[^"]+"[ ](?:|meta-)?src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?:\d+.\d+)[ ]\((?P<lang>[a-zA-Z\-]+)[^<]+<[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)<' elif item.args == 'nolost': - patronBlock = r'<h2 class="title-typology styck-top" meta-class="title-serie-danonperd">'+end_block + patronBlock = r'<h2 class="title-typology styck-top" meta-class="title-serie-danonperd">'+end_block ## pagination = 25 elif item.args == 'classic': patronBlock = r'<h2 class="title-typology styck-top" meta-class="title-serie-classiche">'+end_block ## patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>\s[^>]+>\s(?P<year>\d{4})?\s.+?class="strongText">(?P<title>.+?)<' ## pagination = 25 ## elif item.args == 'anime': -## +## else: patronBlock = r'<div\s+class="container container-title-serie-new container-scheda" meta-slug="new">'+end_block ## patron = r'<a href="(?P<url>[^"]+)".*?>\s<img\s.*?src="(?P<thumb>[^"]+)"\s/>[^>]+>[^>]+>\s[^>]+>\s(?P<year>\d{4})?\s.+?class="strongText">(?P<title>.+?)<' ## pagination = 25 - #support.regexDbg(item, patron, headers) + #support.regexDbg(item, patronBlock, headers) #debug = True return locals() + + @support.scrape def episodios(item): log() @@ -132,7 +134,7 @@ def episodios(item): def itemHook(item): item.title = item.title.replace(item.fulltitle, '').replace('-','',1) return item - + #debug = True return locals() @@ -174,9 +176,6 @@ def newest(categoria): item.action = "peliculas" itemlist = peliculas(item) -## if itemlist[-1].action == "peliculas": -## itemlist.pop() - # Continua la ricerca in caso di errore except: import sys From 1c1004e0ee0b1a06da6d7b81c6f5f823cb27a4eb Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Sat, 2 Nov 2019 15:36:16 +0100 Subject: [PATCH 04/10] fix: italiaserie.py canale terminato, da testare. --- channels/italiaserie.py | 85 ++++++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 22 deletions(-) diff --git a/channels/italiaserie.py b/channels/italiaserie.py index 3a041fea..4a072910 100644 --- a/channels/italiaserie.py +++ b/channels/italiaserie.py @@ -4,15 +4,24 @@ # ------------------------------------------------------------ """ -""" -import re + Problemi noti che non superano il test del canale: -from core import httptools, scrapertools, support + + Avvisi: + + + Ulteriori info: + +""" + +import re +from core import support, httptools, scrapertoolsV2 from core.item import Item from platformcode import config __channel__ = 'italiaserie' host = config.get_channel_url(__channel__) +headers = [['Referer', host]] list_servers = ['speedvideo'] list_quality = [] @@ -23,7 +32,7 @@ def mainlist(item): support.log() tvshow = ['/category/serie-tv/', - ('Aggiornamenti', ['/ultimi-episodi/', 'peliculas', 'latest']), + ('Aggiornamenti', ['/ultimi-episodi/', 'peliculas', 'update']), ('Generi', ['', 'category', 'Serie-Tv per Genere']) ] @@ -38,14 +47,31 @@ def peliculas(item): patron = r'<div class="post-thumb">\s*<a href="(?P<url>[^"]+)" '\ 'title="(?P<title>[^"]+)">\s*<img src="(?P<thumb>[^"]+)"[^>]+>' - if item.args == "latest": + if item.args == 'update': patron += r'.*?aj-eps">(?P<episode>.+?)[ ]?(?P<lang>Sub-Ita|Ita)</span>' + action = 'findvideos' patronNext = r'<a class="next page-numbers" href="(.*?)">' ## debug = True return locals() +@support.scrape +def episodios(item): + support.log() + + patronBlock = r'</i> Stagione (?P<block>(?P<season>\d+)</div> '\ + '<div class="su-spoiler-content".*?)<div class="clearfix">' + patron = r'(?:(?P<season>\d+)?</div> <div class="su-spoiler-content"(:?.+?)?> )?'\ + '<div class="su-link-ep">\s+<a.*?href="(?P<url>[^"]+)".*?strong>[ ]'\ + '(?P<title>.+?)[ ](?P<episode>\d+-\d+|\d+)[ ](?:-\s+(?P<title2>.+?))?'\ + '[ ]?(?:(?P<lang>Sub-ITA))?[ ]?</strong>' + + + #debug = True + return locals() + + @support.scrape def category(item): support.log() @@ -56,24 +82,10 @@ def category(item): return locals() -@support.scrape -def episodios(item): - support.log() - pagination = 24 - - patronBlock = r'</i> Stagione (?P<block>(?P<season>\d+)</div> '\ - '<div class="su-spoiler-content".*?)<div class="clearfix">' - patron = r'(?:(?P<season>\d+)?</div> <div class="su-spoiler-content"(:?.+?)?> )?'\ - '<div class="su-link-ep">\s+<a.*?href="(?P<url>[^"]+)".*?strong>[ ]'\ - '(?P<title>.+?)[ ](?P<episode>\d+-\d+|\d+)[ ](?:-\s+(?P<title2>.+?))?'\ - '[ ]?(?:(?P<lang>Sub-ITA))?[ ]?</strong>' - - return locals() - - def search(item, texto): support.log("s=", texto) item.url = host + "/?s=" + texto + item.contentType = 'tvshow' try: return peliculas(item) # Continua la ricerca in caso di errore @@ -92,7 +104,7 @@ def newest(categoria): if categoria == "series": item.url = host + "/ultimi-episodi/" item.action = "peliculas" - item.args = "latest" + item.args = "update" item.contentType = "episode" itemlist = peliculas(item) @@ -111,4 +123,33 @@ def newest(categoria): def findvideos(item): support.log() - return support.server(item, data=item.url) + + if item.args == 'update': + itemlist = [] + item.infoLabels['mediatype'] = 'episode' + + data = httptools.downloadpage(item.url, headers=headers).data + data = re.sub('\n|\t', ' ', data) + data = re.sub(r'>\s+<', '> <', data) + url_video = scrapertoolsV2.find_single_match(data, r'<a rel="[^"]+" target="[^"]+" act="[^"]+"\s+href="([^"]+)" class="[^"]+-link".+?\d+.+?</strong> </a>', -1) + url_serie = scrapertoolsV2.find_single_match(data, r'<link rel="canonical" href="([^"]+)" />') + goseries = support.typo("Vai alla Serie:", ' bold') + series = support.typo(item.contentSerieName, ' bold color kod') + itemlist = support.server(item, data=url_video) + + itemlist.append( + Item(channel=item.channel, + title=goseries + series, + fulltitle=item.fulltitle, + show=item.show, + contentType='tvshow', + contentSerieName=item.contentSerieName, + url=url_serie, + action='episodios', + contentTitle=item.contentSerieName, + plot = goseries + series + "con tutte le puntate", + )) + + return itemlist + else: + return support.server(item, data=item.url) From 70ee68dc1235c24531aa9fe01f40c510917fc8d7 Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Sat, 2 Nov 2019 15:46:55 +0100 Subject: [PATCH 05/10] fix: channels/italiaserie.json channels/.cinemalibero.py da completare --- channels/.cinemalibero.py | 267 ++++++++++++++++++++++++++++++++++++++ channels/italiaserie.json | 3 +- 2 files changed, 269 insertions(+), 1 deletion(-) create mode 100644 channels/.cinemalibero.py diff --git a/channels/.cinemalibero.py b/channels/.cinemalibero.py new file mode 100644 index 00000000..7dea9140 --- /dev/null +++ b/channels/.cinemalibero.py @@ -0,0 +1,267 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# Canale per 'cinemalibero' + +""" + Questi sono commenti per i beta-tester. + + Su questo canale, nelle categorie: + -'Ricerca Globale' + - Novità, voce interna al canale + - Nella lista anime + non saranno presenti le voci: + - 'Aggiungi alla Videoteca' + - 'Scarica Film'/'Scarica Serie', + Inoltre nella lista Anime non è presente la voce rinumerazione! + dunque, la loro assenza, nel Test, NON dovrà essere segnalata come ERRORE. + + + Novità ( globale ), presenti solo i film: + - film ( 20 titoli ) della pagina https://www.cinemalibero.best/category/film/ + + Avvisi: + - Eventuali avvisi per i tester + + Ulteriori info: + +""" + +import re + +# per l'uso dei decoratori, per i log, e funzioni per siti particolari +from core import support +# se non si fa uso di findhost() +from platformcode import config + +# in caso di necessità +from core import scrapertoolsV2, httptools#, servertools +from core.item import Item # per newest +#from lib import unshortenit + +# se necessaria la variabile __channel__ +# da cancellare se non utilizzata +__channel__ = "cinemalibero" +# da cancellare se si utilizza findhost() +host = config.get_channel_url('cinemalibero') +headers = [['Referer', host]] + +list_servers = ['akstream', 'wstream', 'openload', 'streamango'] +list_quality = ['default'] + +### fine variabili + +#### Inizio delle def principali ### + +@support.menu +def mainlist(item): + support.log(item) + + film = ['/category/film/', + ('Generi', ['', 'genres', 'genres']), + ] + + # Voce SERIE, puoi solo impostare l'url + tvshow = ['/category/serie-tv/', + ('Novità', ['/aggiornamenti-serie-tv/', 'peliculas', 'update']) + ] + # Voce ANIME, puoi solo impostare l'url + Anime = [('Anime', ['/category/anime-giapponesi/', 'peliculas', 'anime', 'tvshow']), # url per la voce Anime, se possibile la pagina con titoli di anime +## #Voce Menu,['url','action','args',contentType] +## ('Novità', ['', '', '']), +## ('In Corso',['', '', '', '']), +## ('Ultimi Episodi',['', '', '', '']), +## ('Ultime Serie',['', '', '', '']) + ] + + + search = '' + + return locals() + + +@support.scrape +def peliculas(item): + support.log(item) + #support.dbg() # decommentare per attivare web_pdb + + if item.args == 'search': + patron = r'href="(?P<url>[^"]+)".+?url\((?P<thumb>[^\)]+)\)">.+?class="titolo">(?P<title>[^<]+)<' + patronBlock = r'style="color: #2C3549 !important;" class="fon my-3"><small>.+?</small></h1>(?P<block>.*?)<div class="bg-dark ">' + action = 'select' + else: + if item.contentType == 'tvshow': + if item.args == 'update': + patron = r'<div class="card-body p-0">\s<a href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">\s<div class="titolo">(?P<title>.+?)(?: – Serie TV)?(?:\([sSuUbBiItTaA\-]+\))?[ ]?(?P<year>\d{4})?</div>[ ]<div class="genere">(?:[\w]+?\.?\s?[\s|S]?[\dx\-S]+?\s\(?(?P<lang>[iItTaA]+|[sSuUbBiItTaA\-]+)\)?\s?(?P<quality>[HD]+)?|.+?\(?(?P<lang2>[sSuUbBiItTaA\-]+)?\)?</div>)' + action = 'select' + + def itemHook(item): + if item.lang2: + if len(item.lang2) <3: + item.lang2 = 'ITA' + item.contentLanguage = item.lang2 + item.title += support.typo(item.lang2, '_ [] color kod') + return item + + elif item.args == 'anime':# or 'anime' in item.url: + patron = r'<div class="card-body p-0"> <a href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">[^>]+>[^>]+>[^>]+>(?:[ ](?P<rating>\d+.\d+))?[^>]+>[^>]+>(?P<title>.+?)(?:\([sSuUbBiItTaA\-]+\))?\s?(?:(?P<year>\d{4}|\(\d{4}\)|)?)?<[^>]+>(?:<div class="genere">.+?(?:\()?(?P<lang>ITA|iTA|Sub)(?:\))?)?' + action = 'select' + else: + patron = r'<div class="card-body p-0">\s?<a href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)</div>(?:<div class="genere">(?:[ |\w]+?(?:[\dx\-]+)?[ ](?:\()?(?P<lang>[sSuUbB]+|[iItTaA]+)(?:\))?\s?(?P<quality>[\w]+)?\s?|[\s|S]?[\dx\-]+\s[|]?\s?(?:[\w]+)?\s?\(?(\4[sSuUbB]+)?\)?)?.+?</div>)?' + action = 'episodios' + + elif item.contentType == 'movie': + action = 'findvideos' + patron = r'href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">[^>]+>[^>]+>[^>]+>(?:[ ](?P<rating>\d+.\d+))?[^>]+>[^>]+>(?P<title>.+?)(?:\[(?P<lang>Sub-iTA|Sub-ITA|Sub)\])?[ ]\((?P<year>\d+)\)</div>(?:<div class="genere">(?P<quality>[^<]+)<)?' + + patronBlock = r'<h1(?: style="color: #2C3549 !important; text-transform: uppercase;"| style="text-transform: uppercase; color: #2C3549 !important;"| style="color: #2C3549 !important; text-transform: uppercase;" style="text-shadow: 1px 1px 1px #FF8C00; color:#FF8C00;"| style="text-shadow: 1px 1px 1px #0f0f0f;" class="darkorange"| style="color:#2C3549 !important;")>.+?</h1>(?P<block>.*?)<div class=(?:"container"|"bg-dark ")>' + + patronNext = '<a class="next page-numbers".*?href="([^"]+)">' + +## debug = True # True per testare le regex sul sito + return locals() + +@support.scrape +def episodios(item): + support.log(item) + #support.dbg() + + data = item.data1 + if item.args == 'anime': + item.contentType = 'tvshow' + blacklist = ['Clipwatching', 'Verystream', 'Easybytez'] + patron = r'(?:href="[ ]?(?P<url>[^"]+)"[^>]+>(?P<title>[^<]+)<|(?P<episode>\d+(?:×|×)?\d+\-\d+|\d+(?:×|×)\d+)[;]?(?:(\4[^<]+)(\2.*?)|(\2[ ])(?:<(\3.*?)))(?:</a><br />|</a></p>))' + #patron = r'<a target=.+?href="(?P<url>[^"]+)"[^>]+>(?P<title>(Epis|).+?(?P<episode>\d+)?)(?:\((?P<lang>Sub ITA)\))?</a>(?:<br />)?' + patronBlock = r'(?:class="txt_dow">Streaming:(?P<block>.*?)at-below-post)' + else: + patron = r'(?P<episode>\d+(?:×|×)?\d+\-\d+|\d+(?:×|×)\d+)[;]?[ ]?(?:(?P<title>[^<]+)(?P<url>.*?)|(\2[ ])(?:<(\3.*?)))(?:</a><br />|</a></p>)' +## patron = r'<a target=.+?href="(?P<url>[^"]+)"[^>]+>(?P<title>Epis.+?(\d+)?)(?:\((?P<lang>Sub ITA)\))?</a><br />' + patronBlock = r'<p><strong>(?P<block>(?:.+?[Ss]tagione.+?(?P<lang>iTA|ITA|Sub-ITA|Sub-iTA))?(?:|.+?|</strong>)(/?:</span>)?</p>.*?</p>)' + item.contentType = 'tvshow' + + action = 'findvideos' + + debug = True + return locals() + + +@support.scrape +def genres(item): + support.log(item) + #support.dbg() + + action = 'peliculas' + #blacklist = [''] + patron = r'<a class="dropdown-item" href="(?P<url>[^"]+)" title="(?P<title>[A-z]+)"' + + return locals() + +############## Fine ordine obbligato +## Def ulteriori + +def select(item): + support.log('select --->', item) + #support.dbg() + data = httptools.downloadpage(item.url, headers=headers).data + block = scrapertoolsV2.find_single_match(data, r'<div class="col-md-8 bg-white rounded-left p-5"><div>(.*?)<div style="margin-left: 0.5%; color: #FFF;">') + if re.findall('rel="category tag">serie', data, re.IGNORECASE): + support.log('select = ### è una serie ###') + return episodios(Item(channel=item.channel, + title=item.title, + fulltitle=item.fulltitle, + url=item.url, + args='serie', + contentType='tvshow', + data1 = data + )) + elif re.findall('rel="category tag">anime', data, re.IGNORECASE): + if re.findall('episodio', block, re.IGNORECASE) or re.findall('stagione', data, re.IGNORECASE) or re.findall('numero stagioni', data, re.IGNORECASE): + support.log('select = ### è un anime ###') + return episodios(Item(channel=item.channel, + title=item.title, + fulltitle=item.fulltitle, + url=item.url, + args='anime', + contentType='tvshow', + data1 = data + )) + else: + support.log('select = ### è un film ###') + return findvideos(Item(channel=item.channel, + title=item.title, + fulltitle=item.fulltitle, + url=item.url, + args = '', + contentType='movie', + #data = data + )) + else: + support.log('select = ### è un film ###') + return findvideos(Item(channel=item.channel, + title=item.title, + fulltitle=item.fulltitle, + url=item.url, + contentType='movie', + #data = data + )) + +############## Fondo Pagina +# da adattare al canale +def search(item, text): + support.log('search', item) + itemlist = [] + text = text.replace(' ', '+') + item.url = host + "/?s=" + text + item.contentType = item.contentType + try: + item.args = 'search' + item.contentType = 'episode' # non fa uscire le voci nel context menu + return peliculas(item) + # Se captura la excepcion, para no interrumpir al buscador global si un canal falla + except: + import sys + for line in sys.exc_info(): + support.log('search log:', line) + return [] + + +# da adattare al canale +# inserire newest solo se il sito ha la pagina con le ultime novità/aggiunte +# altrimenti NON inserirlo +def newest(categoria): + support.log('newest ->', categoria) + itemlist = [] + item = Item() + try: + if categoria == 'peliculas': + item.url = host+'/category/film/' + item.contentType = 'movie' +## item.action = 'peliculas' +## itemlist = peliculas(item) + elif categoria == 'series': + item.contentType = 'tvshow' + item.args = 'update' + item.url = host+'/aggiornamenti-serie-tv/' + item.action = 'peliculas' + itemlist = peliculas(item) + + if itemlist[-1].action == 'peliculas': + itemlist.pop() + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + support.log('newest log: ', {0}.format(line)) + return [] + + return itemlist + + +#support.server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=True) +def findvideos(item): + support.log('findvideos ->', item) + #return support.server(item, headers=headers) + support.log(item) + if item.contentType == 'movie': + return support.server(item) + else: + return support.server(item, data= item.url) diff --git a/channels/italiaserie.json b/channels/italiaserie.json index 5d487c0a..d9ce76df 100644 --- a/channels/italiaserie.json +++ b/channels/italiaserie.json @@ -6,6 +6,7 @@ "language": ["ita","sub-ita"], "thumbnail": "https:\/\/raw.githubusercontent.com\/Zanzibar82\/images\/master\/posters\/italiaserie.png", "bannermenu": "https:\/\/raw.githubusercontent.com\/Zanzibar82\/images\/master\/posters\/italiaserie.png", - "categories": ["tvshow"], + "categories": ["tvshow", "vos"], + "not_active": ["include_in_newest_peliculas", "include_in_newest_anime", ], "settings": [] } From 93d476198d999654aeffdcca130f14ed360278d7 Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Sat, 2 Nov 2019 16:00:44 +0100 Subject: [PATCH 06/10] fix: support.py fix stagione --- core/support.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/support.py b/core/support.py index fd6c406c..2ab2189a 100644 --- a/core/support.py +++ b/core/support.py @@ -218,6 +218,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t scraped[kk] = val if scraped['season']: + stagione = scraped['season'] episode = scraped['season'] +'x'+ scraped['episode'] elif stagione: episode = stagione +'x'+ scraped['episode'] @@ -236,7 +237,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t # make formatted Title [longtitle] s = ' - ' - title = episode + (s if episode and title else '') + title + title = episode + (s if episode and title else '') + title longtitle = title + (s if title and title2 else '') + title2 longtitle = typo(longtitle, 'bold') longtitle += typo(quality, '_ [] color kod') if quality else '' @@ -400,7 +401,7 @@ def scrape(func): if 'itemlistHook' in args: itemlist = args['itemlistHook'](itemlist) - + if (pagination and len(matches) <= pag * pagination) or not pagination: # next page with pagination if patronNext and inspect.stack()[1][3] != 'newest': nextPage(itemlist, item, data, patronNext, function) From 9426ebdf6f0ef044b3788a259b604a2e76279ac4 Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Sat, 2 Nov 2019 17:04:36 +0100 Subject: [PATCH 07/10] fix: italiaserie.json --- channels/italiaserie.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/channels/italiaserie.json b/channels/italiaserie.json index d9ce76df..fe68c5c1 100644 --- a/channels/italiaserie.json +++ b/channels/italiaserie.json @@ -7,6 +7,6 @@ "thumbnail": "https:\/\/raw.githubusercontent.com\/Zanzibar82\/images\/master\/posters\/italiaserie.png", "bannermenu": "https:\/\/raw.githubusercontent.com\/Zanzibar82\/images\/master\/posters\/italiaserie.png", "categories": ["tvshow", "vos"], - "not_active": ["include_in_newest_peliculas", "include_in_newest_anime", ], + "not_active": ["include_in_newest_peliculas", "include_in_newest_anime"], "settings": [] } From 934dd3256861aa4fec3ced1b99121e3d157f8388 Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Sat, 2 Nov 2019 23:13:18 +0100 Subject: [PATCH 08/10] fix: serietvonline.py canale finito, da testare. --- channels/serietvonline.json | 30 +---- channels/serietvonline.py | 251 ++++++++++++++++++++++-------------- 2 files changed, 156 insertions(+), 125 deletions(-) diff --git a/channels/serietvonline.json b/channels/serietvonline.json index e974d7aa..833b8edc 100644 --- a/channels/serietvonline.json +++ b/channels/serietvonline.json @@ -6,31 +6,7 @@ "language": ["ita"], "thumbnail": "https:\/\/serietvonline.com\/wp-content\/uploads\/2016\/08\/logo2016-1.png", "bannermenu": "https:\/\/serietvonline.com\/wp-content\/uploads\/2016\/08\/logo2016-1.png", - "categories": ["anime","tvshow","movie", "documentary"], - "settings": [ - { - "id": "include_in_newest_series", - "type": "bool", - "label": "Includi in Novità - Serie TV", - "default": false, - "enabled": false, - "visible": false - }, - { - "id": "include_in_newest_anime", - "type": "bool", - "label": "Includi in Novità - Anime", - "default": false, - "enabled": false, - "visible": false - }, - { - "id": "include_in_newest_italiano", - "type": "bool", - "label": "Includi in Novità - Italiano", - "default": false, - "enabled": false, - "visible": false - } - ] + "categories": ["anime","tvshow","movie","documentary"], + "not_active": ["include_in_newest_anime"], + "settings": [] } diff --git a/channels/serietvonline.py b/channels/serietvonline.py index cb2548b6..02125027 100644 --- a/channels/serietvonline.py +++ b/channels/serietvonline.py @@ -4,26 +4,31 @@ # ---------------------------------------------------------- """ - Problemi noti che non superano il test del canale: - - il solo film .45, nella lista titoli, ha come titolo nel canale '.' - - la ricerca dei titoli potrebbe non essere uguale ( da sistemare le regex ) - indicate i titoli, con cui avete avuto problemi, e se sono film o serie. + Novità. Indicare in quale/i sezione/i è presente il canale: + - film, serie Avvisi: - - Nelle pagine di liste avrete un elenco di 24 titoli per pagina, - invece della singola del sito - - Il Canale è incluso nella sola ricerca globale. + - Al massimo 25 titoli per le sezioni: Film + - Al massimo 35 titoli per le sezioni: Tutte le altre - Le pagine di liste sono lente a caricarsi in quanto scaricano anche le info... """ - -from core import support -from platformcode import logger, config +import re +from core import support, httptools, scrapertoolsV2 +from platformcode import config +from core.item import Item __channel__ = "serietvonline" -host = config.get_channel_url(__channel__) -headers = [['Referer', host]] + +host = "" +headers = "" + +def findhost(): + global host, headers + data = httptools.downloadpage('https://serietvonline.me/').data + host = scrapertoolsV2.find_single_match(data, r'<a class="pure-button pure-button-primary" title=\'serie tv online\' href="([^"]+)">') + headers = [['Referer', host]] +findhost() list_servers = ['akvideo', 'wstream', 'backin', 'vidtome', 'nowvideo'] list_quality = ['default'] @@ -33,12 +38,16 @@ list_quality = ['default'] def mainlist(item): support.log() - film = ['/lista-film/', - ('Ultimi Aggiunti', ['/ultimi-film-aggiunti/', 'peliculas', 'latest']) + film = ['/ultimi-film-aggiunti/', + ('Lista', ['/lista-film/', 'peliculas', 'lista']) ] tvshow = ['', - ('HD', ['/lista-serie-tv-in-altadefinizione/', 'peliculas', 'hd']) + ('Aggiornamenti', ['/ultimi-episodi-aggiunti/', 'peliculas', 'update']), + ('Tutte', ['/lista-serie-tv/', 'peliculas', 'qualcosa']), + ('Italiane', ['/lista-serie-tv-italiane/', 'peliculas', 'qualcosa']), + ('Anni 50-60-70-80-90', ['/lista-serie-tv-anni-60-70-80/', 'peliculas', 'qualcosa']), + ('HD', ['/lista-serie-tv-in-altadefinizione/', 'peliculas', 'qualcosa']) ] anime = ['/lista-cartoni-animati-e-anime/'] @@ -54,106 +63,152 @@ def peliculas(item): support.log() blacklist = ['DMCA', 'Contatti', 'Attenzione NON FARTI OSCURARE', 'Lista Ccartoni Animati e Anime'] - - if item.action == 'search': - - patronBlock = r'>Lista Serie Tv</a></li></ul></div><div id="box_movies">'\ - '(?P<block>.*?)<div id="paginador">' - patron = r'<div class="movie"><div class="imagen"> <img src="(?P<thumb>[^"]+)" '\ - 'alt="(?:(?P<title>.+?)[ ]?(?:\d+)?)?" /> <a href="(?P<url>[^"]+)">'\ - '.+?<h2>(?:.+?(?P<year>\d+)?)</h2>(?: <span class="year">'\ - '(\d+)(?:–|–|-\d+)?</span>)?</div>' - - def itemHook(item): - support.log("ITEMHOOK PRIMA: ", item) - if 'film' in item.url: - item.action = 'findvideos' - item.contentType = 'movie' - item.infoLabels['mediatype'] = 'movie' - else: - item.action = 'episodios' - item.contentType = 'tvshow' - item.infoLabels['mediatype'] = 'tvshow' - support.log("ITEMHOOK DOPO: ", item) - - return item - - elif item.extra == 'tvshow' or item.contentType == 'tvshow': - # SEZIONE Serie TV- Anime! - action = 'episodios' - - if 'anime' in item.url: - patronBlock = r'<h1>Lista Cartoni Animati e Anime</h1>(?P<block>.*?)<div class="footer_c">' - patron = r'<a href="(?P<url>[^"]+)" title="(?P<title>[^"]+)">.+?</a>' - - else: - if item.args == 'hd': - patronBlock = r'<h1>Lista Serie Tv in AltaDefinizione</h1>(?P<block>.*?)'\ - '<div class="footer_c">' - patron = r'<a href="(?P<url>[^"]+)" title="(?P<title>[^"]+)">.+?</a>' - - elif item.args == 'doc': - patronBlock = r'<h1>Lista Documentari</h1>(?P<block>.*?)<div class="footer_c">' - patron = r'<a href="(?P<url>[^"]+)" title="(?P<title>[^"]+)">.+?</a>' - - else: - patronBlock = r'<div id="box_movies">(?P<block>.*?)<div id="paginador">' - patron = r'<div class="movie">[^>]+>.+?src="(?P<thumb>[^"]+)" alt="[^"]+"'\ - '.+?href="(?P<url>[^"]+)">[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[ ]'\ - '(?P<rating>\d+.\d+|\d+)<[^>]+>[^>]+><h2>(?P<title>[^"]+)</h2>[ ]?'\ - '(?:<span class="year">(?P<year>\d+|\-\d+))?<' - else: - # SEZIONE FILM - action = 'findvideos' - pagination = 24 - - if not item.args: - patron = r'href="(?P<url>[^"]+)"[^>]+>(?P<title>.*?)[ ]?(?P<year>\d+)?'\ - '(?: Streaming | MD iSTANCE )?<' - patronBlock = r'Lista dei film disponibili in streaming e anche in download\.'\ - '</p>(?P<block>.*?)<div class="footer_c">' - - elif item.args == 'latest': - patronBlock = r'<h1>Ultimi film aggiunti</h1>(?P<block>.*?)<div class="footer_c">' - patron = r'<tr><td><a href="(?P<url>[^"]+)"(?:|.+?)?>(?:  )?[ ]?'\ - '(?P<title>.*?)[ ]?(?:HD)?[ ]?(?P<year>\d+)?'\ - '(?: | HD | Streaming | MD(?: iSTANCE)? )?</a>' - + patronBlock = r'<h1>.+?</h1>(?P<block>.*?)<div class="footer_c">' patronNext = r'<div class="siguiente"><a href="([^"]+)" >' -## debug = True +## if 'film' in item.url: +## contentType = 'movie' +## action = 'findvideos' +## else: +## contentType = 'tvshow' +## action = 'episodios' + + if item.args == 'search': + patronBlock = r'>Lista Serie Tv</a></li></ul></div><div id="box_movies">(?P<block>.*?)<div id="paginador">' + patron = r'<div class="movie">[^>]+[^>]+>\s?<img src="(?P<thumb>[^"]+)" alt="(?P<title>.+?)\s?(?P<year>[\d\-]+)?"[^>]+>\s?<a href="(?P<url>[^"]+)">' + +## def itemHook(item): +## if 'film' in item.url: +## item.action = 'findvideos' +## item.contentType = 'movie' +## else: +## item.contentType = 'tvshow' +## item.action = 'episodios' +## return item + + elif item.contentType == 'tvshow': + # SEZIONE Serie TV- Anime - Documentari + pagination = 35 + + if not item.args and 'anime' not in item.url: + patron = r'<div class="movie">[^>]+>.+?src="(?P<thumb>[^"]+)" alt="[^"]+".+?href="(?P<url>[^"]+)">[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[ ](?P<rating>\d+.\d+|\d+)<[^>]+>[^>]+><h2>(?P<title>[^"]+)</h2>[ ]?(?:<span class="year">(?P<year>\d+|\-\d+))?<' + else: + patron = r'(?:<td>)?<a href="(?P<url>[^"]+)"(?:[^>]+)?>\s?(?P<title>[^<]+)(?P<episode>[\d\-x]+)?(?P<title2>[^<]+)?<' + if item.args == 'update': + action = 'findvideos' + patron = r'<td><a href="(?P<url>[^"]+)"(?:[^>]+)?>\s?(?P<title>[^<]+)(?P<episode>[\d\-x]+)?(?P<title2>[^<]+)?<' + + else: + # SEZIONE FILM + pagination = 25 + + if item.args == 'lista': + patron = r'href="(?P<url>[^"]+)"[^>]+>(?P<title>.*?)[ ]?(?P<year>\d+)?(?: Streaming | MD iSTANCE )?<' + patronBlock = r'Lista dei film disponibili in streaming e anche in download\.</p>(?P<block>.*?)<div class="footer_c">' + + else: + #patronBlock = r'<h1>Ultimi film aggiunti</h1>(?P<block>.*?)<div class="footer_c">' + patron = r'<tr><td><a href="(?P<url>[^"]+)"(?:|.+?)?>(?:  )?[ ]?(?P<title>.*?)[ ]?(?:HD)?[ ]?(?P<year>\d+)?(?: | HD | Streaming | MD(?: iSTANCE)? )?</a>' + + def itemHook(item): + if 'film' in item.url: + item.action = 'findvideos' + item.contentType = 'movie' + elif item.args == 'update': + pass + else: + item.contentType = 'tvshow' + item.action = 'episodios' + return item + + #support.regexDbg(item, patronBlock, headers) + #debug = True return locals() + @support.scrape def episodios(item): support.log() action = 'findvideos' patronBlock = r'<table>(?P<block>.*?)<\/table>' + patron = r'<tr><td>(?:[^<]+)[ ](?:Parte)?(?P<episode>\d+x\d+)(?:|[ ]?(?P<title2>.+?)?(?:avi)?)<(?P<url>.*?)</td><tr>' - patron = r'<tr><td>(?:[^<]+)[ ](?:Parte)?(?P<episode>\d+x\d+|\d+)(?:|[ ]?'\ - '(?P<title2>.+?)?)<(?P<url>.*?)</td><tr>' - -## debug = True + #debug = True return locals() + +def search(item, text): + support.log("CERCA :" ,text, item) + item.url = "%s/?s=%s" % (host, text) + + try: + item.args = 'search' + return peliculas(item) + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + support.log("%s" % line) + return [] + +def newest(categoria): + support.log(categoria) + itemlist = [] + item = Item() + + if categoria == 'peliculas': + item.contentType = 'movie' + item.url = host + '/ultimi-film-aggiunti/' + elif categoria == 'series': + item.args = 'update' + item.contentType = 'tvshow' + item.url = host +'/ultimi-episodi-aggiunti/' + try: + item.action = 'peliculas' + itemlist = peliculas(item) + + except: + import sys + for line in sys.exc_info(): + support.log("{0}".format(line)) + return [] + + return itemlist + def findvideos(item): support.log() if item.contentType == 'movie': return support.server(item, headers=headers) else: - return support.server(item, item.url) + if item.args != 'update': + return support.server(item, item.url) + else: + itemlist = [] + item.infoLabels['mediatype'] = 'episode' -def search(item, texto): - support.log("CERCA :" ,texto, item) - item.url = "%s/?s=%s" % (host, texto) + data = httptools.downloadpage(item.url, headers=headers).data + data = re.sub('\n|\t', ' ', data) + data = re.sub(r'>\s+<', '> <', data) + support.log("DATA - HTML:\n", data) + url_video = scrapertoolsV2.find_single_match(data, r'<tr><td>(.+?)</td><tr>', -1) + url_serie = scrapertoolsV2.find_single_match(data, r'<link rel="canonical" href="([^"]+)"\s?/>') + goseries = support.typo("Vai alla Serie:", ' bold') + series = support.typo(item.contentSerieName, ' bold color kod') + itemlist = support.server(item, data=url_video) - try: - return peliculas(item) - # Continua la ricerca in caso di errore - except: - import sys - for line in sys.exc_info(): - logger.error("%s" % line) - return [] + itemlist.append( + Item(channel=item.channel, + title=goseries + series, + fulltitle=item.fulltitle, + show=item.show, + contentType='tvshow', + contentSerieName=item.contentSerieName, + url=url_serie, + action='episodios', + contentTitle=item.contentSerieName, + plot = goseries + series + "con tutte le puntate", + )) + + return itemlist From 3cd606ff24981f38d49d51a23510d80b66bcad46 Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Sun, 3 Nov 2019 10:43:31 +0100 Subject: [PATCH 09/10] =?UTF-8?q?fix:=20serietvu.py=20canale=20terminato,?= =?UTF-8?q?=20da=20testare=20fix:=20toonitalia,=20uscivano=20risultati=20i?= =?UTF-8?q?n=20novit=C3=A0=20->=20serie=20fix:=20news,=20commentati=20log,?= =?UTF-8?q?=20traduzione=20voci=20fix:=20serietvonline,=20pulizia=20codice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channels/serietvonline.py | 4 +- channels/serietvu.json | 66 +------- channels/serietvu.py | 336 ++++++++++---------------------------- channels/toonitalia.json | 8 +- channels/toonitalia.py | 9 +- specials/news.py | 6 +- 6 files changed, 103 insertions(+), 326 deletions(-) diff --git a/channels/serietvonline.py b/channels/serietvonline.py index 02125027..8c090a34 100644 --- a/channels/serietvonline.py +++ b/channels/serietvonline.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------ -# Canale per serietvonline +# Canale per serietvonline.py # ---------------------------------------------------------- """ @@ -191,7 +191,7 @@ def findvideos(item): data = httptools.downloadpage(item.url, headers=headers).data data = re.sub('\n|\t', ' ', data) data = re.sub(r'>\s+<', '> <', data) - support.log("DATA - HTML:\n", data) + #support.log("DATA - HTML:\n", data) url_video = scrapertoolsV2.find_single_match(data, r'<tr><td>(.+?)</td><tr>', -1) url_serie = scrapertoolsV2.find_single_match(data, r'<link rel="canonical" href="([^"]+)"\s?/>') goseries = support.typo("Vai alla Serie:", ' bold') diff --git a/channels/serietvu.json b/channels/serietvu.json index abb5dbd5..929dcc5b 100644 --- a/channels/serietvu.json +++ b/channels/serietvu.json @@ -3,68 +3,10 @@ "name": "SerieTVU", "active": true, "adult": false, - "language": ["ita"], + "language": ["ita", "sub-ita"], "thumbnail": "serietvu.png", "banner": "serietvu.png", - "categories": ["tvshow"], - "settings": [ - { - "id": "channel_host", - "type": "text", - "label": "Host del canale", - "default": "https://www.serietvu.club", - "enabled": true, - "visible": true - }, - { - "id": "include_in_global_search", - "type": "bool", - "label": "Includi ricerca globale", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_series", - "type": "bool", - "label": "Includi in Novità - Serie TV", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_italiano", - "type": "bool", - "label": "Includi in Novità - Italiano", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "checklinks", - "type": "bool", - "label": "Verifica se i link esistono", - "default": false, - "enabled": true, - "visible": true - }, - { - "id": "checklinks_number", - "type": "list", - "label": "Numero de link da verificare", - "default": 1, - "enabled": true, - "visible": "eq(-1,true)", - "lvalues": [ "1", "3", "5", "10" ] - }, - { - "id": "filter_languages", - "type": "list", - "label": "Mostra link in lingua...", - "default": 0, - "enabled": true, - "visible": true, - "lvalues": ["Non filtrare","IT"] - } - ] + "categories": ["tvshow", "vos"], + "not_active": ["include_in_newest_peliculas", "include_in_newest_anime"], + "settings": [] } diff --git a/channels/serietvu.py b/channels/serietvu.py index 5c8c7b34..4dc8ee17 100644 --- a/channels/serietvu.py +++ b/channels/serietvu.py @@ -1,28 +1,22 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------ -# Canale per SerieTVU -# Thanks to Icarus crew & Alfa addon & 4l3x87 +# Canale per serietvu.py # ---------------------------------------------------------- """ - Trasformate le sole def per support.menu e support.scrape - da non inviare nel test. - Test solo a trasformazione completa - + La pagina novità contiene al max 25 titoli """ import re -from core import tmdb, scrapertools, support +from core import support, httptools, scrapertoolsV2 from core.item import Item from core.support import log -from platformcode import config, logger +from platformcode import config __channel__ = 'serietvu' host = config.get_channel_url(__channel__) headers = [['Referer', host]] -IDIOMAS = {'Italiano': 'IT'} -list_language = IDIOMAS.values() list_servers = ['speedvideo'] list_quality = ['default'] @@ -30,235 +24,74 @@ list_quality = ['default'] @support.menu def mainlist(item): log() + tvshow = ['/category/serie-tv', - ('Novità', ['/ultimi-episodi', 'latestep']), - ('Categorie', ['', 'categorie']) + ('Novità', ['/ultimi-episodi/', 'peliculas', 'update']), + ('Generi', ['', 'genres', 'genres']) ] return locals() -# ---------------------------------------------------------------------------------------------------------------- -def cleantitle(scrapedtitle): - log() - scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle.strip()) - scrapedtitle = scrapedtitle.replace('[HD]', '').replace('’', '\'').replace('– Il Trono di Spade', '').replace( - 'Flash 2014', 'Flash').replace('"', "'") - year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)') - if year: - scrapedtitle = scrapedtitle.replace('(' + year + ')', '') - - return scrapedtitle.strip() - - -# ================================================================================================================ - -# ---------------------------------------------------------------------------------------------------------------- +@support.scrape def peliculas(item): log() - itemlist = [] - patron = r'<div class="item">\s*<a href="([^"]+)" data-original="([^"]+)" class="lazy inner">' - patron += r'[^>]+>[^>]+>[^>]+>[^>]+>([^<]+)<' - matches, data = support.match(item, patron, headers=headers) + patronBlock = r'<div class="wrap">\s+<h.>.*?</h.>(?P<block>.*?)<footer>' - for scrapedurl, scrapedimg, scrapedtitle in matches: - infoLabels = {} - year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)') - if year: - infoLabels['year'] = year - scrapedtitle = cleantitle(scrapedtitle) + + if item.args != 'update': + action = 'episodios' + patron = r'<div class="item">\s*<a href="(?P<url>[^"]+)" data-original="(?P<thumb>[^"]+)" class="lazy inner">[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)<' + else: + action = 'findvideos' + patron = r'<div class="item">\s+?<a href="(?P<url>[^"]+)"\s+?data-original="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)<[^>]+>\((?P<episode>[\dx\-]+)\s+?(?P<lang>Sub-Ita|[iITtAa]+)\)<' + pagination = 25 - itemlist.append( - Item(channel=item.channel, - action="episodios", - title=scrapedtitle, - fulltitle=scrapedtitle, - url=scrapedurl, - thumbnail=scrapedimg, - show=scrapedtitle, - infoLabels=infoLabels, - contentType='episode', - folder=True)) + patronNext = r'<li><a href="([^"]+)"\s+?>Pagina successiva' - tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + #support.regexDbg(item, patron, headers) + #debug = True + return locals() - # Pagine - support.nextPage(itemlist, item, data, '<li><a href="([^"]+)">Pagina successiva') - - return itemlist - - -# ================================================================================================================ - - -# ---------------------------------------------------------------------------------------------------------------- +@support.scrape def episodios(item): log() - itemlist = [] - patron = r'<option value="(\d+)"[\sselected]*>.*?</option>' - matches, data = support.match(item, patron, headers=headers) - - for value in matches: - patron = r'<div class="list [active]*" data-id="%s">(.*?)</div>\s*</div>' % value - blocco = scrapertools.find_single_match(data, patron) - log(blocco) - patron = r'(<a data-id="\d+[^"]*" data-href="([^"]+)"(?:\sdata-original="([^"]+)")?\sclass="[^"]+">)[^>]+>[^>]+>([^<]+)<' - matches = scrapertools.find_multiple_matches(blocco, patron) - - for scrapedextra, scrapedurl, scrapedimg, scrapedtitle in matches: - contentlanguage = '' - if 'sub-ita' in scrapedtitle.lower(): - contentlanguage = 'Sub-ITA' - scrapedtitle = scrapedtitle.replace(contentlanguage, '') - - number = cleantitle(scrapedtitle.replace("Episodio", "")).strip() - - title = value + "x" + number.zfill(2) - title += " "+support.typo(contentlanguage, '_ [] color kod') if contentlanguage else '' - - infoLabels = {} - infoLabels['episode'] = number.zfill(2) - infoLabels['season'] = value - - itemlist.append( - Item(channel=item.channel, - action="findvideos", - title=title, - fulltitle=scrapedtitle, - contentType="episode", - url=scrapedurl, - thumbnail=scrapedimg, - extra=scrapedextra, - infoLabels=infoLabels, - folder=True)) - - tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) - - support.videolibrary(itemlist, item, 'bold color kod') - - return itemlist + patronBlock = r'</select><div style="clear:both"></div></h2>(?P<block>.*?)<div id="trailer" class="tab">' + patron = r'(?:<div class="list (?:active)?" data-id="(?P<season>\d+)">[^>]+>)?\s+<a data-id="(?P<episode>\d+)(?:[ ](?P<lang>[SuUbBiItTaA\-]+))?"(?P<url>[^>]+)>[^>]+>[^>]+>(?P<title>.+?)(?:\sSub-ITA)?<' + + #support.regexDbg(item, patronBlock, headers) + #debug = True + return locals() -# ================================================================================================================ - -# ---------------------------------------------------------------------------------------------------------------- -def findvideos(item): - log() - return support.server(item, data=item.url) - - - -# ================================================================================================================ - - -# ---------------------------------------------------------------------------------------------------------------- -def findepisodevideo(item): +@support.scrape +def genres(item): log() - patron_block = r'<div class="list [active]*" data-id="%s">(.*?)</div>\s*</div>' % item.extra[0][0] - patron = r'<a data-id="%s[^"]*" data-href="([^"]+)"(?:\sdata-original="[^"]+")?\sclass="[^"]+">' % item.extra[0][1].lstrip("0") - matches = support.match(item, patron, patron_block, headers)[0] - data = '' - if len(matches) > 0: - data = matches[0] - item.contentType = 'movie' - return support.server(item, data=data) + blacklist = ["Home Page", "Calendario Aggiornamenti"] + action = 'peliculas' + patronBlock = r'<h2>Sfoglia</h2>\s*<ul>(?P<block>.*?)</ul>\s*</section>' + patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)</a></li>' + #debug = True + + return locals() -# ================================================================================================================ +def search(item, text): + log(text) + item.url = host + "/?s=" + text + try: + item.contentType = 'tvshow' + return peliculas(item) + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + log("%s" % line) + return [] - -# ---------------------------------------------------------------------------------------------------------------- -def latestep(item): - log() - itemlist = [] - titles = [] - - patron_block = r"Ultimi episodi aggiunti.*?<h2>" - patron = r'<a href="([^"]*)"\sdata-src="([^"]*)"\sclass="owl-lazy.*?".*?class="title">(.*?)<small>\((\d*?)x(\d*?)\s(Sub-Ita|Ita)' - matches = support.match(item, patron, patron_block, headers, host)[0] - - for scrapedurl, scrapedimg, scrapedtitle, scrapedseason, scrapedepisode, scrapedlanguage in matches: - infoLabels = {} - year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)') - if year: - infoLabels['year'] = year - infoLabels['episode'] = scrapedepisode - infoLabels['season'] = scrapedseason - episode = scrapedseason + "x" + scrapedepisode - - scrapedtitle = cleantitle(scrapedtitle) - title = scrapedtitle + " - " + episode - contentlanguage = "" - if scrapedlanguage.strip().lower() != 'ita': - title += " "+support.typo("Sub-ITA", '_ [] color kod') - contentlanguage = 'Sub-ITA' - - titles.append(title) - itemlist.append( - Item(channel=item.channel, - action="findepisodevideo", - title=title, - fulltitle=title, - url=scrapedurl, - extra=[[scrapedseason, scrapedepisode]], - thumbnail=scrapedimg, - contentSerieName=scrapedtitle, - contentLanguage=contentlanguage, - contentType='episode', - infoLabels=infoLabels, - folder=True)) - - patron = r'<div class="item">\s*<a href="([^"]+)" data-original="([^"]+)" class="lazy inner">' - patron += r'[^>]+>[^>]+>[^>]+>[^>]+>([^<]+)<small>([^<]+)<' - matches = support.match(item, patron, headers=headers)[0] - - for scrapedurl, scrapedimg, scrapedtitle, scrapedinfo in matches: - infoLabels = {} - year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)') - if year: - infoLabels['year'] = year - scrapedtitle = cleantitle(scrapedtitle) - - infoLabels['tvshowtitle'] = scrapedtitle - - episodio = re.compile(r'(\d+)x(\d+)', re.DOTALL).findall(scrapedinfo) - infoLabels['episode'] = episodio[0][1] - infoLabels['season'] = episodio[0][0] - - episode = infoLabels['season'] + "x" + infoLabels['episode'] - title = "%s - %s" % (scrapedtitle, episode) - title = title.strip() - contentlanguage = "" - if 'sub-ita' in scrapedinfo.lower(): - title += " "+support.typo("Sub-ITA", '_ [] color kod') - contentlanguage = 'Sub-ITA' - - if title in titles: continue - itemlist.append( - Item(channel=item.channel, - action="findepisodevideo", - title=title, - fulltitle=title, - url=scrapedurl, - extra=episodio, - thumbnail=scrapedimg, - contentSerieName=scrapedtitle, - contentLanguage=contentlanguage, - infoLabels=infoLabels, - contentType='episode', - folder=True)) - - tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) - - return itemlist - - -# ================================================================================================================ - -# ---------------------------------------------------------------------------------------------------------------- def newest(categoria): log(categoria) itemlist = [] @@ -266,51 +99,52 @@ def newest(categoria): try: if categoria == "series": item.url = host + "/ultimi-episodi" - item.action = "latestep" - itemlist = latestep(item) - - if itemlist[-1].action == "latestep": - itemlist.pop() + item.action = "peliculas" + item.contentType = 'tvshow' + item.args = 'update' + itemlist = peliculas(item) # Continua la ricerca in caso di errore except: import sys for line in sys.exc_info(): - logger.error("{0}".format(line)) + log("{0}".format(line)) return [] return itemlist -# ================================================================================================================ - -# ---------------------------------------------------------------------------------------------------------------- -def search(item, texto): - log(texto) - item.url = host + "/?s=" + texto - try: - return peliculas(item) - # Continua la ricerca in caso di errore - except: - import sys - for line in sys.exc_info(): - logger.error("%s" % line) - return [] - - -# ================================================================================================================ - -# ---------------------------------------------------------------------------------------------------------------- -@support.scrape -def categorie(item): +def findvideos(item): log() + if item.args != 'update': + return support.server(item, data=item.url) + else: + itemlist = [] + item.infoLabels['mediatype'] = 'episode' - blacklist = ["Home Page", "Calendario Aggiornamenti"] - action = 'peliculas' - patronBlock = r'<h2>Sfoglia</h2>\s*<ul>(?P<block>.*?)</ul>\s*</section>' - patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)</a></li>' - debug = True + data = httptools.downloadpage(item.url, headers=headers).data + data = re.sub('\n|\t', ' ', data) + data = re.sub(r'>\s+<', '> <', data) +## support.log("DATA - HTML:\n", data) + url_video = scrapertoolsV2.find_single_match(data, r'<div class="item"> <a data-id="[^"]+" data-href="([^"]+)" data-original="[^"]+"[^>]+> <div> <div class="title">Episodio \d+', -1) + url_serie = scrapertoolsV2.find_single_match(data, r'<link rel="canonical" href="([^"]+)"\s?/>') + goseries = support.typo("Vai alla Serie:", ' bold') + series = support.typo(item.contentSerieName, ' bold color kod') - return locals() - -# ================================================================================================================ + itemlist = support.server(item, data=url_video) + + itemlist.append( + Item(channel=item.channel, + title=goseries + series, + fulltitle=item.fulltitle, + show=item.show, + contentType='tvshow', + contentSerieName=item.contentSerieName, + url=url_serie, + action='episodios', + contentTitle=item.contentSerieName, + plot = goseries + series + "con tutte le puntate", + )) + + #support.regexDbg(item, patronBlock, headers) + return itemlist diff --git a/channels/toonitalia.json b/channels/toonitalia.json index 651d88c9..b62b658b 100644 --- a/channels/toonitalia.json +++ b/channels/toonitalia.json @@ -6,8 +6,8 @@ "adult": false, "thumbnail": "toonitalia.png", "banner": "toonitalia.png", - "categories": ["tvshow", "movie", "vos", "anime"], - "not_active":["include_in_newest_peliculas"], - "default_off":["include_in_newest"], + "categories": ["anime","vos"], + "not_active":["include_in_newest_peliculas", "include_in_newest_series"], + "default_off":["include_in_newest"], "settings": [] -} \ No newline at end of file +} diff --git a/channels/toonitalia.py b/channels/toonitalia.py index 693861cc..41303113 100644 --- a/channels/toonitalia.py +++ b/channels/toonitalia.py @@ -48,10 +48,11 @@ def newest(categoria): support.log(categoria) item = support.Item() try: - item.contentType = 'tvshow' - item.url= host - item.args= 'new' - return peliculas(item) + if categoria == 'anime': + item.contentType = 'tvshow' + item.url= host + item.args= 'new' + return peliculas(item) # Continua la ricerca in caso di errore except: import sys diff --git a/specials/news.py b/specials/news.py index 10f7b68f..38ecb05c 100644 --- a/specials/news.py +++ b/specials/news.py @@ -392,7 +392,7 @@ def get_newest(channel_id, categoria): def get_title(item): - support.log("ITEM NEWEST ->", item) + #support.log("ITEM NEWEST ->", item) # item.contentSerieName c'è anche se è un film if item.contentSerieName and item.contentType != 'movie': # Si es una serie title = item.contentSerieName @@ -671,7 +671,7 @@ def cb_custom_button(item, dict_values): dict_values[v] = not value if config.set_setting("custom_button_value_news", not value, item.channel) == True: - return {"label": "Ninguno"} + return {"label": config.get_localized_string(59992)} else: - return {"label": "Todos"} + return {"label": config.get_localized_string(59991)} From 35822d615fdf12f139c1b546cb555625b52f3053 Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Sun, 3 Nov 2019 12:29:12 +0100 Subject: [PATCH 10/10] revert: toonitalia --- channels/toonitalia.json | 2 +- channels/toonitalia.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/channels/toonitalia.json b/channels/toonitalia.json index b62b658b..15f0a135 100644 --- a/channels/toonitalia.json +++ b/channels/toonitalia.json @@ -6,7 +6,7 @@ "adult": false, "thumbnail": "toonitalia.png", "banner": "toonitalia.png", - "categories": ["anime","vos"], + "categories": ["tvshow", "movie", "vos", "anime"], "not_active":["include_in_newest_peliculas", "include_in_newest_series"], "default_off":["include_in_newest"], "settings": [] diff --git a/channels/toonitalia.py b/channels/toonitalia.py index 41303113..693861cc 100644 --- a/channels/toonitalia.py +++ b/channels/toonitalia.py @@ -48,11 +48,10 @@ def newest(categoria): support.log(categoria) item = support.Item() try: - if categoria == 'anime': - item.contentType = 'tvshow' - item.url= host - item.args= 'new' - return peliculas(item) + item.contentType = 'tvshow' + item.url= host + item.args= 'new' + return peliculas(item) # Continua la ricerca in caso di errore except: import sys