fix: serietvu.py canale terminato, da testare
fix: toonitalia, uscivano risultati in novità -> serie fix: news, commentati log, traduzione voci fix: serietvonline, pulizia codice
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# ------------------------------------------------------------
|
||||
# Canale per serietvonline
|
||||
# Canale per serietvonline.py
|
||||
# ----------------------------------------------------------
|
||||
"""
|
||||
|
||||
@@ -191,7 +191,7 @@ def findvideos(item):
|
||||
data = httptools.downloadpage(item.url, headers=headers).data
|
||||
data = re.sub('\n|\t', ' ', data)
|
||||
data = re.sub(r'>\s+<', '> <', data)
|
||||
support.log("DATA - HTML:\n", data)
|
||||
#support.log("DATA - HTML:\n", data)
|
||||
url_video = scrapertoolsV2.find_single_match(data, r'<tr><td>(.+?)</td><tr>', -1)
|
||||
url_serie = scrapertoolsV2.find_single_match(data, r'<link rel="canonical" href="([^"]+)"\s?/>')
|
||||
goseries = support.typo("Vai alla Serie:", ' bold')
|
||||
|
||||
@@ -3,68 +3,10 @@
|
||||
"name": "SerieTVU",
|
||||
"active": true,
|
||||
"adult": false,
|
||||
"language": ["ita"],
|
||||
"language": ["ita", "sub-ita"],
|
||||
"thumbnail": "serietvu.png",
|
||||
"banner": "serietvu.png",
|
||||
"categories": ["tvshow"],
|
||||
"settings": [
|
||||
{
|
||||
"id": "channel_host",
|
||||
"type": "text",
|
||||
"label": "Host del canale",
|
||||
"default": "https://www.serietvu.club",
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "include_in_global_search",
|
||||
"type": "bool",
|
||||
"label": "Includi ricerca globale",
|
||||
"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", "3", "5", "10" ]
|
||||
},
|
||||
{
|
||||
"id": "filter_languages",
|
||||
"type": "list",
|
||||
"label": "Mostra link in lingua...",
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": ["Non filtrare","IT"]
|
||||
}
|
||||
]
|
||||
"categories": ["tvshow", "vos"],
|
||||
"not_active": ["include_in_newest_peliculas", "include_in_newest_anime"],
|
||||
"settings": []
|
||||
}
|
||||
|
||||
@@ -1,28 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# ------------------------------------------------------------
|
||||
# Canale per SerieTVU
|
||||
# Thanks to Icarus crew & Alfa addon & 4l3x87
|
||||
# Canale per serietvu.py
|
||||
# ----------------------------------------------------------
|
||||
|
||||
"""
|
||||
Trasformate le sole def per support.menu e support.scrape
|
||||
da non inviare nel test.
|
||||
Test solo a trasformazione completa
|
||||
|
||||
La pagina novità contiene al max 25 titoli
|
||||
"""
|
||||
import re
|
||||
|
||||
from core import tmdb, scrapertools, support
|
||||
from core import support, httptools, scrapertoolsV2
|
||||
from core.item import Item
|
||||
from core.support import log
|
||||
from platformcode import config, logger
|
||||
from platformcode import 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']
|
||||
|
||||
@@ -30,235 +24,74 @@ list_quality = ['default']
|
||||
@support.menu
|
||||
def mainlist(item):
|
||||
log()
|
||||
|
||||
tvshow = ['/category/serie-tv',
|
||||
('Novità', ['/ultimi-episodi', 'latestep']),
|
||||
('Categorie', ['', 'categorie'])
|
||||
('Novità', ['/ultimi-episodi/', 'peliculas', 'update']),
|
||||
('Generi', ['', 'genres', 'genres'])
|
||||
]
|
||||
|
||||
return locals()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
def cleantitle(scrapedtitle):
|
||||
log()
|
||||
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()
|
||||
|
||||
|
||||
# ================================================================================================================
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
@support.scrape
|
||||
def peliculas(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)
|
||||
patronBlock = r'<div class="wrap">\s+<h.>.*?</h.>(?P<block>.*?)<footer>'
|
||||
|
||||
for scrapedurl, scrapedimg, scrapedtitle in matches:
|
||||
infoLabels = {}
|
||||
year = scrapertools.find_single_match(scrapedtitle, '\((\d{4})\)')
|
||||
if year:
|
||||
infoLabels['year'] = year
|
||||
scrapedtitle = cleantitle(scrapedtitle)
|
||||
|
||||
if item.args != 'update':
|
||||
action = 'episodios'
|
||||
patron = r'<div class="item">\s*<a href="(?P<url>[^"]+)" data-original="(?P<thumb>[^"]+)" class="lazy inner">[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)<'
|
||||
else:
|
||||
action = 'findvideos'
|
||||
patron = r'<div class="item">\s+?<a href="(?P<url>[^"]+)"\s+?data-original="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(?P<title>.+?)<[^>]+>\((?P<episode>[\dx\-]+)\s+?(?P<lang>Sub-Ita|[iITtAa]+)\)<'
|
||||
pagination = 25
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel,
|
||||
action="episodios",
|
||||
title=scrapedtitle,
|
||||
fulltitle=scrapedtitle,
|
||||
url=scrapedurl,
|
||||
thumbnail=scrapedimg,
|
||||
show=scrapedtitle,
|
||||
infoLabels=infoLabels,
|
||||
contentType='episode',
|
||||
folder=True))
|
||||
patronNext = r'<li><a href="([^"]+)"\s+?>Pagina successiva'
|
||||
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
#support.regexDbg(item, patron, headers)
|
||||
#debug = True
|
||||
return locals()
|
||||
|
||||
# Pagine
|
||||
support.nextPage(itemlist, item, data, '<li><a href="([^"]+)">Pagina successiva')
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
# ================================================================================================================
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
@support.scrape
|
||||
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
|
||||
patronBlock = r'</select><div style="clear:both"></div></h2>(?P<block>.*?)<div id="trailer" class="tab">'
|
||||
patron = r'(?:<div class="list (?:active)?" data-id="(?P<season>\d+)">[^>]+>)?\s+<a data-id="(?P<episode>\d+)(?:[ ](?P<lang>[SuUbBiItTaA\-]+))?"(?P<url>[^>]+)>[^>]+>[^>]+>(?P<title>.+?)(?:\sSub-ITA)?<'
|
||||
|
||||
#support.regexDbg(item, patronBlock, headers)
|
||||
#debug = True
|
||||
return locals()
|
||||
|
||||
|
||||
# ================================================================================================================
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
def findvideos(item):
|
||||
log()
|
||||
return support.server(item, data=item.url)
|
||||
|
||||
|
||||
|
||||
# ================================================================================================================
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
def findepisodevideo(item):
|
||||
@support.scrape
|
||||
def genres(item):
|
||||
log()
|
||||
|
||||
patron_block = 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, patron_block, headers)[0]
|
||||
data = ''
|
||||
if len(matches) > 0:
|
||||
data = matches[0]
|
||||
item.contentType = 'movie'
|
||||
return support.server(item, data=data)
|
||||
blacklist = ["Home Page", "Calendario Aggiornamenti"]
|
||||
action = 'peliculas'
|
||||
patronBlock = r'<h2>Sfoglia</h2>\s*<ul>(?P<block>.*?)</ul>\s*</section>'
|
||||
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)</a></li>'
|
||||
#debug = True
|
||||
|
||||
return locals()
|
||||
|
||||
|
||||
# ================================================================================================================
|
||||
def search(item, text):
|
||||
log(text)
|
||||
item.url = host + "/?s=" + text
|
||||
try:
|
||||
item.contentType = 'tvshow'
|
||||
return peliculas(item)
|
||||
# Continua la ricerca in caso di errore
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
log("%s" % line)
|
||||
return []
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
def latestep(item):
|
||||
log()
|
||||
itemlist = []
|
||||
titles = []
|
||||
|
||||
patron_block = 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, patron_block, 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 = []
|
||||
@@ -266,51 +99,52 @@ def newest(categoria):
|
||||
try:
|
||||
if categoria == "series":
|
||||
item.url = host + "/ultimi-episodi"
|
||||
item.action = "latestep"
|
||||
itemlist = latestep(item)
|
||||
|
||||
if itemlist[-1].action == "latestep":
|
||||
itemlist.pop()
|
||||
item.action = "peliculas"
|
||||
item.contentType = 'tvshow'
|
||||
item.args = 'update'
|
||||
itemlist = peliculas(item)
|
||||
|
||||
# Continua la ricerca in caso di errore
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error("{0}".format(line))
|
||||
log("{0}".format(line))
|
||||
return []
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
# ================================================================================================================
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
def search(item, texto):
|
||||
log(texto)
|
||||
item.url = host + "/?s=" + texto
|
||||
try:
|
||||
return peliculas(item)
|
||||
# Continua la ricerca in caso di errore
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error("%s" % line)
|
||||
return []
|
||||
|
||||
|
||||
# ================================================================================================================
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------
|
||||
@support.scrape
|
||||
def categorie(item):
|
||||
def findvideos(item):
|
||||
log()
|
||||
if item.args != 'update':
|
||||
return support.server(item, data=item.url)
|
||||
else:
|
||||
itemlist = []
|
||||
item.infoLabels['mediatype'] = 'episode'
|
||||
|
||||
blacklist = ["Home Page", "Calendario Aggiornamenti"]
|
||||
action = 'peliculas'
|
||||
patronBlock = r'<h2>Sfoglia</h2>\s*<ul>(?P<block>.*?)</ul>\s*</section>'
|
||||
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)</a></li>'
|
||||
debug = True
|
||||
data = httptools.downloadpage(item.url, headers=headers).data
|
||||
data = re.sub('\n|\t', ' ', data)
|
||||
data = re.sub(r'>\s+<', '> <', data)
|
||||
## support.log("DATA - HTML:\n", data)
|
||||
url_video = scrapertoolsV2.find_single_match(data, r'<div class="item"> <a data-id="[^"]+" data-href="([^"]+)" data-original="[^"]+"[^>]+> <div> <div class="title">Episodio \d+', -1)
|
||||
url_serie = scrapertoolsV2.find_single_match(data, r'<link rel="canonical" href="([^"]+)"\s?/>')
|
||||
goseries = support.typo("Vai alla Serie:", ' bold')
|
||||
series = support.typo(item.contentSerieName, ' bold color kod')
|
||||
|
||||
return locals()
|
||||
|
||||
# ================================================================================================================
|
||||
itemlist = support.server(item, data=url_video)
|
||||
|
||||
itemlist.append(
|
||||
Item(channel=item.channel,
|
||||
title=goseries + series,
|
||||
fulltitle=item.fulltitle,
|
||||
show=item.show,
|
||||
contentType='tvshow',
|
||||
contentSerieName=item.contentSerieName,
|
||||
url=url_serie,
|
||||
action='episodios',
|
||||
contentTitle=item.contentSerieName,
|
||||
plot = goseries + series + "con tutte le puntate",
|
||||
))
|
||||
|
||||
#support.regexDbg(item, patronBlock, headers)
|
||||
return itemlist
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
"adult": false,
|
||||
"thumbnail": "toonitalia.png",
|
||||
"banner": "toonitalia.png",
|
||||
"categories": ["tvshow", "movie", "vos", "anime"],
|
||||
"not_active":["include_in_newest_peliculas"],
|
||||
"default_off":["include_in_newest"],
|
||||
"categories": ["anime","vos"],
|
||||
"not_active":["include_in_newest_peliculas", "include_in_newest_series"],
|
||||
"default_off":["include_in_newest"],
|
||||
"settings": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,10 +48,11 @@ def newest(categoria):
|
||||
support.log(categoria)
|
||||
item = support.Item()
|
||||
try:
|
||||
item.contentType = 'tvshow'
|
||||
item.url= host
|
||||
item.args= 'new'
|
||||
return peliculas(item)
|
||||
if categoria == 'anime':
|
||||
item.contentType = 'tvshow'
|
||||
item.url= host
|
||||
item.args= 'new'
|
||||
return peliculas(item)
|
||||
# Continua la ricerca in caso di errore
|
||||
except:
|
||||
import sys
|
||||
|
||||
@@ -392,7 +392,7 @@ def get_newest(channel_id, categoria):
|
||||
|
||||
|
||||
def get_title(item):
|
||||
support.log("ITEM NEWEST ->", item)
|
||||
#support.log("ITEM NEWEST ->", item)
|
||||
# item.contentSerieName c'è anche se è un film
|
||||
if item.contentSerieName and item.contentType != 'movie': # Si es una serie
|
||||
title = item.contentSerieName
|
||||
@@ -671,7 +671,7 @@ def cb_custom_button(item, dict_values):
|
||||
dict_values[v] = not value
|
||||
|
||||
if config.set_setting("custom_button_value_news", not value, item.channel) == True:
|
||||
return {"label": "Ninguno"}
|
||||
return {"label": config.get_localized_string(59992)}
|
||||
else:
|
||||
return {"label": "Todos"}
|
||||
return {"label": config.get_localized_string(59991)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user