Riscritto CB01 Anime
This commit is contained in:
+4
-29
@@ -1,36 +1,11 @@
|
|||||||
{
|
{
|
||||||
"id": "cb01anime",
|
"id": "cb01anime",
|
||||||
"name": "Cb01anime",
|
"name": "Cb01anime",
|
||||||
"language": ["ita"],
|
"language": ["ita", "vos", "vosi"],
|
||||||
"active": true,
|
"active": true,
|
||||||
"adult": false,
|
"adult": false,
|
||||||
"thumbnail": "http://i.imgur.com/bHoUMo2.png",
|
"thumbnail": "cb01anime.png",
|
||||||
"banner": "http://i.imgur.com/bHoUMo2.png",
|
"banner": "cb01anime.png",
|
||||||
"categories": ["anime"],
|
"categories": ["anime"],
|
||||||
"settings": [
|
"settings": []
|
||||||
{
|
|
||||||
"id": "include_in_global_search",
|
|
||||||
"type": "bool",
|
|
||||||
"label": "Includi in Ricerca Globale",
|
|
||||||
"default": false,
|
|
||||||
"enabled": false,
|
|
||||||
"visible": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "include_in_newest_anime",
|
|
||||||
"type": "bool",
|
|
||||||
"label": "Includi in Novità - Anime",
|
|
||||||
"default": false,
|
|
||||||
"enabled": false,
|
|
||||||
"visible": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "include_in_newest_italiano",
|
|
||||||
"type": "bool",
|
|
||||||
"label": "Includi in Novità - Italiano",
|
|
||||||
"default": true,
|
|
||||||
"enabled": true,
|
|
||||||
"visible": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
+64
-251
@@ -1,276 +1,89 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Ringraziamo Icarus crew
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# XBMC Plugin
|
# XBMC Plugin
|
||||||
# Canale per cineblog01 - anime
|
# Canale per cineblog01 - anime
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
import re
|
|
||||||
|
|
||||||
from core import httptools, scrapertools, servertools, tmdb
|
from core import support
|
||||||
from core.item import Item
|
|
||||||
from platformcode import logger, config
|
|
||||||
|
|
||||||
__channel__ = "cb01anime"
|
__channel__ = "cb01anime"
|
||||||
host = config.get_channel_url(__channel__)
|
host = support.config.get_channel_url(__channel__) + '/anime'
|
||||||
#esclusione degli articoli 'di servizio'
|
|
||||||
blacklist = ['AVVISO IMPORTANTE – CB01.ROCKS', 'Lista Alfabetica Completa Anime/Cartoon', 'CB01.UNO ▶ TROVA L’INDIRIZZO UFFICIALE']
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
Blacklist = ['AVVISO IMPORTANTE – CB01.ROCKS', 'Lista Alfabetica Completa Anime/Cartoon', 'CB01.UNO ▶ TROVA L’INDIRIZZO UFFICIALE','Lista Richieste Up & Re-Up']
|
||||||
|
list_servers = ['verystream', 'openload', 'streamango', 'thevideome']
|
||||||
|
list_quality = ['1080p', '720p', '480p', '360']
|
||||||
|
|
||||||
|
checklinks = support.config.get_setting('checklinks', __channel__)
|
||||||
|
checklinks_number = support.config.get_setting('checklinks_number', __channel__)
|
||||||
|
headers = [['Referer', host]]
|
||||||
|
|
||||||
|
@support.menu
|
||||||
def mainlist(item):
|
def mainlist(item):
|
||||||
logger.info("[cb01anime.py] mainlist")
|
anime = [('Genere',['','menu', '2']),
|
||||||
|
('Per Lettera',['','menu', '1']),
|
||||||
# Main options
|
('Per Anno',['','menu', '3'])]
|
||||||
itemlist = [Item(channel=item.channel,
|
return locals()
|
||||||
action="list_titles",
|
|
||||||
title="[COLOR azure]Anime - Novita'[/COLOR]",
|
|
||||||
url=host + '/anime',
|
|
||||||
thumbnail="http://orig09.deviantart.net/df5a/f/2014/169/2/a/fist_of_the_north_star_folder_icon_by_minacsky_saya-d7mq8c8.png"),
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action="genere",
|
|
||||||
title="[COLOR azure]Anime - Per Genere[/COLOR]",
|
|
||||||
url=host + '/anime',
|
|
||||||
thumbnail="http://xbmc-repo-ackbarr.googlecode.com/svn/trunk/dev/skin.cirrus%20extended%20v2/extras/moviegenres/Genres.png"),
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action="alfabetico",
|
|
||||||
title="[COLOR azure]Anime - Per Lettera A-Z[/COLOR]",
|
|
||||||
url=host + '/anime',
|
|
||||||
thumbnail="http://i.imgur.com/IjCmx5r.png"),
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action="listacompleta",
|
|
||||||
title="[COLOR azure]Anime - Lista Completa[/COLOR]",
|
|
||||||
url="%s/anime/lista-completa-anime-cartoon/" % host,
|
|
||||||
thumbnail="http://i.imgur.com/IjCmx5r.png"),
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action="search",
|
|
||||||
title="[COLOR yellow]Cerca Anime[/COLOR]",
|
|
||||||
extra="anime",
|
|
||||||
thumbnail="http://dc467.4shared.com/img/fEbJqOum/s7/13feaf0c8c0/Search")]
|
|
||||||
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================
|
@support.scrape
|
||||||
|
def menu(item):
|
||||||
# -----------------------------------------------------------------
|
blacklist = ['Anime per Genere', 'Anime per Anno', 'Anime per Lettera']
|
||||||
def genere(item):
|
patronBlock = r'<select name="select%s"(?P<block>.*?)</select>' % item.args
|
||||||
logger.info("[cb01anime.py] genere")
|
patronMenu = r'<option value="(?P<url>[^"]+)">(?P<title>[^<]+)</option>'
|
||||||
|
action = 'peliculas'
|
||||||
return build_itemlist(item, '<select name="select2"(.*?)</select>', '<option value="([^"]+)">([^<]+)</option>',
|
return locals()
|
||||||
"list_titles")
|
|
||||||
|
|
||||||
|
|
||||||
def alfabetico(item):
|
|
||||||
logger.info("[cb01anime.py] alfabetico")
|
|
||||||
|
|
||||||
return build_itemlist(item, '<option value=\'-1\'>Anime per Lettera</option>(.*?)</select>',
|
|
||||||
'<option value="([^"]+)">\(([^<]+)\)</option>', "list_titles")
|
|
||||||
|
|
||||||
|
|
||||||
def listacompleta(item):
|
|
||||||
logger.info("[cb01anime.py] listacompleta")
|
|
||||||
|
|
||||||
return build_itemlist(item,
|
|
||||||
'<a href="#char_5a" title="Go to the letter Z">Z</a></span></div>(.*?)</ul></div><div style="clear:both;"></div></div>',
|
|
||||||
'<li><a href="' + host + '/([^"]+)"><span class="head">([^<]+)</span></a></li>', "episodios")
|
|
||||||
|
|
||||||
|
|
||||||
def build_itemlist(item, re_bloque, re_patron, iaction):
|
|
||||||
itemlist = []
|
|
||||||
|
|
||||||
data = httptools.downloadpage(item.url).data
|
|
||||||
|
|
||||||
# Narrow search by selecting only the combo
|
|
||||||
bloque = scrapertools.find_single_match(data, re_bloque)
|
|
||||||
|
|
||||||
# The categories are the options for the combo
|
|
||||||
matches = re.compile(re_patron, re.DOTALL).findall(bloque)
|
|
||||||
scrapertools.printMatches(matches)
|
|
||||||
|
|
||||||
for url, titulo in matches:
|
|
||||||
itemlist.append(
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action=iaction,
|
|
||||||
contentType="tvshow",
|
|
||||||
title=titulo,
|
|
||||||
fulltitle=titulo,
|
|
||||||
text_color="azure",
|
|
||||||
show=titulo,
|
|
||||||
url=host + url,
|
|
||||||
plot=""))
|
|
||||||
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
def search(item, texto):
|
def search(item, texto):
|
||||||
logger.info("[cb01anime.py] " + item.url + " search " + texto)
|
support.log(texto)
|
||||||
|
item.url = host + "/?s=" + texto
|
||||||
item.url = host + "/anime/?s=" + texto
|
return peliculas(item)
|
||||||
|
|
||||||
return list_titles(item)
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================
|
@support.scrape
|
||||||
|
def peliculas(item):
|
||||||
|
blacklist = Blacklist
|
||||||
|
patron = r'<div class="span4">\s*<a href="(?P<url>[^"]+)"><img src="(?P<thumb>[^"]+)"[^>]+><\/a>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+> <h1>(?P<title>[^<\[]+)(?:\[(?P<lang>[^\]]+)\])?</h1></a>.*?-->(?:.*?<br />)?\s*(?P<plot>[^<]+)'
|
||||||
|
patronNext = r'<link rel="next" href="([^"]+)"'
|
||||||
|
action = 'check'
|
||||||
|
return locals()
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
def check(item):
|
||||||
def list_titles(item):
|
item.url = support.match(item,r'(?:<p>|/>)(.*?)(?:<br|</td>|</p>)', r'Streaming:(.*?)</tr>')[0]
|
||||||
logger.info("[cb01anime.py] mainlist")
|
if 'Episodio' in str(item.url):
|
||||||
itemlist = []
|
item.contentType = 'tvshow'
|
||||||
|
return episodios(item)
|
||||||
|
else:
|
||||||
|
item.contentType = 'movie'
|
||||||
|
return findvideos(item)
|
||||||
|
|
||||||
# Carica la pagina
|
@support.scrape
|
||||||
data = httptools.downloadpage(item.url).data
|
|
||||||
|
|
||||||
# Estrae i contenuti
|
|
||||||
patronvideos = r'<div class="span4">\s*<a href="([^"]+)">'
|
|
||||||
patronvideos += r'<img src="([^"]+)"[^>]+><\/a>[^>]+>[^>]+>'
|
|
||||||
patronvideos += r'[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>(.*?)<\/a>'
|
|
||||||
matches = re.compile(patronvideos, re.DOTALL).findall(data)
|
|
||||||
|
|
||||||
for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
|
|
||||||
scrapedtitle = scrapertools.htmlclean(scrapedtitle).strip()
|
|
||||||
if not scrapedtitle in blacklist:
|
|
||||||
if 'lista richieste' in scrapedtitle.lower(): continue
|
|
||||||
|
|
||||||
patron = r'(?:\[[Ff][Uu][Ll]{2}\s*[Ii][Tt][Aa]\]|\[[Ss][Uu][Bb]\s*[Ii][Tt][Aa]\])'
|
|
||||||
cleantitle = re.sub(patron, '', scrapedtitle).strip()
|
|
||||||
|
|
||||||
## ------------------------------------------------
|
|
||||||
scrapedthumbnail = httptools.get_url_headers(scrapedthumbnail)
|
|
||||||
## ------------------------------------------------
|
|
||||||
|
|
||||||
# Añade al listado de XBMC
|
|
||||||
itemlist.append(
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action="listacompleta" if "Lista Alfabetica Completa Anime/Cartoon" in scrapedtitle else "episodios",
|
|
||||||
contentType="tvshow",
|
|
||||||
title=scrapedtitle,
|
|
||||||
fulltitle=cleantitle,
|
|
||||||
text_color="azure",
|
|
||||||
show=cleantitle,
|
|
||||||
url=scrapedurl,
|
|
||||||
thumbnail=scrapedthumbnail,
|
|
||||||
viewmode="movie_with_plot"))
|
|
||||||
|
|
||||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
|
||||||
|
|
||||||
# Put the next page mark
|
|
||||||
try:
|
|
||||||
next_page = scrapertools.find_single_match(data, "<link rel='next' href='([^']+)'")
|
|
||||||
itemlist.append(
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action="list_titles",
|
|
||||||
title="[COLOR lightgreen]" + config.get_localized_string(30992) + "[/COLOR]",
|
|
||||||
url=next_page,
|
|
||||||
thumbnail="http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png"))
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
def episodios(item):
|
def episodios(item):
|
||||||
logger.info("[cb01anime.py] episodios")
|
support.log('EPISODIOS ', item.data)
|
||||||
|
data = ''
|
||||||
itemlist = []
|
matches = item.data
|
||||||
|
season = 1
|
||||||
# Carica la pagina
|
s = 1
|
||||||
data = httptools.downloadpage(item.url).data
|
e = 0
|
||||||
# data = scrapertools.decodeHtmlentities(data)
|
for match in item.url:
|
||||||
|
if 'stagione' in match.lower():
|
||||||
patron1 = '(?:<p>|<td bgcolor="#ECEAE1">)<span class="txt_dow">(.*?)(?:</p>)?(?:\s*</span>)?\s*</td>'
|
find_season = support.match(match, r'Stagione\s*(\d+)')[0]
|
||||||
patron2 = '<a.*?href="([^"]+)"[^>]*>([^<]+)</a>'
|
season = int(find_season[0]) if find_season else season + 1 if 'prima' not in match.lower() else season
|
||||||
matches1 = re.compile(patron1, re.DOTALL).findall(data)
|
else:
|
||||||
if len(matches1) > 0:
|
title = support.match(match,'<a[^>]+>([^<]+)</a>')[0][0]
|
||||||
for match1 in re.split('<br />|<p>', matches1[0]):
|
if 'episodio' in title.lower():
|
||||||
if len(match1) > 0:
|
ep = int(support.match(match, r'Episodio (\d+)')[0][0])
|
||||||
# Estrae i contenuti
|
if season > s and ep > 1:
|
||||||
titulo = None
|
s += 1
|
||||||
scrapedurl = ''
|
e = ep - 1
|
||||||
matches2 = re.compile(patron2, re.DOTALL).finditer(match1)
|
title = str(season) + 'x' + str(ep-e).zfill(2) + ' - ' + title
|
||||||
for match2 in matches2:
|
data += title + '|' + match + '\n'
|
||||||
if titulo is None:
|
|
||||||
titulo = match2.group(2)
|
|
||||||
scrapedurl += match2.group(1) + '#' + match2.group(2) + '|'
|
|
||||||
if titulo is not None:
|
|
||||||
title = item.title + " " + titulo
|
|
||||||
itemlist.append(
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action="findvideos",
|
|
||||||
contentType="episode",
|
|
||||||
title=title,
|
|
||||||
extra=scrapedurl,
|
|
||||||
fulltitle=item.fulltitle,
|
|
||||||
show=item.show))
|
|
||||||
|
|
||||||
if config.get_videolibrary_support() and len(itemlist) != 0:
|
|
||||||
itemlist.append(
|
|
||||||
Item(channel=item.channel,
|
|
||||||
title="[COLOR lightblue]%s[/COLOR]" % config.get_localized_string(30161),
|
|
||||||
url=item.url,
|
|
||||||
action="add_serie_to_library",
|
|
||||||
extra="episodios",
|
|
||||||
show=item.show))
|
|
||||||
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================
|
patron = r'(?P<title>[^\|]+)\|(?P<url>[^\n]+)\n'
|
||||||
|
action = 'findvideos'
|
||||||
|
return locals()
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
logger.info("[cb01anime.py] findvideos")
|
return support.server(item, item.url)
|
||||||
|
|
||||||
itemlist = []
|
|
||||||
|
|
||||||
for match in item.extra.split(r'|'):
|
|
||||||
match_split = match.split(r'#')
|
|
||||||
scrapedurl = match_split[0]
|
|
||||||
if len(scrapedurl) > 0:
|
|
||||||
scrapedtitle = match_split[1]
|
|
||||||
title = item.title + " [COLOR blue][" + scrapedtitle + "][/COLOR]"
|
|
||||||
itemlist.append(
|
|
||||||
Item(channel=item.channel,
|
|
||||||
action="play",
|
|
||||||
title=title,
|
|
||||||
url=scrapedurl,
|
|
||||||
fulltitle=item.fulltitle,
|
|
||||||
show=item.show,
|
|
||||||
ontentType=item.contentType,
|
|
||||||
folder=False))
|
|
||||||
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
|
|
||||||
# =================================================================
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
def play(item):
|
|
||||||
logger.info("[cb01anime.py] play")
|
|
||||||
|
|
||||||
if '/goto/' in item.url:
|
|
||||||
item.url = item.url.split('/goto/')[-1].decode('base64')
|
|
||||||
|
|
||||||
data = item.url
|
|
||||||
|
|
||||||
logger.debug("##### Play data ##\n%s\n##" % data)
|
|
||||||
itemlist = servertools.find_video_items(data=data)
|
|
||||||
|
|
||||||
for videoitem in itemlist:
|
|
||||||
videoitem.title = item.show
|
|
||||||
videoitem.fulltitle = item.fulltitle
|
|
||||||
videoitem.show = item.show
|
|
||||||
videoitem.thumbnail = item.thumbnail
|
|
||||||
videoitem.channel = item.channel
|
|
||||||
videoitem.contentType = item.contentType
|
|
||||||
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user