diff --git a/channels/serietvsubita.json b/channels/serietvsubita.json index 4dd01090..7a4eafad 100644 --- a/channels/serietvsubita.json +++ b/channels/serietvsubita.json @@ -1,7 +1,7 @@ { "id": "serietvsubita", "name": "Serie TV Sub ITA", - "active": false, + "active": true, "adult": false, "language": ["ita"], "thumbnail": "http://serietvsubita.xyz/wp-content/uploads/2012/07/logo.jpg", @@ -12,7 +12,7 @@ "id": "channel_host", "type": "text", "label": "Host del canale", - "default": "http://serietvsubita.xyz/", + "default": "http://serietvsubita.xyz", "enabled": true, "visible": true }, @@ -39,6 +39,32 @@ "default": true, "enabled": true, "visible": true + }, + { + "id": "comprueba_enlaces", + "type": "bool", + "label": "Verifica se i link esistono", + "default": false, + "enabled": true, + "visible": true + }, + { + "id": "comprueba_enlaces_num", + "type": "list", + "label": "Numero de link da verificare", + "default": 1, + "enabled": true, + "visible": "eq(-1,true)", + "lvalues": [ "1", "3", "5", "10" ] + }, + { + "id": "filter_languages", + "type": "list", + "label": "Mostra link in lingua...", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": ["Non filtrare","IT"] } ] } diff --git a/channels/serietvsubita.py b/channels/serietvsubita.py index 5edd00c0..4cb682d0 100644 --- a/channels/serietvsubita.py +++ b/channels/serietvsubita.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------ # Canale per Serie Tv Sub ITA -# Ringraziamo Icarus crew +# Thanks to Icarus crew & Alfa addon # ---------------------------------------------------------- import inspect import re @@ -9,11 +9,11 @@ import time import channelselector from channels import autoplay, support, filtertools -from core import httptools, tmdb, scrapertools +from core import httptools, tmdb, scrapertools, servertools from core.item import Item from platformcode import logger, config - -host = config.get_setting("channel_host", 'serietvsubita') +__channel__ = "serietvsubita" +host = config.get_setting("channel_host", __channel__) headers = [['Referer', host]] IDIOMAS = {'Italiano': 'IT'} @@ -21,6 +21,8 @@ list_language = IDIOMAS.values() list_servers = ['gounlimited','verystream','streamango','openload'] list_quality = ['default'] +# __comprueba_enlaces__ = config.get_setting('comprueba_enlaces', __channel__) +# __comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', __channel__) def mainlist(item): @@ -50,7 +52,7 @@ def mainlist(item): # ---------------------------------------------------------------------------------------------------------------- def cleantitle(scrapedtitle): scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle.strip()) - scrapedtitle = scrapedtitle.replace('[HD]', '').replace('’', '\'').replace('Game of Thrones –','') + scrapedtitle = scrapedtitle.replace('[HD]', '').replace('’', '\'').replace('×','x').replace('Game of Thrones –','') year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)') if year: scrapedtitle = scrapedtitle.replace('(' + year + ')', '') @@ -73,12 +75,18 @@ def lista_serie(item): item.url, p = item.url.split('{}') p = int(p) - # Descarga la pagina - data = httptools.downloadpage(item.url).data + if '||' in item.url: + series = item.url.split('\n\n') + matches = [] + for i, serie in enumerate(series): + matches.append(serie.split('||')) + else: + # Descarga la pagina + data = httptools.downloadpage(item.url).data - # Extrae las entradas - patron = '
  • ([^<]+)' - matches = re.compile(patron, re.DOTALL).findall(data) + # Extrae las entradas + patron = '
  • ([^<]+)' + matches = re.compile(patron, re.DOTALL).findall(data) for i, (scrapedurl, scrapedtitle) in enumerate(matches): scrapedplot = "" @@ -89,13 +97,15 @@ def lista_serie(item): itemlist.append( Item(channel=item.channel, extra=item.extra, - action="episodes", + action="episodios", title=title, url=scrapedurl, thumbnail=scrapedthumbnail, fulltitle=title, show=title, plot=scrapedplot, + contentType='episode', + originalUrl=scrapedurl, folder=True)) tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) @@ -118,35 +128,87 @@ def lista_serie(item): # ---------------------------------------------------------------------------------------------------------------- -def episodes(item): - support.log(item.channel + " episodes") - itemlist = [] +def episodios(item, itemlist=[]): + support.log(item.channel + " episodios") + # itemlist = [] data = httptools.downloadpage(item.url).data + patron = '
    \s*.*?' patron += '

    ' - matches = re.compile(patron, re.DOTALL).findall(data) + matches = re.compile(patron, re.DOTALL).findall(data) + logger.debug(itemlist) for scrapedurl, scrapedtitle, scrapedthumbnail in matches: scrapedplot = "" scrapedtitle = cleantitle(scrapedtitle) - title = scrapedtitle.split(" S0")[0].strip() - title = title.split(" S1")[0].strip() - title = title.split(" S2")[0].strip() + if "(Completa)" in scrapedtitle: + data = httptools.downloadpage(scrapedurl).data + scrapedtitle = scrapedtitle.replace(" – Miniserie"," – Stagione 1") + title = scrapedtitle.split(" – Stagione")[0].strip() - itemlist.append( - Item(channel=item.channel, - extra=item.extra, - action="findvideos", - fulltitle=scrapedtitle, - show=scrapedtitle, - title=scrapedtitle, - url=scrapedurl, - thumbnail=scrapedthumbnail, - plot=scrapedplot, - contentSerieName=title, - folder=True)) + # recupero la stagione + season = scrapertools.find_single_match(scrapedtitle,'Stagione ([0-9]*)') + blocco = scrapertools.find_single_match(data, '

    [\s\S.]*?
    Episodio 0','>Episodio-0') + # matches = scrapertools.find_multiple_matches(blocco, r'Episodio[^\d](\d*)') + # logger.debug(blocco) + # logger.debug(matches) + # episodes = [] + # if len(matches) > 0: + # for string, episode in matches: + # episodes.append([ + # "".join([season, "x", episode]), + # season, + # episode + # ]) + + else: + title = scrapedtitle.split(" S0")[0].strip() + title = title.split(" S1")[0].strip() + title = title.split(" S2")[0].strip() + episodes = scrapertools.find_multiple_matches(scrapedtitle,r'((\d*)x(\d*))') + # logger.debug(scrapedtitle) + # logger.debug(episodes) + + for fullepisode, season, episode in episodes: + infoLabels = {} + infoLabels['season'] = season + infoLabels['episode'] = episode + + itemlist.append( + Item(channel=item.channel, + extra=item.extra, + action="findvideos", + fulltitle=scrapedtitle, + show=scrapedtitle, + title=fullepisode, + url=scrapedurl, + thumbnail=scrapedthumbnail, + plot=scrapedplot, + contentSerieName=title, + infoLabels=infoLabels, + folder=True)) tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) @@ -154,16 +216,11 @@ def episodes(item): patron = '\d+\s*\d+' next_page = scrapertools.find_single_match(data, patron) if next_page != "": - itemlist.append( - Item(channel=item.channel, - action='episodes', - contentType=item.contentType, - title=support.typo(config.get_localized_string(30992), 'color kod bold'), - url=next_page, - args=item.args, - thumbnail=support.thumb())) - - # support.videolibrary(itemlist,item,'bold color kod') + item.url = next_page + itemlist = episodios(item,itemlist) + else: + item.url = item.originalUrl + support.videolibrary(itemlist,item,'bold color kod') return itemlist @@ -175,6 +232,24 @@ def findvideos(item): data = httptools.downloadpage(item.url).data + # recupero il blocco contenente i link + blocco = scrapertools.find_single_match(data,'
    [\s\S.]*?
    \d+\s*\d+' - next_page = scrapertools.find_single_match(data, patron) - if next_page != "": - if item.extra == "search_tv": - next_page = next_page.replace('&', '&') - itemlist.append( - Item(channel=item.channel, - action='peliculas_tv', - contentType=item.contentType, - title=support.typo(config.get_localized_string(30992), 'color kod bold'), - url=next_page, - args=item.args, - extra=item.extra, - thumbnail=support.thumb())) + support.nextPage(itemlist,item,data,patron) + # next_page = scrapertools.find_single_match(data, patron) + # if next_page != "": + # if item.extra == "search_tv": + # next_page = next_page.replace('&', '&') + # itemlist.append( + # Item(channel=item.channel, + # action='peliculas_tv', + # contentType=item.contentType, + # title=support.typo(config.get_localized_string(30992), 'color kod bold'), + # url=next_page, + # args=item.args, + # extra=item.extra, + # thumbnail=support.thumb())) return itemlist @@ -257,11 +338,11 @@ def peliculas_tv(item): # ---------------------------------------------------------------------------------------------------------------- def newest(categoria): - logger.info('serietvsubita' + " newest" + categoria) + logger.info(__channel__ + " newest" + categoria) itemlist = [] item = Item() - item.url = host; - item.extra = 'serie'; + item.url = host + item.extra = 'serie' try: if categoria == "series": itemlist = peliculas_tv(item) @@ -282,32 +363,6 @@ def newest(categoria): def search(item, texto): logger.info(item.channel + " search") itemlist = [] - item.extra = "search_tv" - - item.url = host + "/?s=" + texto + "&op.x=0&op.y=0" - - try: - return peliculas_tv(item) - - except: - import sys - for line in sys.exc_info(): - logger.error("%s" % line) - return [] - - -# ================================================================================================================ - -# ---------------------------------------------------------------------------------------------------------------- -def list_az(item): - support.log(item.channel+" list_az") - itemlist = [] - PERPAGE = 50 - - p = 1 - if '{}' in item.url: - item.url, p = item.url.split('{}') - p = int(p) # Scarico la pagina data = httptools.downloadpage(item.url).data @@ -317,35 +372,72 @@ def list_az(item): matches = re.compile(patron, re.DOTALL).findall(data) for i, (scrapedurl, scrapedtitle) in enumerate(matches): - scrapedplot = "" - scrapedthumbnail = "" - if (p - 1) * PERPAGE > i: continue - if i >= p * PERPAGE: break - title = cleantitle(scrapedtitle) - itemlist.append( - Item(channel=item.channel, - extra=item.extra, - action="episodes", - title=title, - url=scrapedurl, - fulltitle=title, - show=title, - plot=scrapedplot, - folder=True)) + if texto.upper() in scrapedtitle.upper(): + scrapedthumbnail = "" + scrapedplot = "" + title = cleantitle(scrapedtitle) + itemlist.append( + Item(channel=item.channel, + extra=item.extra, + action="episodios", + title=title, + url=scrapedurl, + thumbnail=scrapedthumbnail, + fulltitle=title, + show=title, + plot=scrapedplot, + contentType='episode', + originalUrl=scrapedurl, + folder=True)) tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) - # Paginazione - if len(matches) >= p * PERPAGE: - scrapedurl = item.url + '{}' + str(p + 1) + return itemlist + + # item.extra = "search_tv" + # + # item.url = host + "/?s=" + texto + "&op.x=0&op.y=0" + # + # try: + # return peliculas_tv(item) + # + # except: + # import sys + # for line in sys.exc_info(): + # logger.error("%s" % line) + # return [] + + +# ================================================================================================================ + +# ---------------------------------------------------------------------------------------------------------------- + + +def list_az(item): + support.log(item.channel+" list_az") + itemlist = [] + + alphabet = dict() + + # Scarico la pagina + data = httptools.downloadpage(item.url).data + + # Articoli + patron = '
  • ([^<]+)' + matches = re.compile(patron, re.DOTALL).findall(data) + + for i, (scrapedurl, scrapedtitle) in enumerate(matches): + letter = scrapedtitle[0].upper() + if letter not in alphabet: + alphabet[letter] = [] + alphabet[letter].append(scrapedurl+'||'+scrapedtitle) + + for letter in sorted(alphabet): itemlist.append( Item(channel=item.channel, - action='list_az', - contentType=item.contentType, - title=support.typo(config.get_localized_string(30992), 'color kod bold'), - url=scrapedurl, - args=item.args, - extra=item.extra, - thumbnail=support.thumb())) + action="lista_serie", + url='\n\n'.join(alphabet[letter]), + title=letter, + fulltitle=letter)) return itemlist