Alcuni Fix

This commit is contained in:
Alhaziel01
2020-07-24 18:36:12 +02:00
parent f695069007
commit f19f534059
4 changed files with 126 additions and 95 deletions

View File

@@ -3,32 +3,72 @@
# Canale per AnimeSaturn
# ----------------------------------------------------------
from lib import js2py
from core import support
from platformcode import config
host = support.config.get_channel_url()
headers={'X-Requested-With': 'XMLHttpRequest'}
def get_data(item, head=[]):
global headers
for h in head:
headers[h[0]] = h[1]
if not item.count: item.count = 0
jstr, location = support.match(item, patron=r'<script>(.*?location.href="([^"]+)";)</').match
item.url=location.replace('http://','https://')
if not config.get_setting('key', item.channel) and jstr:
jshe = 'var document = {}, location = {}'
aesjs = str(support.match(host + '/aes.min.js').data)
js_fix = 'window.toHex = window.toHex || function(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}'
jsret = 'return document.cookie'
key_data = js2py.eval_js( 'function (){ ' + jshe + '\n' + aesjs + '\n' + js_fix + '\n' + jstr + '\n' + jsret + '}' )()
key = key_data.split(';')[0]
# save Key in settings
config.set_setting('key', key, item.channel)
# set cookie
headers['cookie'] = config.get_setting('key', item.channel)
res = support.match(item, headers=headers, patron=r';\s*location.href="([^"]+)"')
if res.match:
item.url= res.match.replace('http://','https://')
data = support.match(item, headers=headers).data
else:
data = res.data
#check that the key is still valid
if 'document.cookie=' in data and item.count < 3:
item.count += 1
config.set_setting('key', '', item.channel)
return get_data(item)
return data
@support.menu
def mainlist(item):
anime = ['/animelist?load_all=1',
anime = ['/animelist?load_all=1&d=1',
('Più Votati',['/toplist','menu', 'top']),
('In Corso',['/animeincorso','peliculas','incorso']),
('Ultimi Episodi',['/fetch_pages.php?request=episodes','peliculas','updated'])]
('Ultimi Episodi',['/fetch_pages.php?request=episodes&d=1','peliculas','updated'])]
return locals()
@support.scrape
def search(item, texto):
search = texto
# debug = True
support.log(texto)
item.url = host + '/animelist?search=' + texto
item.contentType = 'tvshow'
anime = True
patron = r'href="(?P<url>[^"]+)"[^>]*>(?P<title>[^<]+)(?:\((?P<lang>ITA)\))?(?:(?P<year>\((\d+)\)))?</a>.*?<p[^>]+>(?P<plot>[^<]+).*?<img src="(?P<thumbnail>[^"]+)'
action = 'check'
return locals()
try:
return peliculas(item)
# Continua la ricerca in caso di errore
except:
import sys
for line in sys.exc_info():
support.logger.error("%s" % line)
return []
def newest(categoria):
@@ -37,7 +77,7 @@ def newest(categoria):
item = support.Item()
try:
if categoria == "anime":
item.url = host + '/fetch_pages.php?request=episodes'
item.url = host + '/fetch_pages.php?request=episodes&d=1'
item.args = "updated"
return peliculas(item)
# Continua la ricerca in caso di errore
@@ -49,8 +89,10 @@ def newest(categoria):
return itemlist
@support.scrape
def menu(item):
data=get_data(item)
patronMenu = r'<div class="col-md-13 bg-dark-as-box-shadow p-2 text-white text-center">(?P<title>[^"<]+)<(?P<other>.*?)(?:"lista-top"|"clearfix")'
action = 'peliculas'
item.args = 'top'
@@ -63,19 +105,18 @@ def menu(item):
@support.scrape
def peliculas(item):
data = get_data(item)
anime = True
# debug = True
deflang= 'Sub-ITA'
action = 'check'
# debug = True
page = None
post = "page=" + str(item.page if item.page else 1) if item.page > 1 else None
if item.args == 'top':
data = item.other
patron = r'light">(?P<title2>[^<]+)</div>\s(?P<title>[^<]+)[^>]+>[^>]+>\s<a href="(?P<url>[^"]+)">(?:<a[^>]+>|\s*)<img.*?src="(?P<thumb>[^"]+)"'
patron = r'light">(?P<title2>[^<]+)</div>\s*(?P<title>[^<]+)[^>]+>[^>]+>\s*<a href="(?P<url>[^"]+)">(?:<a[^>]+>|\s*)<img.*?src="(?P<thumb>[^"]+)"'
else:
data = support.match(item, post=post, headers=headers).data
if item.args == 'updated':
@@ -98,14 +139,12 @@ def peliculas(item):
def check(item):
movie = support.match(item, patron=r'Episodi:</b> (\d*) Movie')
# anime_id = support.match(movie.data, patron=r'anime_id=(\d+)').match
# item.url = host + "/loading_anime?anime_id=" + anime_id
movie = support.match(get_data(item), patron=r'Episodi:</b> (\d*) Movie')
if movie.match:
item.contentType = 'movie'
episodes = episodios(item)
if len(episodes) > 0: item.url = episodes[0].url
return findvideos(item)
if len(episodes) > 0:
it = episodes[0].clone(contentType = 'movie', contentTitle=item.fulltitle, contentSerieName='')
return findvideos(it)
else:
item.contentType = 'tvshow'
return episodios(item)
@@ -113,21 +152,32 @@ def check(item):
@support.scrape
def episodios(item):
data = get_data(item)
if item.contentType != 'movie': anime = True
patron = r'episodi-link-button"> <a href="(?P<url>[^"]+)"[^>]+>\s*(?P<title>[^<]+)</a>'
patron = r'episodi-link-button">\s*<a href="(?P<url>[^"]+)"[^>]+>\s*(?P<title>[^<]+)</a>'
return locals()
def findvideos(item):
support.log()
itemlist = []
url = support.match(item, patron=r'<a href="([^"]+)">[^>]+>[^>]+>G', headers=headers, debug=False).match
support.log(url)
if url:
links = support.match(url, patron=r'(?:<source type="[^"]+"\s*src=|file:\s*)"([^"]+)"', headers=headers, debug=False).matches
for link in links:
itemlist.append(item.clone(action="play", title='Diretto', url=link, server='directo'))
return support.server(item, itemlist=itemlist)
page_data = ''
titles =['Primario', 'Secondario', 'Alternativo Primario', 'Alternativo Secondario']
url = support.match(get_data(item), patron=r'<a href="([^"]+)">[^>]+>[^>]+>G', headers=headers).match
urls = [url, url+'&extra=1', url+'&s=alt', url+'&s=alt&extra=1']
links = []
for i, url in enumerate(urls):
data = support.match(url, headers=headers).data
if not '&s' in url:
link = support.match(data, patron=r'(?:<source type="[^"]+"\s*src=|file:\s*)"([^"]+)"', headers=headers).match
else:
link = support.match(data, headers=headers, patron=r'file:\s*"([^"]+)"').match
if not link:
page_data += data
if link not in links:
links.append(link)
itemlist.append(item.clone(action="play", title=titles[i], url=link, server='directo'))
return support.server(item, data=data, itemlist=itemlist)

View File

@@ -23,25 +23,28 @@ def get_data(item, head=[]):
for h in head:
headers[h[0]] = h[1]
if not item.count: item.count = 0
if not config.get_setting('key', item.channel):
# resolve js for key
jstr = support.match(item.url, patron=r'<script>(.*?)</').match
if jstr:
jshe = 'var document = {}, location = {}'
aesjs = str(support.match(host + '/aes.min.js').data)
js_fix = 'window.toHex = window.toHex || function(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}'
jsret = 'return document.cookie'
key_data = js2py.eval_js( 'function (){ ' + jshe + '\n' + aesjs + '\n' + js_fix + '\n' + jstr + '\n' + jsret + '}' )
key = key_data().split(';')[0]
jstr, location = support.match(item, patron=r'<script>(.*?location.href="([^"]+)";)</').match
item.url=location.replace('http://','https://')
if not config.get_setting('key', item.channel) and jstr:
jshe = 'var document = {}, location = {}'
aesjs = str(support.match(host + '/aes.min.js').data)
js_fix = 'window.toHex = window.toHex || function(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}'
jsret = 'return document.cookie'
key_data = js2py.eval_js( 'function (){ ' + jshe + '\n' + aesjs + '\n' + js_fix + '\n' + jstr + '\n' + jsret + '}' )()
key = key_data.split(';')[0]
# save Key in settings
config.set_setting('key', key, item.channel)
# save Key in settings
config.set_setting('key', key, item.channel)
# set cookie
headers['cookie'] = config.get_setting('key', item.channel)
res = support.match(item, headers=headers, patron=r'location.href="([^"]+)')
if res.match: data = support.match(res.match.replace('http://','https://'), headers=headers).data
else: data = res.data
res = support.match(item, headers=headers, patron=r';\s*location.href="([^"]+)"')
if res.match:
item.url= res.match.replace('http://','https://')
data = support.match(item, headers=headers).data
else:
data = res.data
#check that the key is still valid
if 'document.cookie=' in data and item.count < 3:
@@ -54,8 +57,8 @@ def get_data(item, head=[]):
@support.menu
def mainlist(item):
anime=['/filter?sort=',
('ITA',['/filter?language[]=1&sort=', 'menu', '1']),
('SUB-ITA',['/filter?language[]=0&sort=', 'menu', '0']),
('ITA',['/filter?dub=1&sort=', 'menu', '1']),
('SUB-ITA',['/filter?dub=0&sort=', 'menu', '0']),
('In Corso', ['/ongoing', 'peliculas','noorder']),
('Ultimi Episodi', ['/updated', 'peliculas', 'updated']),
('Nuove Aggiunte',['/newest', 'peliculas','noorder' ]),
@@ -80,8 +83,7 @@ def genres(item):
def menu(item):
action = 'submenu'
data = get_data(item)
patronBlock=r'<form class="filters.*?>(?P<block>.*?)</form>'
patronMenu=r'<button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown"> (?P<title>.*?) <span.[^>]+>(?P<other>.*?)</ul>'
patronMenu=r'<button[^>]+>\s*(?P<title>[A-Za-z0-9]+)\s*<span.[^>]+>(?P<other>.*?)</ul>'
def itemlistHook(itemlist):
item.title = support.typo('Tutti','bold')
@@ -97,7 +99,7 @@ def submenu(item):
data = item.other
patronMenu = r'<input.*?name="(?P<name>[^"]+)" value="(?P<value>[^"]+)"\s*>[^>]+>(?P<title>[^<]+)<\/label>'
def itemHook(item):
item.url = host + '/filter?' + item.name + '=' + item.value + '&language[]=' + item.args + '&sort='
item.url = host + '/filter?' + item.name + '=' + item.value + '&dub=' + item.args + '&sort='
return item
return locals()
@@ -139,21 +141,20 @@ def peliculas(item):
anime=True
if item.args == 'updated':
item.contentType='episode'
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'
else:
if item.args != 'noorder' and not item.url[-1].isdigit(): item.url += order() # usa l'ordinamento di configura canale
patron= r'<div class="inner">\s*<a href="(?P<url>[^"]+)" class[^>]+>\s*<img src="(?P<thumb>[^"]+)" alt?="(?P<title>[^\("]+)(?:\((?P<year>\d+)\) )?(?:\((?P<lang>[^\)]+)\))?"[^>]+>[^>]+>(?:\s*<div class="dub">[^>]+>)?\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<year>\d+)\) )?(?:\((?P<lang>[^\)]+)\))?"[^>]+>[^>]+>(?:\s*<div class="(?P<l>[^"]+)">[^>]+>)?\s*(?:<div class="[^"]+">(?P<type>[^<]+)</div>)?'
action='episodios'
# Controlla la lingua se assente
patronNext=r'href="([^"]+)" rel="next"'
type_content_dict={'movie':['movie', 'special']}
type_action_dict={'findvideos':['movie', 'special']}
check_lang = item.url.replace('%5B0%5D','[]')
typeContentDict={'movie':['movie', 'special']}
typeActionDict={'findvideos':['movie', 'special']}
def itemHook(item):
if not item.contentLanguage:
if 'language[]=1' in check_lang:
if 'dub=1' in item.url or item.l == 'dub':
item.contentLanguage = 'ITA'
item.title += support.typo(item.contentLanguage,'_ [] color kod')
else:
@@ -167,12 +168,10 @@ def peliculas(item):
def episodios(item):
anime=True
pagination = 50
item.url += '?d=1'
data = get_data(item)
support.log(data)
if 'VVVVID' in data: patronBlock= r'<div class="server\s*active\s*"(?P<block>.*?)</ul>'
else: patronBlock= r'server active(?P<block>.*?)server hidden '
patron = r'<li><a [^=]+="[^"]+"[^=]+="[^"]+"[^=]+="[^"]+"[^=]+="[^"]+"[^=]+="[^"]+" href="(?P<url>[^"]+)"[^>]+>(?P<episode>[^<]+)<'
patronBlock= r'<div class="server\s*active\s*"(?P<block>.*?)<div class="server'
patron = r'<li[^>]*>\s*<a.*?href="(?P<url>[^"]+)"[^>]*>(?P<episode>[^<]+)<'
def itemHook(item):
item.number = support.re.sub(r'\[[^\]]+\]', '', item.title)
item.title += support.typo(item.fulltitle,'-- bold')
@@ -185,39 +184,21 @@ def findvideos(item):
import time
support.log(item)
itemlist = []
# support.dbg()
matches = support.match(get_data(item), patron=r'data-name="([0-9]+)">', headers=headers)
data = matches.data
matches = matches.matches
videoData = []
for serverid in matches:
if not item.number: item.number = support.match(item.title, patron=r'(\d+) -').match
block = support.match(data, patron=r'data-name="' + serverid + r'"[^>]+>(.*?)<div class="server').match
match = support.match(block, patron=r'<a data-id="([^"]+)" data-base="' + (item.number if item.number else '1') + '"' + r'.*?href="([^"]+)"').match
if match:
ID, url = match
if serverid in ['18', '15']:
url = support.match('%s/ajax/episode/serverPlayer?id=%s' % (host, ID), patron=r'source src="([^"]+)"', headers=headers).match
itemlist.append(item.clone(action="play", title='Diretto', url=url, server='directo'))
elif serverid == '26':
matches = support.match('%s/ajax/episode/serverPlayer?id=%s' % (host, item.url.split('/')[-1]), patron=r'<a href="([^"]+)"', ).matches
for url in matches:
videoData.append(url)
elif serverid == '39':
videoData.append(support.match(get_data(item.clone(url=host + url)), patron=r'href="([^"]+)" id="downloadLink"').match)
else:
try:
dataJson=get_data(item.clone(url='%s/ajax/episode/info?id=%s&server=%s&ts=%s' % (host, ID, serverid, int(time.time()))), head=[['x-requested-with', 'XMLHttpRequest']])
json = jsontools.load(dataJson)
support.log(json)
url = json['grabber']
if 'server2' in url:
itemlist.append(item.clone(action="play", title='AnimeWorld 2', url=url.split('=')[-1], server='directo'))
else:
videoData.append(url)
except:
pass
return support.server(item, videoData, itemlist)
urls = []
resp = support.match(get_data(item), headers=headers, patron=r'data-name="(\d+)">([^<]+)<')
data = resp.data
for ID, name in resp.matches:
if 'vvvvid' in name.lower():
urls.append(support.match(host + '/api/episode/serverPlayer?id=' + item.url.split('/')[-1].split('?')[0], headers=headers, patron=r'<a.*?href="([^"]+)"').match)
elif 'streamtape' in name.lower():
urls.append(support.match(data, patron=r'<a href="(https://streamtape[^"]+)"').match)
elif 'beta' in name.lower():
urls.append(support.match(data, patron=r'<a href="(https://animeworld[^"]+)"').match)
elif 'server 2' in name.lower():
dataJson = support.match(host + '/api/episode/info?id=' + item.url.split('/')[-1].split('?')[0] +'&alt=0', headers=headers).data
json = jsontools.load(dataJson)
itemlist.append(item.clone(action="play", title=name, url=json['grabber'], server='directo'))
elif 'animeworld' in name.lower():
url = support.match(resp.data, patron=r'href="([^"]+)"\s*id="alternativeDownloadLink"', headers=headers).match
itemlist.append(item.clone(action="play", title=name, url=url, server='directo'))
return support.server(item, urls, itemlist)

View File

@@ -106,7 +106,7 @@
<setting id="library_move" type="bool" label="70231" visible="eq(-3,true)" default="true"/>
<setting id="browser" type="bool" label="70232" visible="eq(-4,true)" default="true"/>
<setting id="server_speed" type="bool" label="70242" visible="eq(-5,true)" default="true"/>
<setting id="language" type="select" label="70246" values="ITA|Sub-ITA" visible="eq(-6,true)" default="0"/>
<setting id="language" type="select" label="70246" values="ITA|Sub-ITA" visible="eq(-6,true)" default="ITA"/>
<setting id="quality" type="select" label="70240" lvalues="70241|70763|70764|70765" visible="eq(-7,true)" default="0"/>
<setting id="download_adv" type="action" label="30030" visible="eq(-7,true)" action="RunPlugin(plugin://plugin.video.kod/?ew0KCSJhY3Rpb24iOiJjaGFubmVsX2NvbmZpZyIsDQoJImNvbmZpZyI6ImRvd25sb2FkcyIsDQogICAgImNoYW5uZWwiOiJzZXR0aW5nIg0KfQ==)"/>
</category>

View File

@@ -4,7 +4,7 @@
"ignore_urls": [],
"patterns": [
{
"pattern": "(https://animeworld.biz/v/[a-zA-Z0-9/-]+)",
"pattern": "(https://animeworld.biz/[vf]/[a-zA-Z0-9/-]+)",
"url": "\\1"
}
]