diff --git a/channels/filmigratis.json b/channels/filmigratis.json index b6f56db2..46290f5b 100644 --- a/channels/filmigratis.json +++ b/channels/filmigratis.json @@ -3,68 +3,34 @@ "name": "Filmi Gratis", "active": true, "adult": false, - "language": ["ita"], + "language": ["ita", "sub-ita"], "thumbnail": "filmigratis.png", "banner": "filmigratis.png", - "categories": ["movie","tvshow"], + "categories": ["movie","tvshow"], "settings": [ - { - "id": "include_in_global_search", - "type": "bool", - "label": "Includi ricerca globale", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_peliculas", - "type": "bool", - "label": "Includi in Novità - Film", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_series", - "type": "bool", - "label": "Includi in Novità - Serie TV", - "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 de link da verificare", - "default": 1, - "enabled": true, - "visible": "eq(-1,true)", - "lvalues": [ "1", "2", "5", "10" ] - }, - { - "id": "filter_languages", - "type": "list", - "label": "Mostra link in lingua...", - "default": 0, - "enabled": true, - "visible": true, - "lvalues": ["Non filtrare","IT"] - } + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "@70727", + "default": false, + "enabled": false, + "visible": false + }, + { + "id": "include_in_newest_series", + "type": "bool", + "label": "@70727", + "default": false, + "enabled": false, + "visible": false + }, + { + "id": "include_in_newest_anime", + "type": "bool", + "label": "@70727", + "default": false, + "enabled": false, + "visible": false + } ] } diff --git a/channels/filmigratis.py b/channels/filmigratis.py index 53f3549e..a40c92aa 100644 --- a/channels/filmigratis.py +++ b/channels/filmigratis.py @@ -2,293 +2,156 @@ # ------------------------------------------------------------ # Canale per Filmi Gratis # ------------------------------------------------------------ +""" + La voce "Al cinema" si riferisce ai titoli che scorrono nella home page + + Problemi: + - Nessuno noto + + Novità, il canale, è presente in: + - FILM +""" import re -from core import scrapertools, servertools, httptools, tmdb, support +from core import servertools, httptools, support from core.item import Item -from platformcode import logger, config -from specials import autoplay +from platformcode import config __channel__ = 'filmigratis' host = config.get_channel_url(__channel__) -IDIOMAS = {'Italiano': 'IT'} -list_language = IDIOMAS.values() -list_servers = ['openload', 'streamango', 'vidoza', 'okru'] -list_quality = ['1080p', '720p', '480p', '360'] -checklinks = config.get_setting('checklinks', 'filmigratis') -checklinks_number = config.get_setting('checklinks_number', 'filmigratis') +list_servers = ['verystream', 'openload', 'streamango', 'vidoza', 'okru'] +list_quality = ['1080p', '720p', '480p', '360'] headers = [['Referer', host]] -#----------------------------------------------------------------------------------------------------------------------- + @support.menu def mainlist(item): film = [ - ('Al Cinema ', ['', 'carousel']), - ('Film alta definizione', ['', 'peliculas']), - ('Categorie', ['', 'categorias_film']), + ('Al Cinema ', ['', 'peliculas', 'cinema']), + ('Categorie', ['', 'genres', 'genres']), ] - tvshow = [ - ('Categorie', ['', 'categorias_serie']) + + tvshow = ['/serie/ALL', + ('Generi', ['', 'genres', 'genres']) ] + search = '' + return locals() + +@support.scrape +def peliculas(item): + support.log() + + if item.args == 'search': + action = '' + patron = r'
.*?src="([^"]+)"[^>]+>[^>]+>[^>]+>\s+(?P.+?)(?:\[(?P<lang>Sub-ITA|SUB-ITA|SUB)\])?\s?(?:\[?(?P<quality>HD).+\]?)?\s?(?:\(?(?P<year>\d+)?\)?)?\s+<[^>]+>[^>]+>[^>]+>\s<a href="(?P<url>[^"]+)"[^<]+<' + patronBlock = r'<div class="container">(?P<block>.*?)</main>' + elif item.contentType == 'movie': + if not item.args: + # voce menu: Film + patronBlock = r'<h1>Film streaming ita in alta definizione</h1>(?P<block>.*?)<div class="content-sidebar">' + patron = r'<div class="timeline-right">[^>]+>\s<a href="(?P<url>.*?)".*?src="(?P<thumb>.*?)".*?<h3 class="timeline-post-title">(?:(?P<title>.+?)\s\[?(?P<lang>Sub-ITA)?\]?\s?\[?(?P<quality>HD)?\]?\s?\(?(?P<year>\d+)?\)?)<' + patronNext = r'<a class="page-link" href="([^"]+)">>' + elif item.args == 'cinema': + patronBlock = r'<div class="owl-carousel" id="postCarousel">(?P<block>.*?)<section class="main-content">' + patron = r'background-image: url\((?P<thumb>.*?)\).*?<h3.*?>(?:(?P<title>.+?)\s\[?(?P<lang>Sub-ITA)?\]?\s?\[?(?P<quality>HD)?\]?\s?\(?(?P<year>\d+)?\)?)<.+?<a.+?<a href="(?P<url>[^"]+)"[^>]+>' + elif item.args == 'genres': + # ci sono dei titoli dove ' viene sostituito con " da support + data = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data + data = re.sub('\n|\t', ' ', data) + patron = r'<div class="cnt">\s.*?src="([^"]+)".+?title="((?P<title>.+?)(?:[ ]\[(?P<lang>Sub-ITA|SUB-ITA)\])?(?:[ ]\[(?P<quality>.*?)\])?(?:[ ]\((?P<year>\d+)\))?)"\s*[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s+<a href="(?P<url>[^"]+)"' + patronBlock = r'<div class="container">(?P<block>.*?)</main>' + pagination = '' + + patronNext = '<a class="page-link" href="([^"]+)">>>' + else: + action = 'episodios' + patron = r'<div class="cnt">\s.*?src="([^"]+)".+?title="((?P<title>.+?)(?:[ ]\[(?P<lang>Sub-ITA|SUB-ITA)\])?(?:[ ]\[(?P<quality>.*?)\])?(?:[ ]\((?P<year>\d+)\))?)"\s*[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s+<a href="(?P<url>[^"]+)"' +## if item.args == 'search': +## patron = r'<div class="cnt">.*?src="([^"]+)".+?[^>]+>[^>]+>[^>]+>\s+((?P<title>.+?)(?:[ ]\[(?P<lang>Sub-ITA|SUB-ITA)\])?(?:[ ]\[(?P<quality>.*?)\])?(?:[ ]\((?P<year>\d+)\))?)\s+<[^>]+>[^>]+>[^>]+>[ ]<a href="(?P<url>[^"]+)"' + patronBlock = r'<div class="container">(?P<block>.*?)</main>' + + def itemHook(item): + if item.args == 'search': + if 'series' in item.url: + item.action = 'episodios' + item.contentType = 'tvshow' + else: + item.action = 'findvideos' + item.contentType = 'movie' + return item + + #debug = True + return locals() + + +@support.scrape +def episodios(item): + support.log() + + action = 'findvideos' + patronBlock = r'<div class="row">(?P<block>.*?)<section class="main-content">' + patron = r'href="(?P<url>.*?)">(?:.+?)?\s+S(?P<season>\d+)\s\-\sEP\s(?P<episode>\d+)[^<]+<' + return locals() -#----------------------------------------------------------------------------------------------------------------------- - -def carousel(item): - logger.info('[filmigratis.py] carousel') - itemlist = [] - - data = httptools.downloadpage(item.url, headers=headers).data - - blocco = scrapertools.find_single_match(data, r'<div class="owl-carousel" id="postCarousel">(.*?)<section class="main-content">') - - patron = r'background-image: url\((.*?)\).*?<h3.*?>(.*?)<.*?<a.*?<a href="(.*?)"' - matches = re.compile(patron, re.DOTALL).findall(blocco) - - for scrapedthumb, scrapedtitle, scrapedurl, in matches: - itemlist.append( - Item(channel=item.channel, - action = "findvideos", - contentType = item.contentType, - title = scrapedtitle, - fulltitle = scrapedtitle, - url = scrapedurl, - thumbnail = scrapedthumb, - args=item.args, - show = scrapedtitle,)) - return itemlist - -#----------------------------------------------------------------------------------------------------------------------- - -def peliculas(item): - logger.info('[filmigratis.py] peliculas') - itemlist = [] - - data = httptools.downloadpage(item.url, headers=headers).data - - blocco = scrapertools.find_single_match(data, r'<h1>Film streaming ita in alta definizione</h1>(.*?)<div class="content-sidebar">') - - patron = r'<div class="timeline-left-wrapper">.*?<a href="(.*?)".*?src="(.*?)".*?<h3.*?>(.*?)<' - matches = re.compile(patron, re.DOTALL).findall(blocco) - - for scrapedurl, scrapedthumb, scrapedtitle, in matches: - itemlist.append( - Item(channel=item.channel, - action = "findvideos", - contentType = item.contentType, - title = scrapedtitle, - fulltitle = scrapedtitle, - url = scrapedurl, - thumbnail = scrapedthumb, - args=item.args, - show = scrapedtitle)) - - patron = r'class="nextpostslink".*?href="(.*?)"' - next_page = scrapertools.find_single_match(data, patron) - - if next_page != "": - itemlist.append( - Item(channel=item.channel, - action="peliculas", - title="[B]" + config.get_localized_string(30992) + "[/B]", - args=item.args, - url=next_page)) - - return itemlist - -#----------------------------------------------------------------------------------------------------------------------- - -def categorias_film(item): - logger.info("[filmigratis.py] categorias_film") - itemlist = [] - - data = httptools.downloadpage(item.url, headers=headers).data - bloque = scrapertools.find_single_match(data, 'CATEGORIES.*?<ul>(.*?)</ul>') - - patron = '<a href="(.*?)">(.*?)<' - matches = re.compile(patron, re.DOTALL).findall(bloque) - - for scrapedurl, scrapedtitle in matches: - itemlist.append( - Item(channel=__channel__, - action="peliculas_categorias", - title="[COLOR azure]" + scrapedtitle + "[/COLOR]", - url=scrapedurl, - args=item.args, - thumbnail="")) - - return itemlist -#----------------------------------------------------------------------------------------------------------------------- - -def categorias_serie(item): - logger.info("[filmigratis.py] categorias_serie") - itemlist = [] - - data = httptools.downloadpage(item.url, headers=headers).data - bloque = scrapertools.find_single_match(data, 'class="material-button submenu-toggle"> SERIE TV.*?<ul>.*?</li>(.*?)</ul>') - - patron = '<a href="(.*?)">(.*?)<' - matches = re.compile(patron, re.DOTALL).findall(bloque) - - for scrapedurl, scrapedtitle in matches: - itemlist.append( - Item(channel=__channel__, - contentType='tvshow', - action="peliculas_serie", - title="[COLOR azure]" + scrapedtitle + "[/COLOR]", - url=scrapedurl, - args=item.args, - thumbnail="")) - - return itemlist - -#----------------------------------------------------------------------------------------------------------------------- - -def peliculas_categorias(item): - logger.info("[filmigratis.py] peliculas_categorias") - itemlist = [] - - data = httptools.downloadpage(item.url, headers=headers).data - - patron = r'<div class="cnt">.*?src="(.*?)".*?title="([A-Z|0-9].*?)".*?<a href="(.*?)"' - matches = re.compile(patron, re.DOTALL).findall(data) - - for scrapedthumb, scrapedtitle, scrapedurl in matches: - if scrapedtitle == "": - scrapedtitle = scrapertools.find_single_match(data, r'<small>.*?([A-Z|0-9].*?) <') - scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle) - scrapedtitle = scrapedtitle.replace ("È","È") - scrapedtitle = scrapedtitle.replace("–", "-") - scrapedtitle = scrapedtitle.replace("’", "'") - itemlist.append( - Item(channel=item.channel, - action="findvideos", - contentType=item.contentType, - title=scrapedtitle, - fulltitle=scrapedtitle, - url=scrapedurl, - thumbnail=scrapedthumb, - args=item.args, - show=scrapedtitle)) - - tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) - return itemlist - -#----------------------------------------------------------------------------------------------------------------------- - -def peliculas_serie(item): - logger.info("[filmigratis.py] peliculas_serie") - itemlist = [] - - data = httptools.downloadpage(item.url, headers=headers).data - - patron = r'div class="cnt">[^s]+src="([^"]+).*?small>\s+[^A-Z](.*?)<.*?<a href="([^"]+)' - matches = re.compile(patron, re.DOTALL).findall(data) - - for scrapedthumb, scrapedtitle, scrapedurl in matches: - if scrapedtitle == "": - scrapedtitle = scrapertools.find_single_match(data, r'<small>.*?([A-Z|0-9].*?) <') - scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle) - scrapedtitle = scrapedtitle.replace ("È","È") - scrapedtitle = scrapedtitle.replace("–", "-") - scrapedtitle = scrapedtitle.replace("’", "'") - scrapedtitle = scrapedtitle.replace(" ", "") - itemlist.append( - Item(channel=item.channel, - action="episodios", - contentType='tvshow', - title=scrapedtitle, - fulltitle=scrapedtitle, - url=scrapedurl, - thumbnail=scrapedthumb, - args=item.args, - show=scrapedtitle)) - - tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) - return itemlist - -#----------------------------------------------------------------------------------------------------------------------- - -def episodios(item): - logger.info("[filmigratis.py] episodios") - itemlist = [] - - data = httptools.downloadpage(item.url, headers=headers).data - - block = scrapertools.find_single_match(data, r'<div class="row">(.*?)<section class="main-content">') - - patron = r'href="(.*?)".*?(S[^<]+) <' - matches = re.compile(patron, re.DOTALL).findall(block) - - for scrapedurl, scrapedtitle in matches: - scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle) - scrapedtitle = scrapedtitle.replace ("S0", "") - scrapedtitle = scrapedtitle.replace(" - EP ", "x") - itemlist.append( - Item(channel=item.channel, - action="findvideos", - contentType='episode', - title=scrapedtitle, - fulltitle=scrapedtitle, - url=scrapedurl, - thumbnail=item.thumb, - args=item.args, - show=item.title)) - - tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) - support.videolibrary(itemlist, item, 'color kod') - return itemlist - -#----------------------------------------------------------------------------------------------------------------------- - -def search(item, texto): - logger.info('[filmigratis.py] search') - - item.url = host + '/search/?s=' + texto - - if item.args == 'serie': - try: - return peliculas_serie(item) - - except: - import sys - for line in sys.exc_info(): - logger.error('%s' % line) - return [] +@support.scrape +def genres(item): + support.log() + if item.contentType == 'movie': + action = 'peliculas' + patron = r'<a href="(?P<url>.*?)">(?P<title>.*?)<' + patronBlock = r'CATEGORIES.*?<ul>(?P<block>.*?)</ul>' else: - try: - return peliculas_categorias(item) + item.contentType = 'tvshow' + action = 'peliculas' + blacklist = ['Al-Cinema'] + patron = r'<a href="(?P<url>.*?)">(?P<title>.*?)<' + patronBlock = r'class="material-button submenu-toggle"> SERIE TV.*?<ul>.*?</li>(?P<block>.*?)</ul>' - except: - import sys - for line in sys.exc_info(): - logger.error('%s' % line) - return [] + return locals() -#----------------------------------------------------------------------------------------------------------------------- + +def search(item, text): + support.log('search', item) + + text = text.replace(' ', '+') + item.url = host + '/search/?s=' + text + try: + item.args = 'search' + return peliculas(item) + # Se captura la excepcion, para no interrumpir al buscador global si un canal falla + except: + import sys + for line in sys.exc_info(): + log('search log:', line) + return [] + +def newest(categoria): + support.log('newest ->', categoria) + itemlist = [] + item = Item() + try: + if categoria == 'peliculas': + item.url = host + item.contentType = 'movie' + 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({0}.format(line)) + return [] + + return itemlist def findvideos(item): - logger.info('[filmigratis.py] findvideos') - - data = httptools.downloadpage(item.url, headers=headers).data - - itemlist = servertools.find_video_items(data=data) - - for videoitem in itemlist: - videoitem.title = item.title + '[COLOR green][B] - ' + videoitem.title + '[/B][/COLOR]' - videoitem.fulltitle = item.fulltitle - videoitem.show = item.show - videoitem.thumbnail = item.thumbnail - videoitem.channel = item.channel - videoitem.contentType = item.content - - if item.args == "film": - support.videolibrary(itemlist, item, 'color kod') - - autoplay.start(itemlist, item) - - return itemlist + support.log() + return support.server(item) diff --git a/core/support.py b/core/support.py index e5427fee..026a3459 100644 --- a/core/support.py +++ b/core/support.py @@ -217,11 +217,11 @@ 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 - if scraped['season'] != None: - season = scraped['season'] - if stagione: - episode = season +'x'+ scraped['episode'] - elif item.contentType == 'tvshow' and (scraped['episode'] == '' and season == ''): + if scraped['season']: + episode = scraped['season'] +'x'+ scraped['episode'] + elif stagione: + episode = stagione +'x'+ scraped['episode'] + elif item.contentType == 'tvshow' and (scraped['episode'] == '' and scraped['season'] == '' and stagione == ''): item.news = 'season_completed' episode = '' else: