From 78647e27e66f799810ca68bba08dac475d8333ff Mon Sep 17 00:00:00 2001 From: greko17 Date: Sun, 27 Oct 2019 15:05:01 +0100 Subject: [PATCH 1/5] fix: cinemalibero.py riscritto, ma non ultimato --- channels/cinemalibero.json | 14 +-- channels/cinemalibero.py | 237 +++++++++++++------------------------ 2 files changed, 88 insertions(+), 163 deletions(-) diff --git a/channels/cinemalibero.json b/channels/cinemalibero.json index d66af440..acf7781a 100644 --- a/channels/cinemalibero.json +++ b/channels/cinemalibero.json @@ -6,15 +6,7 @@ "adult": false, "thumbnail": "https://www.cinemalibero.center/wp-content/themes/Cinemalibero%202.0/images/logo02.png", "banner": "https://www.cinemalibero.center/wp-content/themes/Cinemalibero%202.0/images/logo02.png", - "categories": ["tvshow", "movie","anime"], - "settings": [ - { - "id": "include_in_newest_series", - "type": "bool", - "label": "@70727", - "default": false, - "enabled": false, - "visible": false - } - ] + "categories": ["movie","tvshow","anime"], + "not_active": ["include_in_newest"], + "settings": [] } diff --git a/channels/cinemalibero.py b/channels/cinemalibero.py index f9edd8a7..2be2f1cb 100644 --- a/channels/cinemalibero.py +++ b/channels/cinemalibero.py @@ -1,205 +1,162 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------ -# Canale per cinemalibero +# Canale per CinemaLibero - First Version # ------------------------------------------------------------ -""" - - Il canale non permette di filtrare film, serie e altro nella ricerca. - Quindi vengono disabilitate le voci: - - "Aggiungi in videoteca" - - "Scarica film/serie" - per le solo ricerce: nel canale e globale. - - Problemi noti che non superano il test del canale: - - - - Avvisi: - - - - 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 core import httptools, support, scrapertoolsV2 +from core.item import Item 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 - -__channel__ = "cinemalibero" -host = config.get_channel_url(__channel__) -headers = [['Referer', host]] -##headers = [ -## ['Host', host.split("//")[-1].split("/")[0]], -## ['User-Agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'], -## ['Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'], -## ['Accept-Language', 'en-US,en;q=0.5'], -## ['Accept-Encoding', 'gzip, deflate'], -## ['Referer', host], -## ['DNT', '1'], -## ['Connection', 'keep-alive'], -## ['Upgrade-Insecure-Requests', '1'], -## ['Cache-Control', 'max-age=0'] -## ] - list_servers = ['akstream', 'wstream', 'openload', 'streamango'] list_quality = ['default'] +## +### Necessario per Verifica Link +##checklinks = config.get_setting('checklinks', 'cinemalibero') +##checklinks_number = config.get_setting('checklinks_number', 'cinemalibero') + +__channel__ = "cinemalibero" +host = config.get_channel_url(__channel__) + +headers = [['Referer', host]] @support.menu def mainlist(item): - support.log(item) + support.log() film = ['/category/film/', - ('Generi', ['', 'genres', 'genres']), + ('Generi', ['', 'genres']) ] tvshow = ['/category/serie-tv/', -## ('Novità', ['/aggiornamenti-serie-tv/', 'peliculas', 'update']), ] - anime = ['/category/anime-giapponesi/', - ] + Anime = [('Anime',['/category/anime-giapponesi/', 'peliculas', 'anime', 'tvshow']) + ] + + sport = [('Sport', ['/category/sport/', 'peliculas', 'tvshow'])] search = '' - return locals() + @support.scrape +#def video(item): def peliculas(item): - support.log(item) - #support.dbg() # decommentare per attivare web_pdb - debug = True - blacklist = [''] + support.log() + #debug = True - if item.args == 'search': - patron = r'href="(?P[^"]+)".+?url\((?P[^\)]+)\)">.+?class="titolo">(?P[^<]+)<' - patronBlock = r'style="color: #2C3549 !important;" class="fon my-3"><small>.+?</small></h1>(?P<block>.*?)<div class="bg-dark ">' - action = 'select' + patronBlock = r'<div class="container">.*?class="col-md-12[^"]*?">(?P<block>.*?)<div class=(?:"container"|"bg-dark ")>' + if item.contentType == 'movie': + patron = r'<div class="col-lg-3">[^>]+>[^>]+>\s<a href="(?P<url>[^"]+)".+?url\((?P<thumb>[^\)]+)\)">[^>]+>[^>]+>[^>]+>\s?(?P<rating>[\d\.]+)?[^>]+>[^>]+>(?P<title>.+?)\(?(?P<year>\d+)?\)?<[^>]+>[^>]+>(?P<quality>[^<]+)?<' + elif item.args == 'anime': + patron = r'<div class="col-lg-3">[^>]+>[^>]+>\s<a href="(?P<url>[^"]+)".+?url\((?P<thumb>[^\)]+)\)">[^>]+>[^>]+>[^>]+>\s?(?P<rating>[\d\.]+)?[^>]+>[^>]+>(?P<title>.+?)\(?(?P<year>\d+)?\)?<[^>]+>[^>]+>(?:.+?[^fFiInNeE]+?\(?(?P<lang>[sSuUbBiItTaA]+)\)?.+?)<' else: - if item.contentType == 'tvshow': - # da sistemare per matchare le ultime serie inserite - if item.args == 'update': - patron = r'<div class="card-body p-0"> <a href="(?P<url>[^"]+)".+?url\((?P<thumb>[^)]+)\)">[^>]+>(?P<title>.+?)(?:[ ]\((?P<lang>SubITA)\))?(?:[ ](?P<year>\d{4}))?</div> <div class="genere">(?:|Ep.)(?:|.+?)?</div>' - action = 'select' - else: -## #patron = r'href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">[^>]+>[^>]+>[^>]+>(?:[ ](?P<rating>\d+.\d+))?[^>]+>[^>]+>(?P<title>.+?)<[^>]+>[^>]+>(?:.+?) (?:\()?(?P<lang>ITA|iTA|Sub)(?:\))?' -## #patron = r'<div class="card-body p-0"> <a href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">[^>]+>[^>]+>[^>]+>(?:[ ](?P<rating>\d+.\d+))?[^>]+>[^>]+>(?P<title>.+?)(?: \(.+?\))?(?: \(\d+\)| \d+)?<[^>]+>(?:<div class="genere">.+?(?:\()?(?P<lang>ITA|iTA|Sub)(?:\))?)?' - patron = r'<div class="card-body p-0"> <a href="(?P<url>[^"]+)".+?url\((?P<thumb>.+?)\)">[^>]+>[^>]+>[^>]+>(?:[ ](?P<rating>\d+.\d+))?[^>]+>[^>]+>(?P<title>.+?)(?: \(.+?\))?(?: \(\d+\)| \d+)?</div><div class="genere">(?:.?(?P<episode>\d+x\d+-\d+|\d+-\d+|\d+x\d+|\d+)[ ]?(?:\()?(?:(?P<lang>ITA|iTA|Sub ITA|Sub iTA|Sub))?[ ]?(?:(?P<quality>HD))?.+?)</div>' - action = 'episodios' - if '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>.+?)(?: \(.+?\))?(?: \(\d+\)| \d+)?<[^>]+>(?:<div class="genere">.+?(?:\()?(?P<lang>ITA|iTA|Sub)(?:\))?)?' - action = 'select' - 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>[^<]+)<)?' + patron = r'<div class="col-lg-3">[^>]+>[^>]+>\s<a href="(?P<url>[^"]+)".+?url\((?P<thumb>[^\)]+)\)">[^>]+>[^>]+>[^>]+>(?:[^>]+>)?\s?(?P<rating>[\d\.]+)?[^>]+>(?P<title>[^<]+)<[^>]+>[^>]+>(.?[\d\-x]+\s\(?(?P<lang>[sSuUbBiItTaA\-]+)?\)?\s?(?P<quality>[\w]+)?[|]?\s?(?:[fFiInNeE]+)?\s?\(?(?P<lang2>[sSuUbBiItTaA\-]+)?\)?)?' - 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 ")>' + 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') - patronNext = '<a class="next page-numbers".*?href="([^"]+)">' + if item.contentType == 'movie': + item.action = 'findvideos' + elif item.args == 'anime' or item.extra == 'search': + item.action = 'select' + elif item.contentType == 'tvshow': + item.extra = 'serie' + item.action = 'episodios' + else: + item.action = 'select' + return item + + patronNext = r'<a class="next page-numbers".*?href="([^"]+)">' return locals() - @support.scrape -def episodios(item): - support.log(item) +def episodios(item): # Questa def. deve sempre essere nominata episodios + support.log() - #dbg -## if item.args == '': -## patron = r'<a target=.+?href="(?P<url>[^"]+)"[^>]+>(?P<title>Epis.+?(\d+)?)(?:\((?P<lang>Sub ITA)\))?</a><br />' -## patronBlock = r'(?:class="txt_dow">Streaming:(?P<block>.*?)at-below-post)' - if item.data1 and 'stagione' not in item.data1.lower(): - # è un movie - item.contentType = 'tvshow' - #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: + if item.extra == 'serie': 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' + elif item.extra == 'anime': + support.log("Anime :", item) + blacklist = ['Clipwatching', 'Verystream', 'Easybytez', 'Flix555'] + 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)' - action = 'findvideos' - blacklist = [''] + else: + support.log('extra = else --- select = ### è un film ###') + return findvideos(Item(channel=item.channel, + title=item.title, + fulltitle=item.fulltitle, + url=item.url, + show=item.fulltitle, + contentType='movie')) -## pagination = '' - -## debug = True return locals() - @support.scrape def genres(item): - support.log(item) - #dbg + support.log() - action = 'peliculas' - blacklist = [''] - patron = r'<a class="dropdown-item" href="(?P<url>[^"]+)" title="(?P<title>[A-z]+)"' + action='peliculas' + patron_block=r'<div id="bordobar" class="dropdown-menu(?P<block>.*?)</li>' + patron=r'<a class="dropdown-item" href="(?P<url>[^"]+)" title="(?P<title>[A-z]+)"' return locals() def select(item): - support.log('select --->', item) - #support.dbg() + support.log() + 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;">') + #block = scrapertools.find_single_match(data, r'<div class="col-md-8 bg-white rounded-left p-5"><div>(.*?)<\/div>') + block = scrapertoolsV2.find_single_match(data, r'Streaming:(.*?)<\/div>') 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 - )) + extra='serie', + contentType='episode')) elif re.findall('rel="category tag">anime', data, re.IGNORECASE): - if re.findall('episodio', block, re.IGNORECASE) or re.findall('stagione', data, re.IGNORECASE): + if re.findall('episodio', block, re.IGNORECASE) or re.findall('episodi streaming', block, 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 - )) + extra='anime', + contentType='episode')) else: - support.log('select = ### è un film ###') + support.log('select anime ELSE = ### è un film ###') return findvideos(Item(channel=item.channel, title=item.title, fulltitle=item.fulltitle, url=item.url, - args = '', - contentType='movie', - #data = data - )) + contentType='movie')) else: - support.log('select = ### è un film ###') + support.log('select ELSE = ### è un film ###') return findvideos(Item(channel=item.channel, title=item.title, fulltitle=item.fulltitle, url=item.url, - contentType='movie', - #data = data - )) + contentType='movie')) def search(item, texto): - support.log("[cinemalibero.py] " + item.url + " search " + texto) + support.log(item.url,texto) item.url = host + "/?s=" + texto + item.contentType = 'episode' + item.extra = 'search' try: - item.args = 'search' - item.contentType = 'episode' # non fa uscire le voci nel context menu return peliculas(item) # Continua la ricerca in caso di errore except: @@ -208,32 +165,8 @@ def search(item, texto): support.log("%s" % line) return [] -def newest(categoria): - support.log('newest ->', categoria) - itemlist = [] - item = Item() - try: - if categoria == 'peliculas': - item.args = 'update' - item.url = host+'/aggiornamenti-serie-tv/' - item.contentType = 'tvshow' - 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(): - log('newest log: ', {0}.format(line)) - return [] - - return itemlist - - def findvideos(item): - support.log(item) + support.log('findvideos ->', item) if item.contentType == 'movie': return support.server(item) else: From 08fa4d48a475fc685312b0bfdc3167aba42448eb Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Mon, 28 Oct 2019 11:01:56 +0100 Subject: [PATCH 2/5] fix: cinemalibero.py funzionanti sezioni film e serietv --- channels/cinemalibero.py | 104 +++++++++++++++++++++++++++++++-------- 1 file changed, 84 insertions(+), 20 deletions(-) diff --git a/channels/cinemalibero.py b/channels/cinemalibero.py index 2be2f1cb..c2c3bee5 100644 --- a/channels/cinemalibero.py +++ b/channels/cinemalibero.py @@ -1,19 +1,42 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------ -# Canale per CinemaLibero - First Version +# Canale per 'cinemaLibero' # ------------------------------------------------------------ +""" + Questi sono commenti per i beta-tester. + + Su questo canale in: + - Cerca ( nel canale ) e Ricerca Globale + - SerieTV e novità del canale + - Novità -> SerieTV + non saranno presenti le voci: + - 'Aggiungi alla Videoteca', + - 'Scarica Serie' + - NON SONO PRESENTI IN NOVITà GLOBALE E del CANALE RIGUARDANTI LO SPORT!!!! + dunque, la loro assenza, nel Test, NON dovrà essere segnalata come ERRORE. + + NON CONTROLLARE LA SEZIONE SPORT, HA PROBLEMI!!! + è stata eliminata dall'elenco ma i titoli possono apparire nella ricerca o tra le novità + Non è errore se dà problemi!!! NON CONSIDERATELA! + + Novità. Indicare in quale/i sezione/i è presente il canale: + - FILM + + Avvisi: + - Eventuali avvisi per i tester + + Ulteriori info: + +""" + import re from core import httptools, support, scrapertoolsV2 from core.item import Item from platformcode import config -list_servers = ['akstream', 'wstream', 'openload', 'streamango'] +list_servers = ['akstream', 'wstream', 'backin', 'verystream', 'openload', 'streamango'] list_quality = ['default'] -## -### Necessario per Verifica Link -##checklinks = config.get_setting('checklinks', 'cinemalibero') -##checklinks_number = config.get_setting('checklinks_number', 'cinemalibero') __channel__ = "cinemalibero" host = config.get_channel_url(__channel__) @@ -28,15 +51,17 @@ def mainlist(item): ('Generi', ['', 'genres']) ] - tvshow = ['/category/serie-tv/', + tvshow = ['/category/serie-tv/' ] - Anime = [('Anime',['/category/anime-giapponesi/', 'peliculas', 'anime', 'tvshow']) + Anime = [(support.typo('Anime', 'bullet bold'),['/category/anime-giapponesi/', 'peliculas', 'anime', 'tvshow']) ] - sport = [('Sport', ['/category/sport/', 'peliculas', 'tvshow'])] - +## Sport = [(support.typo('Sport', 'bullet bold'), ['/category/sport/', 'peliculas', '', 'tvshow']) +## ] +## news = [('Novità Serie-Anime', ['/aggiornamenti-serie-tv/', 'peliculas', 'update', 'tvshow'])] search = '' + return locals() @@ -51,6 +76,9 @@ def peliculas(item): patron = r'<div class="col-lg-3">[^>]+>[^>]+>\s<a href="(?P<url>[^"]+)".+?url\((?P<thumb>[^\)]+)\)">[^>]+>[^>]+>[^>]+>\s?(?P<rating>[\d\.]+)?[^>]+>[^>]+>(?P<title>.+?)\(?(?P<year>\d+)?\)?<[^>]+>[^>]+>(?P<quality>[^<]+)?<' elif item.args == 'anime': patron = r'<div class="col-lg-3">[^>]+>[^>]+>\s<a href="(?P<url>[^"]+)".+?url\((?P<thumb>[^\)]+)\)">[^>]+>[^>]+>[^>]+>\s?(?P<rating>[\d\.]+)?[^>]+>[^>]+>(?P<title>.+?)\(?(?P<year>\d+)?\)?<[^>]+>[^>]+>(?:.+?[^fFiInNeE]+?\(?(?P<lang>[sSuUbBiItTaA]+)\)?.+?)<' + elif item.args == 'update': + action = 'select' + 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>)' else: patron = r'<div class="col-lg-3">[^>]+>[^>]+>\s<a href="(?P<url>[^"]+)".+?url\((?P<thumb>[^\)]+)\)">[^>]+>[^>]+>[^>]+>(?:[^>]+>)?\s?(?P<rating>[\d\.]+)?[^>]+>(?P<title>[^<]+)<[^>]+>[^>]+>(.?[\d\-x]+\s\(?(?P<lang>[sSuUbBiItTaA\-]+)?\)?\s?(?P<quality>[\w]+)?[|]?\s?(?:[fFiInNeE]+)?\s?\(?(?P<lang2>[sSuUbBiItTaA\-]+)?\)?)?' @@ -63,13 +91,14 @@ def peliculas(item): if item.contentType == 'movie': item.action = 'findvideos' - elif item.args == 'anime' or item.extra == 'search': + elif item.args == 'anime' or item.args == 'update' or item.args == 'search': item.action = 'select' elif item.contentType == 'tvshow': item.extra = 'serie' item.action = 'episodios' else: item.action = 'select' + return item patronNext = r'<a class="next page-numbers".*?href="([^"]+)">' @@ -81,15 +110,21 @@ def episodios(item): # Questa def. deve sempre essere nominata episodios support.log() if item.extra == 'serie': + support.log("Serie :", item) patron = r'(?P<episode>\d+(?:×|×)?\d+\-\d+|\d+(?:×|×)\d+)[;]?[ ]?(?:(?P<title>[^<]+)(?P<url>.*?)|(\2[ ])(?:<(\3.*?)))(?:</a><br />|</a></p>)' patronBlock = r'<p><strong>(?P<block>(?:.+?[Ss]tagione.+?(?P<lang>iTA|ITA|Sub-ITA|Sub-iTA))?(?:|.+?|</strong>)(/?:</span>)?</p>.*?</p>)' - elif item.extra == 'anime': + item.contentType = 'tvshow' + item.contentSerieName = item.fulltitle + elif item.args == 'anime': support.log("Anime :", item) blacklist = ['Clipwatching', 'Verystream', 'Easybytez', 'Flix555'] - patron = r'(?:href="[ ]?(?P<url>[^"]+)"[^>]+>(?P<title>[^<]+))<'#|(?P<episode>\d+(?:×|×)?\d+\-\d+|\d+(?:×|×)\d+)[;]?(?:(\4[^<]+)(\2.*?)|(\2[ ])(?:<(\3.*?)))(?:</a><br />|</a></p>))' + #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)' - + patron = r'<a target=(?P<url>.+?(?:rel="noopener noreferrer">(?P<title>[^<]+)))</a>.+?(?:</a></p>|</a><br />)' + patronBlock = r'Streaming.+?:(?P<block>.*?)</div>' + #patronBlock = r'(?:<p>)?(?P<block>.*?)(?:</a><br /> |</p><div)' + item.contentType = 'tvshow' + item.contentSerieName = item.fulltitle else: support.log('extra = else --- select = ### è un film ###') return findvideos(Item(channel=item.channel, @@ -98,7 +133,7 @@ def episodios(item): # Questa def. deve sempre essere nominata episodios url=item.url, show=item.fulltitle, contentType='movie')) - + debug = True return locals() @support.scrape @@ -116,13 +151,13 @@ def select(item): support.log() data = httptools.downloadpage(item.url, headers=headers).data - #block = scrapertools.find_single_match(data, r'<div class="col-md-8 bg-white rounded-left p-5"><div>(.*?)<\/div>') - block = scrapertoolsV2.find_single_match(data, r'Streaming:(.*?)<\/div>') + block = scrapertoolsV2.find_single_match(data, r'Streaming\s?[\w]+?:(.*?)<\/div>') 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, + contentSerieName = fulltitle, url=item.url, extra='serie', contentType='episode')) @@ -133,8 +168,9 @@ def select(item): return episodios(Item(channel=item.channel, title=item.title, fulltitle=item.fulltitle, + contentSerieName = item.fulltitle, url=item.url, - extra='anime', + args='anime', contentType='episode')) else: support.log('select anime ELSE = ### è un film ###') @@ -155,7 +191,7 @@ def search(item, texto): support.log(item.url,texto) item.url = host + "/?s=" + texto item.contentType = 'episode' - item.extra = 'search' + item.args = 'search' try: return peliculas(item) # Continua la ricerca in caso di errore @@ -165,6 +201,34 @@ def search(item, texto): support.log("%s" % line) return [] +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 + def findvideos(item): support.log('findvideos ->', item) if item.contentType == 'movie': From 0aefe60360b6288b99a6489e5411c4bae86065f0 Mon Sep 17 00:00:00 2001 From: greko17 <sex1712@email.it> Date: Mon, 28 Oct 2019 12:43:15 +0100 Subject: [PATCH 3/5] fix: eurostreaming.py canale completato. da testare --- channels/eurostreaming.json | 2 +- channels/eurostreaming.py | 102 ++++++++++++++++++------------------ 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/channels/eurostreaming.json b/channels/eurostreaming.json index b0bfb328..88d7d021 100644 --- a/channels/eurostreaming.json +++ b/channels/eurostreaming.json @@ -3,7 +3,7 @@ "name": "Eurostreaming", "active": true, "adult": false, - "language": ["ita","vos"], + "language": ["ita","sub-ita"], "thumbnail": "eurostreaming.png", "banner": "eurostreaming.png", "categories": ["tvshow","anime","vos"], diff --git a/channels/eurostreaming.py b/channels/eurostreaming.py index f33812b3..b263da6c 100644 --- a/channels/eurostreaming.py +++ b/channels/eurostreaming.py @@ -4,14 +4,17 @@ # by Greko # ------------------------------------------------------------ """ - Problemi noti: - - Alcune sezioni di anime-cartoni non vanno, alcune hanno solo la lista degli episodi, ma non hanno link, - altre cambiano la struttura + Problemi noti da non considerare come errori nel test: + - Alcune sezioni di anime-cartoni non vanno: + - alcune hanno solo la lista degli episodi, ma non hanno link! + + Novità(globale): + - serie, anime """ import re from core import scrapertoolsV2, httptools, support from core.item import Item -from platformcode import logger, config +from platformcode import config #impostati dinamicamente da findhost() host = "" @@ -32,11 +35,18 @@ list_quality = ['default'] def mainlist(item): support.log() - tvshow = [ - ('Archivio ', ['/category/serie-tv-archive/', 'peliculas', '', 'tvshow']), - ('Aggiornamenti ', ['/aggiornamento-episodi/', 'peliculas', True, 'tvshow']) + tvshow = ['' ] - anime = ['/category/anime-cartoni-animati/'] + + anime = ['/category/anime-cartoni-animati/' + ] + + mix = [ + (support.typo('Aggiornamenti Serie-Anime', 'bullet bold'), ['/aggiornamento-episodi/', 'peliculas', 'newest']), + (support.typo('Archivio Serie-Anime', 'bullet bold'), ['/category/serie-tv-archive/', 'peliculas']) + ] + search = '' + return locals() @@ -45,25 +55,14 @@ def peliculas(item): support.log() action = 'episodios' - - if item.args == True: - patron = r'<span class="serieTitle" style="font-size:20px">(?P<title>.*?)'\ - '.[^–][\s]?<a href="(?P<url>[^"]+)"\s+target="_blank">'\ - '(?P<episode>\d+x\d+-\d+|\d+x\d+) (?P<title2>.*?)[ ]?'\ - '(?:|\((?P<lang>SUB ITA)\))?</a>' -## # permette di vedere episodio e titolo + titolo2 in novità -## # se attivo questo da problemi nell'aggiunta alla videoteca -## def itemHook(item): -## item.show = item.episode + item.title -## return item - + if item.args == 'newest': + #patron = r'<span class="serieTitle" style="font-size:20px">(?P<title>.*?).[^–][\s]?<a href="(?P<url>[^"]+)"\s+target="_blank">(?P<episode>\d+x\d+-\d+|\d+x\d+) (?P<title2>.*?)[ ]?(?:|\((?P<lang>SUB ITA)\))?</a>' + patron = r'<span class="serieTitle" style="font-size:20px">(?P<title>.*?).[^–][\s]?<a href="(?P<url>[^"]+)"\s+target="_blank">(?:<episode>\d+x\d+-\d+|\d+x\d+) .*?[ ]?\(?(?P<lang>SUB ITA)?\)?</a>' else: - patron = r'<div class="post-thumb">.*?\s<img src="(?P<thumb>[^"]+)".*?>'\ - '<a href="(?P<url>[^"]+)".*?>(?P<title>.*?(?:\((?P<year>\d{4})\)'\ - '|(\4\d{4}))?)<\/a><\/h2>' - + patron = r'<div class="post-thumb">.*?\s<img src="(?P<thumb>[^"]+)".*?><a href="(?P<url>[^"]+)"[^>]+>(?P<title>.+?)\s?(?: Serie Tv)?\s?\(?(?P<year>\d{4})?\)?<\/a><\/h2>' patronNext='a class="next page-numbers" href="?([^>"]+)">Avanti »</a>' -## debug = True + + #debug = True return locals() @support.scrape @@ -73,32 +72,33 @@ def episodios(item): action = 'findvideos' item.contentType = 'tvshow' # Carica la pagina - data = httptools.downloadpage(item.url, headers=headers).data.replace("'", '"') + data = pagina(item.url) + data = re.sub('\n|\t', ' ', data) + patronBlock = r'(?P<block>STAGIONE\s\d+ (?:\()?(?P<lang>ITA|SUB ITA)(?:\))?.*?)</div></div>' + patron = r'(?:\s|\Wn)?(?:<strong>|)?(?P<episode>\d+&#\d+;\d+-\d+|\d+&#\d+;\d+)(?:</strong>|)?(?P<title>.+?)(?:–|-.+?-|–.+?–|–|.)?<a (?P<url>.*?)<br />' + return locals() + +def pagina(url): + support.log(url) + + data = httptools.downloadpage(url, headers=headers).data.replace("'", '"') + #support.log("DATA ----###----> ", data) +## if 'class="menu-item menu-item-type-taxonomy menu-item-object-category '\ +## 'current-post-ancestor current-menu-parent current-post-parent menu-item-4529"' in data.lower(): +## item.args = 'anime' if 'clicca qui per aprire' in data.lower(): - item.url = scrapertoolsV2.find_single_match(data, '"go_to":"([^"]+)"') - item.url = item.url.replace("\\","") + url = scrapertoolsV2.find_single_match(data, '"go_to":"([^"]+)"') + url = url.replace("\\","") # Carica la pagina - data = httptools.downloadpage(item.url, headers=headers).data.replace("'", '"') + data = httptools.downloadpage(url, headers=headers).data.replace("'", '"') elif 'clicca qui</span>' in data.lower(): item.url = scrapertoolsV2.find_single_match(data, '<h2 style="text-align: center;"><a href="([^"]+)">') # Carica la pagina - data = httptools.downloadpage(item.url, headers=headers).data.replace("'", '"') + data = httptools.downloadpage(url, headers=headers).data.replace("'", '"') - data = re.sub('\n|\t', ' ', data) - patronBlock = r'(?P<block>STAGIONE\s\d+ (?:\()?(?P<lang>ITA|SUB ITA)(?:\))?.*?)</div></div>' - patron = r'(?:\s|\Wn)?(?:<strong>|)?(?P<episode>\d+&#\d+;\d+-\d+|\d+&#\d+;\d+)'\ - '(?:</strong>|)?(?P<title>.+?)(?:–|-.+?-|–.+?–|–|.)?<a (?P<url>.*?)<br />' - -## debug = True - return locals() - -# =========== def findvideos ============= - -def findvideos(item): - support.log('findvideos', item) - return support.server(item, item.url) + return data # =========== def ricerca ============= def search(item, texto): @@ -113,29 +113,31 @@ def search(item, texto): except: import sys for line in sys.exc_info(): - logger.error("%s" % line) + support.log(line) return [] # =========== def novità in ricerca globale ============= + def newest(categoria): support.log() itemlist = [] item = Item() item.contentType = 'tvshow' - item.args = True + item.args = 'newest' try: item.url = "%s/aggiornamento-episodi/" % host 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(): - logger.error("{0}".format(line)) + support.log("{0}".format(line)) return [] return itemlist + +# =========== def findvideos ============= +def findvideos(item): + support.log('findvideos', item) + return support.server(item, item.url) From 08da626c15f9a6f4beb34f5395703e797b99684c Mon Sep 17 00:00:00 2001 From: Alhaziel <alhaziel01@gmail.com> Date: Mon, 28 Oct 2019 19:06:26 +0100 Subject: [PATCH 4/5] Fix Animeleggendari --- channels/animeleggendari.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/channels/animeleggendari.py b/channels/animeleggendari.py index b753b3e1..f95ecdff 100644 --- a/channels/animeleggendari.py +++ b/channels/animeleggendari.py @@ -15,7 +15,7 @@ headers = [['User-Agent', 'Mozilla/50.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/ list_servers = ['verystream','openload','rapidvideo','streamango'] list_quality = ['default'] - + @support.menu def mainlist(item): @@ -24,7 +24,7 @@ def mainlist(item): ('ITA', ['/category/anime-ita/', 'peliculas']), ('SUB-ITA', ['/category/anime-sub-ita/', 'peliculas']), ('Conclusi', ['/category/serie-anime-concluse/', 'peliculas']), - ('in Corso', ['/category/serie-anime-in-corso/', 'last_ep']), + ('in Corso', ['/category/serie-anime-in-corso/', 'peliculas']), ('Genere', ['', 'genres']) ] @@ -33,7 +33,7 @@ def mainlist(item): def search(item, texto): support.log(texto) - + item.url = host + "/?s=" + texto try: return peliculas(item) @@ -76,7 +76,8 @@ def peliculas(item): @support.scrape def episodios(item): data = support.match(item, headers=headers)[1] - if 'Lista Episodi' not in data: + if not any(x in data for x in ['Lista Episodi', 'Movie Parte']): + support.log('NOT IN DATA') patron = r'(?:iframe src|str)="(?P<url>[^"]+)"' title = item.title def fullItemlistHook(itemlist): @@ -94,11 +95,15 @@ def episodios(item): url = item.url anime = True patronBlock = r'(?:<p style="text-align: left;">|<div class="pagination clearfix">\s*)(?P<block>.*?)</span></a></div>' - patron = r'(?:<a href="(?P<url>[^"]+)"[^>]+>)?<span class="pagelink">(?P<episode>\d+)</span>' + patron = r'(?:<a href="(?P<url>[^"]+)"[^>]+>)?<span class="pagelink">(?P<episode>\d+)' def itemHook(item): if not item.url: item.url = url - item.title = support.typo('Episodio ', 'bold') + item.title + if 'Movie Parte' in data: + item.title = support.typo(item.fulltitle + ' - Part ','bold') + item.title + item.contentType = 'movie' + else: + item.title = support.typo('Episodio ', 'bold') + item.title return item return locals() From acb4243a3ab93e106a8437f701a4f34ff5dfecd5 Mon Sep 17 00:00:00 2001 From: Alhaziel <alhaziel01@gmail.com> Date: Mon, 28 Oct 2019 19:07:12 +0100 Subject: [PATCH 5/5] Fix per il Check autorinumerazione --- core/support.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/support.py b/core/support.py index 7e8aeceb..dd20d3af 100644 --- a/core/support.py +++ b/core/support.py @@ -426,7 +426,7 @@ def scrape(func): if anime: if function == 'episodios' or item.action == 'episodios': autorenumber.renumber(itemlist, item, 'bold') else: autorenumber.renumber(itemlist) - if anime and autorenumber.check(item) == False: + if anime and autorenumber.check(item) == False and not scrapertoolsV2.find_single_match(itemlist[0].title, r'(\d+.\d+)'): pass else: if addVideolibrary and (item.infoLabels["title"] or item.fulltitle):