From 3db04d3a73f598a3bd49c6aa963ed0b08871226f Mon Sep 17 00:00:00 2001 From: Alfa-beto <30815244+Alfa-beto@users.noreply.github.com> Date: Tue, 1 Jan 2019 20:03:53 -0300 Subject: [PATCH] SeriesAnimadas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SeriesAnimadas: Correcciónes por cambio de estructura --- plugin.video.alfa/channels/seriesanimadas.py | 77 +++++++------------- 1 file changed, 27 insertions(+), 50 deletions(-) diff --git a/plugin.video.alfa/channels/seriesanimadas.py b/plugin.video.alfa/channels/seriesanimadas.py index 5a0747c4..cf612140 100644 --- a/plugin.video.alfa/channels/seriesanimadas.py +++ b/plugin.video.alfa/channels/seriesanimadas.py @@ -45,10 +45,11 @@ def mainlist(item): itemlist.append(Item(channel=item.channel, title='Nuevos Capitulos', url=host, action='new_episodes', type='tvshows', thumbnail=get_thumb('new_episodes', auto=True))) - itemlist.append(Item(channel=item.channel, title='Ultimas', url=host + 'series?', action='list_all', type='tvshows', + itemlist.append(Item(channel=item.channel, title='Ultimas', url=host + 'series/estrenos', action='list_all', + type='tvshows', thumbnail=get_thumb('last', auto=True))) - itemlist.append(Item(channel=item.channel, title='Todas', url=host + 'series?', action='list_all', type='tvshows', + itemlist.append(Item(channel=item.channel, title='Todas', url=host + 'series', action='list_all', type='tvshows', thumbnail=get_thumb('all', auto=True))) itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=host + 'search?s=', @@ -83,19 +84,14 @@ def list_all(item): itemlist = [] data = get_source(item.url) - - patron = '
.*?.*?' - patron +='(\d{4}).*?([^<]+)<' + patron = '
.*? href="([^"]+)".*?([^<]+)<' matches = re.compile(patron, re.DOTALL).findall(data) - for scrapedurl, scrapedthumbnail, scrapedtitle, year, scrapedtype in matches: + for scrapedurl, scrapedthumbnail, scrapedtitle in matches: title = scrapedtitle thumbnail = scrapedthumbnail url = scrapedurl - if scrapedtype == 'Anime': - action = 'episodesxseasons' - elif scrapedtype == 'Serie': - action = 'seasons' + action = 'seasons' new_item = Item(channel=item.channel, action=action, @@ -103,15 +99,14 @@ def list_all(item): url=url, contentSerieName=scrapedtitle, thumbnail=thumbnail, - type=scrapedtype, - infoLabels={'year':year}) + ) itemlist.append(new_item) tmdb.set_infoLabels(itemlist, seekTmdb=True) # Paginación - url_next_page = scrapertools.find_single_match(data,'li>') + url_next_page = scrapertools.find_single_match(data,'
  • Temporada (\d+)' + patron='
    Temporada (\d+)
    ' matches = re.compile(patron, re.DOTALL).findall(data) - + if len(matches) == 0: + item.type = 'Anime' + return episodesxseasons(item) infoLabels = item.infoLabels - for scrapedurl, season in matches: + for season in matches: infoLabels['season']=season title = 'Temporada %s' % season - itemlist.append(Item(channel=item.channel, title=title, url=scrapedurl, action='episodesxseasons', + itemlist.append(Item(channel=item.channel, title=title, url=item.url, action='episodesxseasons', infoLabels=infoLabels)) tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) @@ -156,23 +153,27 @@ def episodesxseasons(item): itemlist = [] data=get_source(item.url) - patron='
    ' - matches = re.compile(patron, re.DOTALL).findall(data) infoLabels = item.infoLabels if item.type == 'Anime': season = '1' + patron = ' Episodio (\d+).*?' else: season = item.infoLabels['season'] - episode = len(matches) - for scrapedurl, scrapedtitle in matches: + + patron = 'class="episodie-list" href="([^"]+)" title=".*?Temporada %s .*?pisodio (\d+).*?">' % season + matches = re.compile(patron, re.DOTALL).findall(data) + + if not matches: + patron = 'class="episodie-list" href="([^"]+)" title=".*?pisodio (\d+).*?">' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, episode in matches: infoLabels['episode'] = episode url = scrapedurl - title = scrapedtitle.replace(' online', '') - title = '%sx%s - %s' % (season, episode, title) + title = '%sx%s - Episodio %s' % (season, episode, episode) itemlist.append(Item(channel=item.channel, title= title, url=url, action='findvideos', infoLabels=infoLabels)) - episode -= 1 tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) return itemlist[::-1] @@ -183,7 +184,7 @@ def new_episodes(item): itemlist = [] data = get_source(item.url) - patron = '