From 5edd305d3731559c8bca288e00ea7149256994fe Mon Sep 17 00:00:00 2001 From: greko17 Date: Sun, 4 Aug 2019 11:48:01 +0200 Subject: [PATCH] decorato eurostreaming, e modifiche a support e fix a strings per far funzionare il canale eurostreaming ho dovuto apportare modifiche a support.py --- channels/eurostreaming.json | 10 +--- channels/eurostreaming.py | 85 +++++++++++++-------------- core/support.py | 73 ++++++++++++----------- resources/language/Italian/strings.po | 6 +- 4 files changed, 86 insertions(+), 88 deletions(-) diff --git a/channels/eurostreaming.json b/channels/eurostreaming.json index 3fb5ddf3..333298d4 100644 --- a/channels/eurostreaming.json +++ b/channels/eurostreaming.json @@ -7,15 +7,7 @@ "thumbnail": "https://eurostreaming.cafe/wp-content/uploads/2017/08/logocafe.png", "bannermenu": "https://eurostreaming.cafe/wp-content/uploads/2017/08/logocafe.png", "categories": ["tvshow","anime","vosi"], - "settings": [ - { - "id": "channel_host", - "type": "text", - "label": "Host del canale", - "default": "https://eurostreaming.cafe", - "enabled": true, - "visible": true - }, + "settings": [ { "id": "include_in_global_search", "type": "bool", diff --git a/channels/eurostreaming.py b/channels/eurostreaming.py index b350f537..d007fdda 100644 --- a/channels/eurostreaming.py +++ b/channels/eurostreaming.py @@ -18,7 +18,7 @@ from platformcode import logger, config __channel__ = "eurostreaming" host = config.get_channel_url(__channel__) -headers = ['Referer', host] +headers = [['Referer', host]] list_servers = ['verystream', 'wstream', 'speedvideo', 'flashx', 'nowvideo', 'streamango', 'deltabit', 'openload'] list_quality = ['default'] @@ -29,47 +29,44 @@ checklinks_number = config.get_setting('checklinks_number', 'cineblog01') IDIOMAS = {'Italiano': 'ITA', 'Sub-ITA':'vosi'} list_language = IDIOMAS.values() +@support.menu def mainlist(item): - #import web_pdb; web_pdb.set_trace() - support.log() - itemlist = [] + support.log() - support.menu(itemlist, 'Serie TV', 'serietv', host, contentType = 'tvshow') # mettere sempre episode per serietv, anime!! - ('Serie TV Archivio ', ["/category/serie-tv-archive/", 'serietv', ]), contentType = 'tvshow') - ('Ultimi Aggiornamenti ', ['/aggiornamento-episodi/', 'serietv', ]), args='True', contentType = 'tvshow') - support.menu(itemlist, 'Anime / Cartoni', 'serietv', host + '/category/anime-cartoni-animati/', contentType = 'tvshow') + tvshow = [ +## ('tvshow', [ '', 'peliculas', '', 'tvshow']), # mettere sempre episode per serietv, anime!! + ('Archivio ', ['/category/serie-tv-archive/', 'peliculas', '', 'tvshow']), + ('Aggiornamenti ', ['/aggiornamento-episodi/', 'peliculas', True, 'tvshow']) + ] + anime =[ + ('Anime / Cartoni', ['/category/anime-cartoni-animati/','peliculas', '', 'tvshow']) + ] - -## itemlist = filtertools.show_option(itemlist, item.channel, list_language, list_quality) - # autoplay - support.aplay(item, itemlist, list_servers, list_quality) - # configurazione canale - support.channel_config(item, itemlist) - - return itemlist + return locals() +#### itemlist = filtertools.show_option(itemlist, item.channel, list_language, list_quality) +## # autoplay +## support.aplay(item, itemlist, list_servers, list_quality) +## # configurazione canale +## support.channel_config(item, itemlist) +## +## return itemlist @support.scrape -def serietv(item): +def peliculas(item): ## import web_pdb; web_pdb.set_trace() support.log() - itemlist = [] - if item.args: - #patron = r'(.*?).[^–](.*?)<\/a>' -## # DA SISTEMARE - problema: mette tutti gli episodi in sub-ita -## patron = r'(.*?).[^–](\d+x\d+) (.*?)(?:|\((.+?)\))' - patron = r'(.*?).[^–](\d+x\d+) (.*?)' - listGroups = ['title', 'url', 'episode', 'title2'] - patronNext = '' + if item.args == True: + patron = r'(?P.*?).[^–]<a href="(?P<url>[^"]+)"'\ + '\s+target="_blank">(?P<episode>\d+x\d+) (?P<title2>.*?)</a>' - # permette di vedere episodio e titolo + titolo2 in novità - def itemHook(item): - item.show = item.episode + item.title - return item +## # permette di vedere episodio e titolo + titolo2 in novità +## def itemHook(item): +## item.show = item.episode + item.title +## return item else: - patron = r'<div class="post-thumb">.*?\s<img src="([^"]+)".*?><a href="([^"]+)".*?>(.*?(?:\((\d{4})\)|(\d{4}))?)<\/a><\/h2>' - listGroups = ['thumb', 'url', 'title', 'year', 'year'] + 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>' + patronNext='a class="next page-numbers" href="?([^>"]+)">Avanti »</a>' action='episodios' @@ -94,11 +91,13 @@ def episodios(item): # Carica la pagina data = httptools.downloadpage(item.url).data #========= - patron = r'(?:<\/span>\w+ STAGIONE\s\d+ (?:\()?(ITA|SUB ITA)(?:\))?<\/div>'\ +## patron = r'(?:<\/span>\w+ STAGIONE\s\d+ (?:\()?(?P<lang>ITA|SUB ITA)(?:\))?<\/div>'\ +## '<div class="su-spoiler-content su-clearfix" style="display:none">|'\ +## '(?:\s|\Wn)?(?:<strong>)?(?P<title>\d+&#.*?)(?:|–)?<a\s(?P<url>.*?)<\/a><br\s\/>)' + patron = r'(?:<\/span>\w+ STAGIONE\s\d+ (?:\()?(?P<lang>ITA|SUB ITA)(?:\))?<\/div>'\ '<div class="su-spoiler-content su-clearfix" style="display:none">|'\ - '(?:\s|\Wn)?(?:<strong>)?(\d+&#.*?)(?:|–)?<a\s(.*?)<\/a><br\s\/>)' - - listGroups = ['lang', 'title', 'url'] + '(?:\s|\Wn)?(?:|<strong>)?(?P<episode>\d+&#\d+;\d+)(?:|</strong>) '\ + '(?P<title>.*?)(?:|–)?<a\s(?P<url>.*?)<\/a><br\s\/>)' action = 'findvideos' return locals() @@ -114,7 +113,7 @@ def search(item, texto): support.log() item.url = "%s/?s=%s" % (host, texto) try: - return serietv(item) + return peliculas(item) # Continua la ricerca in caso di errore except: import sys @@ -127,14 +126,14 @@ def newest(categoria): support.log() itemlist = [] item = Item() - item.contentType= 'episode' - item.args= 'True' + item.contentType = 'episode' + item.args = True try: item.url = "%s/aggiornamento-episodi/" % host - item.action = "serietv" - itemlist = serietv(item) + item.action = "peliculas" + itemlist = peliculas(item) - if itemlist[-1].action == "serietv": + if itemlist[-1].action == "peliculas": itemlist.pop() # Continua la ricerca in caso di errore diff --git a/core/support.py b/core/support.py index 4439bf73..1dbc78a3 100644 --- a/core/support.py +++ b/core/support.py @@ -251,7 +251,12 @@ def scrape(func): val = scrapertoolsV2.find_single_match(item.url, 'https?://[a-z0-9.-]+') + val scraped[kk] = val - title = scrapertoolsV2.htmlclean(scrapertoolsV2.decodeHtmlentities(scraped["title"]).replace('"',"'").replace('×', 'x').replace('–','-')).strip() # fix by greko da " a ' + if scraped['title']: + title = scrapertoolsV2.htmlclean(scrapertoolsV2.decodeHtmlentities(scraped['title']) + .replace('"',"'").replace('×', 'x').replace('–','-')).strip() # fix by greko da " a ' + else: + title = '' + plot = scrapertoolsV2.htmlclean(scrapertoolsV2.decodeHtmlentities(scraped["plot"])) longtitle = typo(title, 'bold') @@ -260,7 +265,8 @@ def scrape(func): scraped['episode'] = re.sub(r'\s-\s|-|x|–', 'x', scraped['episode']) longtitle = typo(scraped['episode'] + ' - ', 'bold') + longtitle if scraped['title2']: - title2 = scrapertoolsV2.htmlclean(scrapertoolsV2.decodeHtmlentities(scraped["title2"]).replace('"', "'").replace('×', 'x').replace('–','-')).strip() + title2 = scrapertoolsV2.htmlclean(scrapertoolsV2.decodeHtmlentities(scraped['title2']) + .replace('"', "'").replace('×', 'x').replace('–','-')).strip() longtitle = longtitle + typo(title2, 'bold _ -- _') ## Aggiunto/modificato per gestire i siti che hanno i video @@ -278,20 +284,20 @@ def scrape(func): infolabels = item.infoLabels else: infolabels = {} - if scraped["year"]: - infolabels['year'] = scraped["year"] + if scraped['year']: + infolabels['year'] = scraped['year'] if scraped["plot"]: infolabels['plot'] = plot - if scraped["duration"]: - matches = scrapertoolsV2.find_multiple_matches(scraped["duration"], + if scraped['duration']: + matches = scrapertoolsV2.find_multiple_matches(scraped['duration'], r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)') for h, m in matches: - scraped["duration"] = int(h) * 60 + int(m) + scraped['duration'] = int(h) * 60 + int(m) if not matches: - scraped["duration"] = scrapertoolsV2.find_single_match(scraped["duration"], r'(\d+)') - infolabels['duration'] = int(scraped["duration"]) * 60 - if scraped["genere"]: - genres = scrapertoolsV2.find_multiple_matches(scraped["genere"], '[A-Za-z]+') + scraped['duration'] = scrapertoolsV2.find_single_match(scraped['duration'], r'(\d+)') + infolabels['duration'] = int(scraped['duration']) * 60 + if scraped['genere']: + genres = scrapertoolsV2.find_multiple_matches(scraped['genere'], '[A-Za-z]+') infolabels['genere'] = ", ".join(genres) if scraped["rating"]: infolabels['rating'] = scrapertoolsV2.decodeHtmlentities(scraped["rating"]) @@ -304,29 +310,30 @@ def scrape(func): for name, variants in typeActionDict.items(): if scraped['type'] in variants: action = name - - if scraped["title"] not in blacklist: - it = Item( - channel=item.channel, - action=action, - contentType= 'episode' if (action == 'findvideos' and item.contentType == 'tvshow') else item.contentType, - title=longtitle, - fulltitle=item.fulltitle if (action == 'findvideos' and item.contentType != 'movie') else title, - show=item.show if (action == 'findvideos' and item.contentType != 'movie') else title, - quality=scraped["quality"], - url=scraped["url"], - infoLabels=infolabels, - thumbnail=scraped["thumb"], - args=item.args, - contentSerieName = title if (action == 'episodios' and item.contentType != 'movie') else '' - ) - - for lg in list(set(listGroups).difference(known_keys)): - it.__setattr__(lg, match[listGroups.index(lg)]) - if 'itemHook' in args: - it = args['itemHook'](it) - itemlist.append(it) + if scraped["title"]: + if scraped["title"] not in blacklist: + it = Item( + channel=item.channel, + action=action, + contentType= 'episode' if (action == 'findvideos' and item.contentType == 'tvshow') else item.contentType, + title=longtitle, + fulltitle=item.fulltitle if (action == 'findvideos' and item.contentType != 'movie') else title, + show=item.show if (action == 'findvideos' and item.contentType != 'movie') else title, + quality=scraped["quality"], + url=scraped["url"], + infoLabels=infolabels, + thumbnail=scraped["thumb"], + args=item.args, + contentSerieName = title if (action == 'episodios' and item.contentType != 'movie') else '' + ) + + for lg in list(set(listGroups).difference(known_keys)): + it.__setattr__(lg, match[listGroups.index(lg)]) + + if 'itemHook' in args: + it = args['itemHook'](it) + itemlist.append(it) checkHost(item, itemlist) if (item.contentType == "tvshow" and (action != "findvideos" and action != "play")) \ diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index 44200747..91e9ecf6 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -5587,12 +5587,12 @@ msgstr "Non riesco a trovare automaticamente il numero dell'episodio speciale, p msgctxt "#70720" msgid "Dear User\n,You are currently not connected to any modem/router. You cannot access KOD because the channels will not be reachable! We advise you to check at least that the modem/router is switched on and/or your device is connected.\n" -msgstr "Gentile Utente,\nAttualmente non risulti connesso a nessun modem/router.\nNON POTRAI ACCEDERE A KOD!\npoichè i canali non saranno raggiungibili, finchè non risolverai il problema. Ti consigliamo di controllare quanto meno che il modem/router sia acceso e/o il tuo dispositivo connesso.\n" +msgstr "Gentile Utente,\nAttualmente non risulti connesso a nessun Modem/Router.\nNON POTRAI ACCEDERE A KOD!\npoichè i canali non saranno raggiungibili, finchè non risolverai il problema. Controlla quanto meno che il modem/router sia acceso e/o il tuo dispositivo connesso.\n" msgctxt "#70721" msgid "Dear user, you seem to have problems with ADSL! You cannot access KOD because the channels will not be accessible! We suggest you call your manager's toll-free number or check it out at least that the modem/router is on and/or your device is connected." -msgstr "Gentile Utente, sembra tu abbia problemi con l'ADSL! Non puoi accedere a KOD poichè i canali non saranno raggiungibili! Ti consigliamo di chiamare il numero verde del tuo gestore o di controllare quanto meno che il modem/router sia acceso e/o il tuo dispositivo connesso." +msgstr "Gentile Utente, sembra tu abbia problemi con l'ADSL! NON POTRAI ACCEDERE A KOD!\npoichè i canali non saranno raggiungibili, finchè non risolverai il problema. Controlla quanto meno che il modem/router sia acceso e/o il tuo dispositivo connesso." msgctxt "#70722" msgid "Dear User, your current DNS do not allow you to reach all ergo sites, not all Channels will work. We recommend that you set up your DNS to take advantage of more channels. Search your favorite search engine how to set them up on your device." -msgstr "Gentile Utente, i tuoi DNS attuali non ti permettono di raggiungere tutti i siti, ergo, non tutti i Canali funzioneranno. Ti consigliamo per usufruire di un maggior numero di canali, di impostare i DNS. Cerca sul tuo motore di ricerca preferito come impostarli sul tuo dispositivo." +msgstr "Gentile Utente, i tuoi DNS attuali non ti permettono di raggiungere tutti i siti, ergo, non tutti i Canali funzioneranno. Ti consigliamo, per usufruire di un maggior numero di canali, di impostare i DNS. Cerca sul tuo motore di ricerca preferito come impostarli sul tuo dispositivo."