* fix canale * fix newest * fix numero puntata * experimental scrape as decorator * prova su support.scrape e modifiche * uso del decoratore support.scrape Scritto guardaserieclick con supporto del decoratore Modificato: - eurostreaming.py per piccoli fix - Support.py per fix oltre che a portarlo allo stato del master - zcrypt - bit.ly non funziona. DA FIXARE!!! * migliorato codice Tentativo vano di inserire autorenumber per gli anime * New scrape (#55) * fix canale * fix newest * fix numero puntata * Fix Animeworld * Nuovo Autorenumber * initial background downloader support * ops * Update channels.json * Update channels.json * fix openload * move json update to cohesist with updater * disable json url updates * prova su support.scrape e modifiche * uso del decoratore support.scrape Scritto guardaserieclick con supporto del decoratore Modificato: - eurostreaming.py per piccoli fix - Support.py per fix oltre che a portarlo allo stato del master - zcrypt - bit.ly non funziona. DA FIXARE!!! * migliorato codice Tentativo vano di inserire autorenumber per gli anime * fix autoplay in altadefinizioneLink * camel case * decoratore per i menu * altadefinizione01 C * Decoratore Menu e Altadefinizione01_C e _L modifiche a support.menu per fix e scrittura dei canali: - Altadefinizione01_C - Altadefinizione01_L per il supporto dei decoratori: - menu - scrape * eliminato listGroup in favore dei nomi dei gruppi nelle regex * cambio struttura in support.menu() * cambio struttura in support.menu() * supporto completo per i decoratori Riscritti i canali per il supporto ai decoratori e alle sole regex: - Altadefinizione01_C - Altadefinizione01_L * AltadefinizioneClick - altadefinizione01 e piccoli fix modified: channels/altadefinizione01.py modified: channels/altadefinizione01_club.py modified: channels/altadefinizione01_link.py modified: channels/altadefinizioneclick.py * NewScrape (#62) * fix typo * fix typo 2 * Add files via upload * Add files via upload * fix autoplay in community channels * fix toonitalia * Fix Toonitalia * workaround serietvsubita * Nuova Rinumerazione Automatica * Fix per Rinumerazione Automatica * workaround updater * kod stable 0.3.1 * aggiunti nuovi file * channel e custom json * aggiunto bit.ly * Fix on air * ops * Personalizzazione sezione "Oggi in TV" * Aggiunto orario sezione Oggi in TV * aggiunto bit.ly (#56) * aggiunto bit.ly * Aggiunta personalizzazione homepage * Revert "initial background downloader support" This reverts commitf676ab0f* KoD 0.4 * KoD 0.4 (#57) * fix next page * testing new filmontv * Wstream quick fix, no resolution displayed :( * new filmontv * now regex is ok * fix .po files * +netlovers * working on filmontv * fix debriders * new updater * updater * fix crash * fix updater and re-add dev mode * new url eurostreaming * Delete netlovers.py * Delete netlovers.json * -net from menù * fix eurostreaming: numero stagione e newest (#50) * fix canale * fix newest * fix numero puntata * cleanup * cleanup 2 * fix updater crash on windows * Fix Animeworld * Nuovo Autorenumber * initial background downloader support * ops * Update channels.json * Update channels.json * fix openload * move json update to cohesist with updater * disable json url updates * fix typo * fix typo 2 * Add files via upload * Add files via upload * fix autoplay in community channels * fix toonitalia * Fix Toonitalia * workaround serietvsubita * Nuova Rinumerazione Automatica * Fix per Rinumerazione Automatica * workaround updater * Fix on air * ops * Personalizzazione sezione "Oggi in TV" * Aggiunto orario sezione Oggi in TV * aggiunto bit.ly (#56) * aggiunto bit.ly * Aggiunta personalizzazione homepage * Revert "initial background downloader support" This reverts commitf676ab0f* KoD 0.4 * stable * Rimossa dipendenza inutile * fix per i link bit.ly sperando non ricambiano... * Update updater.py * update * Fix Numerazione Automatica * possible fix badZipFile on android * possible fix crash if no internet connection * try except unzipper -> workaround * KoD 0.4.1 * Fix Numerazione Automatica * Fix ricerca CB01 * pagination fix * fix per bit.ly e fix di alcuni canali * Cambio dominio per FilmPerTutti * Fix per Wstream * miglioramenti vari updater + fix definitivo android * Fix Ricerca per Altadefinizione01 * Revert "Merge branch 'stable' of https://github.com/kodiondemand/addon into stable" This reverts commitcf50d10a00, reversing changes made to4a695c096c. * Revert "Revert "Merge branch 'stable' of https://github.com/kodiondemand/addon into stable"" This reverts commitcd19484c70. * Rimosso canale non più funzionante * Update addon.xml * da master a newScrape (#38) * Fix Numerazione Automatica * possible fix badZipFile on android * possible fix crash if no internet connection * try except unzipper -> workaround * KoD 0.4.1 * Fix Numerazione Automatica * Fix CB01 * pagination fix * Fix altadefinizione01_club e alcune mod a support Il canale è stato riscritto per support, così è pronto per il decoratore. Aggiunti dei fix a support altrimenti mi dava la lingua sub-ita a tutti i film successivi di un film sub-ita * fix di alcuni canali modified: animesubita.py modified: cinetecadibologna.py modified: filmpertutti.json modified: guardarefilm.py modified: istitutoluce.py modified: italiaserie.py * fix per bit.ly (#58) fix per bit.ly e fix di alcuni canali * Cambio dominio per FilmPerTutti * miglioramenti vari updater + fix definitivo android * Fix per Wstream * fix updater * Fix Ricerca per Altadefinizione01 * Rimosso canale non più funzionante * fix altadefinizione01 C * fix altadefinizione01_C * altadefinizione01 C fix regex
304 lines
11 KiB
Python
304 lines
11 KiB
Python
# -*- coding: utf-8 -*-
|
||
# ------------------------------------------------------------
|
||
# Canale per SerieTVU
|
||
# Thanks to Icarus crew & Alfa addon & 4l3x87
|
||
# ----------------------------------------------------------
|
||
import re
|
||
|
||
from core import tmdb, scrapertools, support
|
||
from core.item import Item
|
||
from core.support import log
|
||
from platformcode import logger, config
|
||
|
||
__channel__ = 'serietvu'
|
||
host = config.get_channel_url(__channel__)
|
||
headers = [['Referer', host]]
|
||
|
||
IDIOMAS = {'Italiano': 'IT'}
|
||
list_language = IDIOMAS.values()
|
||
list_servers = ['speedvideo']
|
||
list_quality = ['default']
|
||
|
||
|
||
def mainlist(item):
|
||
log()
|
||
itemlist = []
|
||
support.menu(itemlist, 'Novità bold', 'latestep', "%s/ultimi-episodi" % host, 'tvshow')
|
||
support.menu(itemlist, 'Serie TV bold', 'lista_serie', "%s/category/serie-tv" % host, 'tvshow')
|
||
support.menu(itemlist, 'Categorie', 'categorie', host, 'tvshow')
|
||
support.menu(itemlist, 'Cerca', 'search', host, 'tvshow')
|
||
support.aplay(item, itemlist, list_servers, list_quality)
|
||
support.channel_config(item, itemlist)
|
||
return itemlist
|
||
|
||
|
||
# ----------------------------------------------------------------------------------------------------------------
|
||
def cleantitle(scrapedtitle):
|
||
scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle.strip())
|
||
scrapedtitle = scrapedtitle.replace('[HD]', '').replace('’', '\'').replace('– Il Trono di Spade', '').replace(
|
||
'Flash 2014', 'Flash').replace('"', "'")
|
||
year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)')
|
||
if year:
|
||
scrapedtitle = scrapedtitle.replace('(' + year + ')', '')
|
||
|
||
return scrapedtitle.strip()
|
||
|
||
|
||
# ================================================================================================================
|
||
|
||
# ----------------------------------------------------------------------------------------------------------------
|
||
def lista_serie(item):
|
||
log()
|
||
itemlist = []
|
||
|
||
patron = r'<div class="item">\s*<a href="([^"]+)" data-original="([^"]+)" class="lazy inner">'
|
||
patron += r'[^>]+>[^>]+>[^>]+>[^>]+>([^<]+)<'
|
||
matches, data = support.match(item, patron, headers=headers)
|
||
|
||
for scrapedurl, scrapedimg, scrapedtitle in matches:
|
||
infoLabels = {}
|
||
year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)')
|
||
if year:
|
||
infoLabels['year'] = year
|
||
scrapedtitle = cleantitle(scrapedtitle)
|
||
|
||
itemlist.append(
|
||
Item(channel=item.channel,
|
||
action="episodios",
|
||
title=scrapedtitle,
|
||
fulltitle=scrapedtitle,
|
||
url=scrapedurl,
|
||
thumbnail=scrapedimg,
|
||
show=scrapedtitle,
|
||
infoLabels=infoLabels,
|
||
contentType='episode',
|
||
folder=True))
|
||
|
||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||
|
||
# Pagine
|
||
support.nextPage(itemlist, item, data, '<li><a href="([^"]+)">Pagina successiva')
|
||
|
||
return itemlist
|
||
|
||
|
||
# ================================================================================================================
|
||
|
||
|
||
# ----------------------------------------------------------------------------------------------------------------
|
||
def episodios(item):
|
||
log()
|
||
itemlist = []
|
||
|
||
patron = r'<option value="(\d+)"[\sselected]*>.*?</option>'
|
||
matches, data = support.match(item, patron, headers=headers)
|
||
|
||
for value in matches:
|
||
patron = r'<div class="list [active]*" data-id="%s">(.*?)</div>\s*</div>' % value
|
||
blocco = scrapertools.find_single_match(data, patron)
|
||
log(blocco)
|
||
patron = r'(<a data-id="\d+[^"]*" data-href="([^"]+)"(?:\sdata-original="([^"]+)")?\sclass="[^"]+">)[^>]+>[^>]+>([^<]+)<'
|
||
matches = scrapertools.find_multiple_matches(blocco, patron)
|
||
|
||
for scrapedextra, scrapedurl, scrapedimg, scrapedtitle in matches:
|
||
contentlanguage = ''
|
||
if 'sub-ita' in scrapedtitle.lower():
|
||
contentlanguage = 'Sub-ITA'
|
||
scrapedtitle = scrapedtitle.replace(contentlanguage, '')
|
||
|
||
number = cleantitle(scrapedtitle.replace("Episodio", "")).strip()
|
||
|
||
title = value + "x" + number.zfill(2)
|
||
title += " "+support.typo(contentlanguage, '_ [] color kod') if contentlanguage else ''
|
||
|
||
infoLabels = {}
|
||
infoLabels['episode'] = number.zfill(2)
|
||
infoLabels['season'] = value
|
||
|
||
itemlist.append(
|
||
Item(channel=item.channel,
|
||
action="findvideos",
|
||
title=title,
|
||
fulltitle=scrapedtitle,
|
||
contentType="episode",
|
||
url=scrapedurl,
|
||
thumbnail=scrapedimg,
|
||
extra=scrapedextra,
|
||
infoLabels=infoLabels,
|
||
folder=True))
|
||
|
||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||
|
||
support.videolibrary(itemlist, item, 'bold color kod')
|
||
|
||
return itemlist
|
||
|
||
|
||
# ================================================================================================================
|
||
|
||
# ----------------------------------------------------------------------------------------------------------------
|
||
def findvideos(item):
|
||
log()
|
||
return support.server(item, data=item.url)
|
||
|
||
|
||
|
||
# ================================================================================================================
|
||
|
||
|
||
# ----------------------------------------------------------------------------------------------------------------
|
||
def findepisodevideo(item):
|
||
log()
|
||
|
||
patronBlock = r'<div class="list [active]*" data-id="%s">(.*?)</div>\s*</div>' % item.extra[0][0]
|
||
patron = r'<a data-id="%s[^"]*" data-href="([^"]+)"(?:\sdata-original="[^"]+")?\sclass="[^"]+">' % item.extra[0][1].lstrip("0")
|
||
matches = support.match(item, patron, patronBlock, headers)[0]
|
||
data = ''
|
||
if len(matches) > 0:
|
||
data = matches[0]
|
||
item.contentType = 'movie'
|
||
return support.server(item, data=data)
|
||
|
||
|
||
# ================================================================================================================
|
||
|
||
|
||
# ----------------------------------------------------------------------------------------------------------------
|
||
def latestep(item):
|
||
log()
|
||
itemlist = []
|
||
titles = []
|
||
|
||
patronBlock = r"Ultimi episodi aggiunti.*?<h2>"
|
||
patron = r'<a href="([^"]*)"\sdata-src="([^"]*)"\sclass="owl-lazy.*?".*?class="title">(.*?)<small>\((\d*?)x(\d*?)\s(Sub-Ita|Ita)'
|
||
matches = support.match(item, patron, patronBlock, headers, host)[0]
|
||
|
||
for scrapedurl, scrapedimg, scrapedtitle, scrapedseason, scrapedepisode, scrapedlanguage in matches:
|
||
infoLabels = {}
|
||
year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)')
|
||
if year:
|
||
infoLabels['year'] = year
|
||
infoLabels['episode'] = scrapedepisode
|
||
infoLabels['season'] = scrapedseason
|
||
episode = scrapedseason + "x" + scrapedepisode
|
||
|
||
scrapedtitle = cleantitle(scrapedtitle)
|
||
title = scrapedtitle + " - " + episode
|
||
contentlanguage = ""
|
||
if scrapedlanguage.strip().lower() != 'ita':
|
||
title += " "+support.typo("Sub-ITA", '_ [] color kod')
|
||
contentlanguage = 'Sub-ITA'
|
||
|
||
titles.append(title)
|
||
itemlist.append(
|
||
Item(channel=item.channel,
|
||
action="findepisodevideo",
|
||
title=title,
|
||
fulltitle=title,
|
||
url=scrapedurl,
|
||
extra=[[scrapedseason, scrapedepisode]],
|
||
thumbnail=scrapedimg,
|
||
contentSerieName=scrapedtitle,
|
||
contentLanguage=contentlanguage,
|
||
contentType='episode',
|
||
infoLabels=infoLabels,
|
||
folder=True))
|
||
|
||
patron = r'<div class="item">\s*<a href="([^"]+)" data-original="([^"]+)" class="lazy inner">'
|
||
patron += r'[^>]+>[^>]+>[^>]+>[^>]+>([^<]+)<small>([^<]+)<'
|
||
matches = support.match(item, patron, headers=headers)[0]
|
||
|
||
for scrapedurl, scrapedimg, scrapedtitle, scrapedinfo in matches:
|
||
infoLabels = {}
|
||
year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)')
|
||
if year:
|
||
infoLabels['year'] = year
|
||
scrapedtitle = cleantitle(scrapedtitle)
|
||
|
||
infoLabels['tvshowtitle'] = scrapedtitle
|
||
|
||
episodio = re.compile(r'(\d+)x(\d+)', re.DOTALL).findall(scrapedinfo)
|
||
infoLabels['episode'] = episodio[0][1]
|
||
infoLabels['season'] = episodio[0][0]
|
||
|
||
episode = infoLabels['season'] + "x" + infoLabels['episode']
|
||
title = "%s - %s" % (scrapedtitle, episode)
|
||
title = title.strip()
|
||
contentlanguage = ""
|
||
if 'sub-ita' in scrapedinfo.lower():
|
||
title += " "+support.typo("Sub-ITA", '_ [] color kod')
|
||
contentlanguage = 'Sub-ITA'
|
||
|
||
if title in titles: continue
|
||
itemlist.append(
|
||
Item(channel=item.channel,
|
||
action="findepisodevideo",
|
||
title=title,
|
||
fulltitle=title,
|
||
url=scrapedurl,
|
||
extra=episodio,
|
||
thumbnail=scrapedimg,
|
||
contentSerieName=scrapedtitle,
|
||
contentLanguage=contentlanguage,
|
||
infoLabels=infoLabels,
|
||
contentType='episode',
|
||
folder=True))
|
||
|
||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||
|
||
return itemlist
|
||
|
||
|
||
# ================================================================================================================
|
||
|
||
# ----------------------------------------------------------------------------------------------------------------
|
||
def newest(categoria):
|
||
log(categoria)
|
||
itemlist = []
|
||
item = Item()
|
||
try:
|
||
if categoria == "series":
|
||
item.url = host + "/ultimi-episodi"
|
||
item.action = "latestep"
|
||
itemlist = latestep(item)
|
||
|
||
if itemlist[-1].action == "latestep":
|
||
itemlist.pop()
|
||
|
||
# Continua la ricerca in caso di errore
|
||
except:
|
||
import sys
|
||
for line in sys.exc_info():
|
||
logger.error("{0}".format(line))
|
||
return []
|
||
|
||
return itemlist
|
||
|
||
|
||
# ================================================================================================================
|
||
|
||
# ----------------------------------------------------------------------------------------------------------------
|
||
def search(item, texto):
|
||
log(texto)
|
||
item.url = host + "/?s=" + texto
|
||
try:
|
||
return lista_serie(item)
|
||
# Continua la ricerca in caso di errore
|
||
except:
|
||
import sys
|
||
for line in sys.exc_info():
|
||
logger.error("%s" % line)
|
||
return []
|
||
|
||
|
||
# ================================================================================================================
|
||
|
||
# ----------------------------------------------------------------------------------------------------------------
|
||
def categorie(item):
|
||
log()
|
||
patronBlock= r'<h2>Sfoglia</h2>\s*<ul>(.*?)</ul>\s*</section>'
|
||
patron = r'<li><a href="([^"]+)">([^<]+)</a></li>'
|
||
return support.scrape(item, patron, ['url','title'], patronBlock=patronBlock, action='lista_serie', blacklist=["Home Page", "Calendario Aggiornamenti"])
|
||
|
||
# ================================================================================================================
|