From 333ecaeb07b643cd7ca78b1afc86edc19be9a56d Mon Sep 17 00:00:00 2001 From: greko17 Date: Sun, 8 Sep 2019 00:45:18 +0200 Subject: [PATCH] fix: altadefinizione01 e support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit il canale è stato aggiornato per il file .json senza valori in settings support modificata la linea 223 altrimenti non prende i gruppi delle regex --- channels/altadefinizione01.json | 55 ++---------------------------- channels/altadefinizione01.py | 60 +++++++++++++++++++-------------- core/support.py | 7 ++-- 3 files changed, 40 insertions(+), 82 deletions(-) diff --git a/channels/altadefinizione01.json b/channels/altadefinizione01.json index ed51566e..927022e4 100644 --- a/channels/altadefinizione01.json +++ b/channels/altadefinizione01.json @@ -1,62 +1,11 @@ { "id": "altadefinizione01", "name": "Altadefinizione01", - "language": ["ita"], + "language": ["ita", "vos"], "active": true, "adult": false, "thumbnail": "https://raw.githubusercontent.com/Zanzibar82/images/master/posters/altadefinizione01.png", "banner": "https://raw.githubusercontent.com/Zanzibar82/images/master/posters/altadefinizione01.png", "categories": ["movie"], - "settings": [ - { - "id": "include_in_global_search", - "type": "bool", - "label": "Includi in Ricerca Globale", - "default": false, - "enabled": false, - "visible": false - }, - { - "id": "include_in_newest_peliculas", - "type": "bool", - "label": "Includi in Novità - Film", - "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 di link da verificare", - "default": 1, - "enabled": true, - "visible": "eq(-1,true)", - "lvalues": [ "5", "10", "15", "20" ] - }, - { - "id": "filter_languages", - "type": "list", - "label": "Mostra link in lingua...", - "default": 0, - "enabled": true, - "visible": true, - "lvalues": ["Non filtrare","IT"] - } - ] + "settings": [] } diff --git a/channels/altadefinizione01.py b/channels/altadefinizione01.py index 3cd9247e..b0b28008 100644 --- a/channels/altadefinizione01.py +++ b/channels/altadefinizione01.py @@ -2,24 +2,28 @@ # ------------------------------------------------------------ # Canale per altadefinizione01 # ------------------------------------------------------------ - - -""" - DA FINIRE - CONTROLLARE - -""" - -##from specials import autoplay -from core import support #,servertools +import xbmc +from core import scrapertoolsV2, httptools, support from core.item import Item from platformcode import config, logger __channel__ = "altadefinizione01" -host = config.get_channel_url(__channel__) +#impostati dinamicamente da findhost() +host = "" +headers = "" -headers = [['User-Agent', 'Mozilla/50.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0'], - ['Referer', host]] +def findhost(): + global host, headers + data = httptools.downloadpage('https://altadefinizione01-nuovo.link/').data + host = scrapertoolsV2.find_single_match(data, '
(?P.*)
' + elif item.args == 'update': + patronBlock = r'
Ultimi Film Aggiunti/Aggiornati
(?P.*?)
' + patron = r'style="background-image:url\((?P[^\)]+).+?

'\ + '(?P.*?)</p>[^>]+> [^>]+> [^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+> '\ + '[^>]+> [^>]+>[^>]+>(?P<year>\d{4})[^>]+>[^>]+> [^>]+>[^>]+>'\ + '(?P<duration>\d+).+?>.*?<p>(?P<plot>[^<]+)<.*?href="(?P<url>[^"]+)' else: patronBlock = r'<div class="cover_kapsul ml-mask">(?P<block>.*)<div class="page_nav">' + patron = r'<div class="cover boxcaption"> <h2>.<a href="(?P<url>[^"]+)">.*?<.*?src="(?P<thumb>[^"]+)"'\ '.+?[^>]+>[^>]+<div class="trdublaj"> (?P<quality>[A-Z/]+)<[^>]+>(?:.[^>]+>(?P<lang>.*?)<[^>]+>).*?'\ '<p class="h4">(?P<title>.*?)</p>[^>]+> [^>]+> [^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+> [^>]+> '\ '[^>]+>[^>]+>(?P<year>\d{4})[^>]+>[^>]+> [^>]+>[^>]+>(?P<duration>\d+).+?>.*?<p>(?P<plot>[^<]+)<' - - patronNext = '<span>\d</span> <a href="([^"]+)">' -## support.regexDbg(item, patron, headers) - + patronNext = '<span>\d</span> <a href="([^"]+)">' + debug = True return locals() @support.scrape def categorie(item): support.log('categorie',item) - + findhost() if item.args != 'orderalf': action = "peliculas" else: action = 'orderalf' blacklist = ['Altadefinizione01'] - if item.args == 'genres': - patronBlock = r'<ul class="kategori_list">(?P<block>.*)<div class="tab-pane fade" id="wtab2">' + patronBlock = r'<ul class="kategori_list">(?P<block>.*?)<div class="tab-pane fade" id="wtab2">' patron = '<li><a href="(?P<url>[^"]+)">(?P<title>.*?)</a>' elif item.args == 'years': - patronBlock = r'<ul class="anno_list">(?P<block>.*)</a></li> </ul> </div>' + patronBlock = r'<ul class="anno_list">(?P<block>.*?)</a></li> </ul> </div>' patron = '<li><a href="(?P<url>[^"]+)">(?P<title>.*?)</a>' elif item.args == 'orderalf': - patronBlock = r'<div class="movies-letter">(?P<block>.*)<div class="clearfix">' + patronBlock = r'<div class="movies-letter">(?P<block>.*?)<div class="clearfix">' patron = '<a title=.*?href="(?P<url>[^"]+)"><span>(?P<title>.*?)</span>' - #support.regexDbg(item, patronBlock, headers) - + + #debug = True return locals() @support.scrape diff --git a/core/support.py b/core/support.py index be31eb1c..28511370 100644 --- a/core/support.py +++ b/core/support.py @@ -197,7 +197,6 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t val = scrapertoolsV2.find_single_match(item.url, 'https?://[a-z0-9.-]+') + val scraped[kk] = val - episode = re.sub(r'\s-\s|-|x|–|×', 'x', scraped['episode']) if scraped['episode'] else '' title = cleantitle(scraped['title']) if scraped['title'] else '' title2 = cleantitle(scraped['title2']) if scraped['title2'] else '' @@ -220,7 +219,8 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t lang = '' # if title is set, probably this is a list of episodes or video sources - if item.infoLabels["title"]: + # necessaria l'aggiunta di == scraped["title"] altrimenti non prende lo scraped dopo le categorie + if item.infoLabels["title"] == scraped["title"]: infolabels = item.infoLabels else: infolabels = {} @@ -253,8 +253,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t if str(scraped['type']).lower() in variants: AC = name else: AC = action - - + if (scraped["title"] not in blacklist) and (search.lower() in longtitle.lower()): it = Item( channel=item.channel,