Fix AnimeWorld

This commit is contained in:
Alhaziel
2019-09-02 19:16:29 +02:00
parent 5774df2e62
commit e97ea67535
2 changed files with 50 additions and 117 deletions
+4 -69
View File
@@ -3,84 +3,19 @@
"name": "AnimeWorld", "name": "AnimeWorld",
"active": true, "active": true,
"adult": false, "adult": false,
"language": ["ita"], "language": ["ita", "vos", "vosi"],
"thumbnail": "animeworld.png", "thumbnail": "animeworld.png",
"banner": "animeworld.png", "banner": "animeworld.png",
"categories": ["anime"], "categories": ["anime"],
"settings": [ "settings": [
{ {
"id": "channel_host", "id": "order",
"type": "text",
"label": "Host del canale",
"default": "https://www.animeworld.it",
"enabled": true,
"visible": true
},
{
"id": "include_in_global_search",
"type": "bool",
"label": "Includi ricerca globale",
"default": false,
"enabled": false,
"visible": false
},
{
"id": "include_in_newest_anime",
"type": "bool",
"label": "Includi in Novità - Anime",
"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", "type": "list",
"label": "Numero de link da verificare", "label": "Ordine di Visualizzazione",
"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, "default": 0,
"enabled": true, "enabled": true,
"visible": true, "visible": true,
"lvalues": ["No filtrar","Italiano"] "lvalues": [ "Standard", "Ultime Aggiunte", "Lista A-Z", "Data di Uscita" ]
},
{
"id": "autorenumber",
"type": "bool",
"label": "@70712",
"default": false,
"enabled": true,
"visible": true
},
{
"id": "autorenumber_mode",
"type": "bool",
"label": "@70688",
"default": false,
"enabled": true,
"visible": "eq(-1,true)"
} }
] ]
} }
+46 -48
View File
@@ -2,19 +2,13 @@
# ------------------------------------------------------------ # ------------------------------------------------------------
# Canale per animeworld # Canale per animeworld
# ---------------------------------------------------------- # ----------------------------------------------------------
import re
import time
import urllib
import urlparse
from core import httptools, scrapertoolsV2, servertools, tmdb, support, jsontools
from core.support import log
from core.item import Item from core import support, jsontools
from platformcode import logger, config
from specials import autoplay, autorenumber
__channel__ = "animeworld" __channel__ = "animeworld"
host = config.get_channel_url(__channel__) host = support.config.get_channel_url(__channel__)
headers = [['Referer', host]] headers = [['Referer', host]]
IDIOMAS = {'Italiano': 'Italiano'} IDIOMAS = {'Italiano': 'Italiano'}
@@ -23,50 +17,54 @@ list_servers = ['animeworld', 'verystream', 'streamango', 'openload', 'directo']
list_quality = ['default', '480p', '720p', '1080p'] list_quality = ['default', '480p', '720p', '1080p']
def order():
return str(support.config.get_setting("order", __channel__))
@support.menu @support.menu
def mainlist(item): def mainlist(item):
anime=['/filter', anime=['/filter?sort=',
('ITA',['/filter?language%5B%5D=1&sort=2', 'build_menu', 'language[]=1']), ('ITA',['/filter?language[]=1&sort=', 'build_menu', 'order']),
('SUB-ITA',['/filter?language%5B%5D=1&sort=2', 'build_menu', 'language[]=0']), ('SUB-ITA',['/filter?language[]=0&sort=', 'build_menu', 'order']),
('In Corso', ['/ongoing', 'peliculas']), ('In Corso', ['/ongoing', 'peliculas']),
('Ultimi Episodi', ['/updated', 'peliculas', 'updated']), ('Ultimi Episodi', ['/updated', 'peliculas', 'updated']),
('Nuove Aggiunte',['/newest', 'peliculas' ]), ('Nuove Aggiunte',['/newest', 'peliculas' ]),
('Generi',['','genres', '</i> Generi</a>'])] ('Generi',['','genres',])]
return locals() return locals()
# Crea menu ===================================================
@support.scrape
def genres(item): def genres(item):
patronBlock = r'</i> Generi</a>(?P<block>.*?)</ul>' support.log()
patronMenu = r'<a href="(?P<url>[^"]+)"\stitle="(?P<title>[^"]+)">' itemlist = []
action = 'peliculas' matches = support.match(item, r'<input.*?name="([^"]+)" value="([^"]+)"\s*>[^>]+>([^<]+)<\/label>' , r'<button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown"> Generi <span.[^>]+>(.*?)</ul>', headers=headers)[0]
return locals() for name, value, title in matches:
support.menuItem(itemlist, __channel__, support.typo(title, 'bold'), 'peliculas', host + '/filter?' + name + '=' + value + '&sort=' + order(), 'tvshow', args='sub')
return itemlist
def build_menu(item): def build_menu(item):
log() support.log()
itemlist = [] itemlist = []
support.menuItem(itemlist, __channel__, 'Tutti bold', 'peliculas', item.url, 'tvshow' , args=item.args) support.menuItem(itemlist, __channel__, 'Tutti bold', 'peliculas', item.url , 'tvshow' , args=item.args)
matches = support.match(item,r'<button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown"> (.*?) <span.[^>]+>(.*?)</ul>',r'<form class="filters.*?>(.*?)</form>')[0] matches = support.match(item,r'<button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown"> (.*?) <span.[^>]+>(.*?)</ul>',r'<form class="filters.*?>(.*?)</form>', headers=headers)[0]
for title, html in matches: for title, html in matches:
if title not in 'Lingua Ordine': if title not in 'Lingua Ordine':
support.menuItem(itemlist, __channel__, title + ' submenu bold', 'build_sub_menu', html, 'tvshow', args=item.args) support.menuItem(itemlist, __channel__, title + ' submenu bold', 'build_sub_menu', html, 'tvshow', args=item.args)
return itemlist return itemlist
def build_sub_menu(item): def build_sub_menu(item):
log() support.log()
itemlist = [] itemlist = []
matches = support.re.compile(r'<input.*?name="([^"]+)" value="([^"]+)"\s*>[^>]+>([^<]+)<\/label>', re.DOTALL).findall(item.url) matches = support.re.compile(r'<input.*?name="([^"]+)" value="([^"]+)"\s*>[^>]+>([^<]+)<\/label>', support.re.DOTALL).findall(item.url)
for name, value, title in matches: for name, value, title in matches:
support.menuItem(itemlist, __channel__, support.typo(title, 'bold'), 'peliculas', host + '/filter?&' + name + '=' + value + '&' + item.args + '&sort=2', 'tvshow', args='sub') support.menuItem(itemlist, __channel__, support.typo(title, 'bold'), 'peliculas', host + '/filter?' + name + '=' + value + '&sort=' + order(), 'tvshow', args='sub')
return itemlist return itemlist
# Novità ======================================================
def newest(categoria): def newest(categoria):
log() support.log(categoria)
itemlist = [] item = support.Item()
item = Item()
try: try:
if categoria == "anime": if categoria == "anime":
item.url = host + '/updated' item.url = host + '/updated'
@@ -76,16 +74,12 @@ def newest(categoria):
except: except:
import sys import sys
for line in sys.exc_info(): for line in sys.exc_info():
logger.error("{0}".format(line)) support.logger.error("{0}".format(line))
return [] return []
return itemlist
# Cerca ===========================================================
def search(item, texto): def search(item, texto):
log(texto) support.log(texto)
item.url = host + '/search?keyword=' + texto item.url = host + '/search?keyword=' + texto
try: try:
return peliculas(item) return peliculas(item)
@@ -93,10 +87,9 @@ def search(item, texto):
except: except:
import sys import sys
for line in sys.exc_info(): for line in sys.exc_info():
logger.error("%s" % line) support.logger.error("%s" % line)
return [] return []
# Scrapers ========================================================
@support.scrape @support.scrape
def peliculas(item): def peliculas(item):
@@ -105,9 +98,15 @@ def peliculas(item):
patron=r'<div class="inner">\s*<a href="(?P<url>[^"]+)" class[^>]+>\s*<img src="(?P<thumb>[^"]+)" alt?="(?P<title>[^\("]+)(?:\((?P<lang>[^\)]+)\))?"[^>]+>[^>]+>\s*(?:<div class="[^"]+">(?P<type>[^<]+)</div>)?[^>]+>[^>]+>\s*<div class="ep">[^\d]+(?P<episode>\d+)[^<]*</div>' patron=r'<div class="inner">\s*<a href="(?P<url>[^"]+)" class[^>]+>\s*<img src="(?P<thumb>[^"]+)" alt?="(?P<title>[^\("]+)(?:\((?P<lang>[^\)]+)\))?"[^>]+>[^>]+>\s*(?:<div class="[^"]+">(?P<type>[^<]+)</div>)?[^>]+>[^>]+>\s*<div class="ep">[^\d]+(?P<episode>\d+)[^<]*</div>'
action='findvideos' action='findvideos'
else: else:
if item.args == 'order': item.url += order()
patron= r'<div class="inner">\s*<a href="(?P<url>[^"]+)" class[^>]+>\s*<img src="(?P<thumb>[^"]+)" alt?="(?P<title>[^\("]+)(?:\((?P<lang>[^\)]+)\))?"[^>]+>[^>]+>[^>]+>[^>]+>\s*(?:<div class="[^"]+">(?P<type>[^<]+)</div>)?' patron= r'<div class="inner">\s*<a href="(?P<url>[^"]+)" class[^>]+>\s*<img src="(?P<thumb>[^"]+)" alt?="(?P<title>[^\("]+)(?:\((?P<lang>[^\)]+)\))?"[^>]+>[^>]+>[^>]+>[^>]+>\s*(?:<div class="[^"]+">(?P<type>[^<]+)</div>)?'
action='episodios' action='episodios'
def itemHook(item):
support.log('Lingua= ',item.contentLanguage)
if item.contentLanguage == '':
item.contentLanguage = 'Sub-ITA'
item.title += support.typo(item.contentLanguage,'_ [] color kod')
return item
patronNext=r'href="([^"]+)" rel="next"' patronNext=r'href="([^"]+)" rel="next"'
type_content_dict={'movie':['movie']} type_content_dict={'movie':['movie']}
type_action_dict={'findvideos':['movie']} type_action_dict={'findvideos':['movie']}
@@ -120,7 +119,6 @@ def episodios(item):
patronBlock= r'server active(?P<block>.*?)server hidden ' patronBlock= r'server active(?P<block>.*?)server hidden '
patron = r'<li><a [^=]+="[^"]+"[^=]+="[^"]+"[^=]+="[^"]+"[^=]+="[^"]+"[^=]+="[^"]+" href="(?P<url>[^"]+)"[^>]+>(?P<episode>[^<]+)<' patron = r'<li><a [^=]+="[^"]+"[^=]+="[^"]+"[^=]+="[^"]+"[^=]+="[^"]+"[^=]+="[^"]+" href="(?P<url>[^"]+)"[^>]+>(?P<episode>[^<]+)<'
def itemHook(item): def itemHook(item):
log('FULLTITLE= ',item)
item.title += support.typo(item.fulltitle,'-- bold') item.title += support.typo(item.fulltitle,'-- bold')
return item return item
action='findvideos' action='findvideos'
@@ -128,24 +126,24 @@ def episodios(item):
def findvideos(item): def findvideos(item):
log(item) import time
support.log(item)
itemlist = [] itemlist = []
matches, data = support.match(item, r'class="tab.*?data-name="([0-9]+)">', headers=headers) matches, data = support.match(item, r'class="tab.*?data-name="([0-9]+)">', headers=headers)
videoData = '' videoData = ''
for serverid in matches: for serverid in matches:
number = scrapertoolsV2.find_single_match(item.title,r'(\d+) -') number = support.scrapertoolsV2.find_single_match(item.title,r'(\d+) -')
block = scrapertoolsV2.find_multiple_matches(data,'data-id="' + serverid + '">(.*?)<div class="server') block = support.scrapertoolsV2.find_multiple_matches(data,'data-id="' + serverid + '">(.*?)<div class="server')
ID = scrapertoolsV2.find_single_match(str(block),r'<a data-id="([^"]+)" data-base="' + (number if number else '1') + '"') ID = support.scrapertoolsV2.find_single_match(str(block),r'<a data-id="([^"]+)" data-base="' + (number if number else '1') + '"')
log('ID= ',ID)
if id: if id:
dataJson = httptools.downloadpage('%s/ajax/episode/info?id=%s&server=%s&ts=%s' % (host, ID, serverid, int(time.time())), headers=[['x-requested-with', 'XMLHttpRequest']]).data dataJson = support.httptools.downloadpage('%s/ajax/episode/info?id=%s&server=%s&ts=%s' % (host, ID, serverid, int(time.time())), headers=[['x-requested-with', 'XMLHttpRequest']]).data
json = jsontools.load(dataJson) json = jsontools.load(dataJson)
videoData +='\n'+json['grabber'] videoData +='\n'+json['grabber']
if serverid == '28': if serverid == '28':
itemlist.append( itemlist.append(
Item( support.Item(
channel=item.channel, channel=item.channel,
action="play", action="play",
title='diretto', title='diretto',