From 09f00d6c4a9e3c447ee4849428e5c10955e5f71a Mon Sep 17 00:00:00 2001 From: thepasto Date: Fri, 3 May 2019 19:51:06 +0200 Subject: [PATCH] Cineblog01 (#15) * tvshow regex fix, better way to list episodes * tvshow regex fix, better way to list episodes --- channels/cineblog01.py | 54 +++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/channels/cineblog01.py b/channels/cineblog01.py index ec7f3614..0f7ffa92 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -16,6 +16,7 @@ from platformcode import logger, config host = "" headers = "" + def findhost(): global host, headers permUrl = httptools.downloadpage('https://www.cb01.uno/', follow_redirects=False).headers @@ -30,8 +31,10 @@ list_quality = ['HD', 'default'] __comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'cineblog01') __comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'cineblog01') -#esclusione degli articoli 'di servizio' -blacklist = ['BENVENUTI', 'Richieste Serie TV', 'CB01.UNO ▶ TROVA L’INDIRIZZO UFFICIALE ', 'Aggiornamento Quotidiano Serie TV', 'OSCAR 2019 ▶ CB01.UNO: Vota il tuo film preferito! 🎬', 'Openload: la situazione. Benvenuto Verystream'] +# esclusione degli articoli 'di servizio' +blacklist = ['BENVENUTI', 'Richieste Serie TV', 'CB01.UNO ▶ TROVA L’INDIRIZZO UFFICIALE ', + 'Aggiornamento Quotidiano Serie TV', 'OSCAR 2019 ▶ CB01.UNO: Vota il tuo film preferito! 🎬', + 'Openload: la situazione. Benvenuto Verystream'] def mainlist(item): @@ -152,7 +155,7 @@ def peliculas(item): listGroups = ['thumb', 'url', 'title', 'quality', 'year', 'genre', 'duration', 'plot'] action = 'findvideos' else: - patron = r'div class="card-image">.*?([^<[(]+)<\/a>.*?([^<>0-9(]+)\(([0-9]{4}).*?<\/(p|div)>([^<>]+)' + patron = r'div class="card-image">.*?([^<[(]+)<\/a>.*?([^<>0-9(]+)\(([0-9]{4}).*?(.*?)(.*?)<\/article>', - r'
[^<>]*?
(.*?)
\[riduci\]
'], - patron='

([0-9]+(?:×|×)[0-9]+)(.*?)(?:<\/p>|[^<>]*?.*?)

\[riduci\]
') + + for match in matches: + support.log(match) + blocks = scrapertoolsV2.find_multiple_matches(match, '(?:

)(.*?)(?:

|.*?STAGIONE\s+\d+([^<>]+)').strip() + + for block in blocks: + episode = scrapertoolsV2.find_single_match(block, r'([0-9]+(?:×|×)[0-9]+)').strip() + seasons_n = scrapertoolsV2.find_single_match(block, r'STAGIONE\s+\d+([^<>]+)').strip() + + if seasons_n: + season = seasons_n + + if not episode: continue + + season = re.sub(r'–|–', "-", season) + itemlist.append( + Item(channel=item.channel, + action="findvideos", + contentType=item.contentType, + title="[B]" + episode + "[/B] " + season, + fulltitle=episode + " " + season, + show=episode + " " + season, + url=block, + extra=item.extra, + thumbnail=item.thumbnail, + infoLabels=item.infoLabels + )) + + support.videolibrary(itemlist, item) + + return itemlist def findvideos(item): @@ -177,7 +214,7 @@ def findvideos(item): def load_links(itemlist, re_txt, color, desc_txt, quality=""): streaming = scrapertoolsV2.find_single_match(data, re_txt).replace('"', '') - support.log('STREAMING=',streaming) + support.log('STREAMING=', streaming) patron = ']+>([^<]+)<' matches = re.compile(patron, re.DOTALL).findall(streaming) for scrapedurl, scrapedtitle in matches: @@ -253,7 +290,7 @@ def findvid_serie(item): def load_vid_series(html, item, itemlist, blktxt): logger.info('HTML' + html) patron = ']+>(.*?)' - # Estrae i contenuti + # Estrae i contenuti matches = re.compile(patron, re.DOTALL).finditer(html) for match in matches: scrapedurl = match.group(1) @@ -310,6 +347,7 @@ def findvid_serie(item): return itemlist + def play(item): support.log() itemlist = []