From 29ad20dd6ffa0a14206bbf1b778faeb2683cdb08 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Tue, 7 Jul 2020 19:18:06 +0200 Subject: [PATCH] aggiustamenti La7 --- channels/la7.py | 50 ++++++++++++++++++++++++++++++++++--------------- core/support.py | 5 +++-- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/channels/la7.py b/channels/la7.py index 5d764ffd..bc8386f9 100644 --- a/channels/la7.py +++ b/channels/la7.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------ -# Canale per Mediaset Play +# Canale per La7 # ------------------------------------------------------------ import requests @@ -37,13 +37,14 @@ def mainlist(item): ('Replay {bold}', ['', 'replay_channels'])] menu = [('Programmi TV {bullet bold}', ['/tutti-i-programmi', 'peliculas', '', 'tvshow']), + # ('Teche La7 {bullet bold}', ['/i-protagonisti', 'peliculas', '', 'tvshow']) # ('Fiction / Serie TV {bullet bold}', ['5acfcb3c23eec6000d64a6a4', 'menu', ['Tutte','all','Fiction'], 'tvshow']), # ('Programmi TV{ bullet bold}', ['', 'menu', ['Tutti','all','Programmi Tv'], 'tvshow']), # ('Documentari {bullet bold}', ['5bfd17c423eec6001aec49f9', 'menu', ['Tutti','all','Documentari'], 'undefined']), # ('Kids {bullet bold}', ['5acfcb8323eec6000d64a6b3', 'menu',['Tutti','all','Kids'], 'undefined']), ] - # search = '' + search = '' return locals() @@ -52,11 +53,13 @@ def live(item): item.clone(title='La7d', url= host + '/live-la7d', action='play', forcethumb = True, thumbnail= icons['la7d'])] return itemlist + def replay_channels(item): itemlist = [item.clone(title='La7', url= host + '/rivedila7/0/la7', action='replay_menu', forcethumb = True, thumbnail= icons['la7']), item.clone(title='La7d', url= host + '/rivedila7/0/la7d', action='replay_menu', forcethumb = True, thumbnail= icons['la7d'])] return itemlist + @support.scrape def replay_menu(item): action = 'replay' @@ -66,6 +69,7 @@ def replay_menu(item): return item return locals() + @support.scrape def replay(item): action = 'play' @@ -79,35 +83,51 @@ def replay(item): return item return locals() +def search(item, text): + item.url = host + '/tutti-i-programmi' + item.search = text + return peliculas(item) + @support.scrape def peliculas(item): - pagination = 40 + search = item.search + disabletmdb = True action = 'episodios' - patron = r']+>
\s*(?P[^<]+)<' + patron = r'<a href="(?P<url>[^"]+)"[^>]+><div class="[^"]+" data-background-image="(?P<t>[^"]+)"></div><div class="titolo">\s*(?P<title>[^<]+)<' + def itemHook(item): + item.thumbnail = 'http:' + item.t if item.t.startswith('//') else item.t if item.t else item.thumbnail + item.fanart = item.thumb + return item return locals() + @support.scrape def episodios(item): data = support.match(item).data - # debug=True action = 'play' - if 'ultima puntata' in data: - patron = r'<a href="(?P<url>[^"]+)"><div class="[^"]+" data-background-image="(?P<thumb>[^"]+)">[^>]+>[^>]+>[^>]+><div class="title_puntata">\s*(?P<title>[^<]+)' + if '>puntate<' in data: + patronBlock = r'>puntate<(?P<block>.*?)home-block-outbrain' + url = support.match(data, patron=r'>puntate<[^>]+>[^>]+>[^>]+><a href="([^"]+)"').match + data += support.match(host + url).data else: item.url += '/video' data = support.match(item).data - patron = r'<a href="(?P<url>[^"]+)"><[^>]+><div class="[^"]+" data-background-image="(?P<thumb>[^"]+)"><[^>]+><[^>]+><[^>]+><[^>]+>(?P<title>[^<]+)' - patronNext = r'<a href="([^"]+)">›' + + patron = r'<a href="(?P<url>[^"]+)">[^>]+><div class="[^"]+" data-background-image="(?P<t>[^"]*)">[^>]+>[^>]+>[^>]+>(?:[^>]+>)?(?:[^>]+>)?\s*(?P<title>[^<]+)<(?:[^>]+>[^>]+>[^>]+><div class="data">(?P<date>[^<]+))?' + patronNext = r'<a href="([^"]+)">›' addVideolibrary = False + + def itemHook(item): + item.thumbnail = 'http:' + item.t if item.t.startswith('//') else item.t if item.t else item.thumbnail + if item.date: + item.title = support.re.sub(r'[Pp]untata (?:del )?\d+/\d+/\d+', '', item.title) + item.title += support.typo(item.date, '_ [] bold') + item.forcethumb = True + item.fanart = item.thumbnail + return item return locals() -def findvideos(item): - url = 'https://awsvodpkg.iltrovatore.it/local/hls/,/content/entry/data/' + support.match(item, patron='/content/entry/data/(.*?).mp4').match + '.mp4.urlset/master.m3u8' - itemlist = [item.clone(title='Direct', url=url, server='directo', action='play')] - return support.server(item, itemlist=itemlist, Download=False) - - def play(item): support.log() data = support.match(item).data diff --git a/core/support.py b/core/support.py index 2e5ac8c9..6f45f32b 100755 --- a/core/support.py +++ b/core/support.py @@ -352,7 +352,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t quality=quality, url=scraped["url"], infoLabels=infolabels, - thumbnail=item.thumbnail if function == 'episodios' or not scraped["thumb"] else scraped["thumb"], + thumbnail=item.thumbnail if not scraped["thumb"] else scraped["thumb"], args=item.args, contentSerieName= title if 'movie' not in [contentType] and function != 'episodios' else item.contentSerieName, contentTitle= title if 'movie' in [contentType] and function == 'peliculas' else item.contentTitle, @@ -429,6 +429,7 @@ def scrape(func): typeContentDict = args['typeContentDict'] if 'typeContentDict' in args else {} debug = args['debug'] if 'debug' in args else False debugBlock = args['debugBlock'] if 'debugBlock' in args else False + disabletmdb = args['disabletmdb'] if 'disabletmdb' in args else False if 'pagination' in args and inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes']: pagination = args['pagination'] if args['pagination'] else 20 else: pagination = '' lang = args['deflang'] if 'deflang' in args else '' @@ -506,7 +507,7 @@ def scrape(func): page=pag + 1, thumbnail=thumb())) - if action != 'play' and function != 'episodios' and 'patronMenu' not in args and item.contentType in ['movie', 'tvshow', 'episode']: + if action != 'play' and function != 'episodios' and 'patronMenu' not in args and item.contentType in ['movie', 'tvshow', 'episode'] and not disabletmdb: tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) if anime: