Fix AnimeWorld

This commit is contained in:
Alhaziel01
2023-06-23 18:06:45 +02:00
parent 96acd612d6
commit 93f8386df6
2 changed files with 26 additions and 14 deletions
+9
View File
@@ -7,6 +7,15 @@
"banner": "animeworld.png", "banner": "animeworld.png",
"categories": ["anime", "vos"], "categories": ["anime", "vos"],
"settings": [ "settings": [
{
"id": "lang",
"type": "list",
"label": "Lingua di Ricerca",
"default": 0,
"enabled": true,
"visible": true,
"lvalues": [ "Tutte", "Ita", "Sub-Ita"]
},
{ {
"id": "order", "id": "order",
"type": "list", "type": "list",
+17 -14
View File
@@ -4,7 +4,7 @@
# thanks to fatshotty # thanks to fatshotty
# ---------------------------------------------------------- # ----------------------------------------------------------
from core import httptools, support, jsontools from core import httptools, support, config
host = support.config.get_channel_url() host = support.config.get_channel_url()
__channel__ = 'animeworld' __channel__ = 'animeworld'
@@ -23,7 +23,7 @@ def get_data(item):
# support.dbg() # support.dbg()
url = httptools.downloadpage(item.url, headers=headers, follow_redirects=True, only_headers=True).url url = httptools.downloadpage(item.url, headers=headers, follow_redirects=True, only_headers=True).url
data = support.match(url, headers=headers, follow_redirects=True).data data = support.match(url, headers=headers, follow_redirects=True).data
if 'AWCookieVerify' in data: if 'SecurityAW' in data:
get_cookie(data) get_cookie(data)
data = get_data(item) data = get_data(item)
return data return data
@@ -37,8 +37,8 @@ def order():
@support.menu @support.menu
def mainlist(item): def mainlist(item):
anime=['/filter?sort=', anime=['/filter?sort=',
('ITA',['/filter?dub=1&sort=', 'menu', '1']), ('ITA',['/filter?dub=1&sort=', 'menu', 'dub=1']),
('SUB-ITA',['/filter?dub=0&sort=', 'menu', '0']), ('SUB-ITA',['/filter?dub=0&sort=', 'menu', 'dub=0']),
('In Corso', ['/ongoing', 'peliculas','noorder']), ('In Corso', ['/ongoing', 'peliculas','noorder']),
('Ultimi Episodi', ['/updated', 'peliculas', 'updated']), ('Ultimi Episodi', ['/updated', 'peliculas', 'updated']),
('Nuove Aggiunte',['/newest', 'peliculas','noorder' ]), ('Nuove Aggiunte',['/newest', 'peliculas','noorder' ]),
@@ -50,6 +50,7 @@ def mainlist(item):
def genres(item): def genres(item):
action = 'peliculas' action = 'peliculas'
data = get_data(item) data = get_data(item)
patronBlock = r'dropdown[^>]*>\s*Generi\s*<span.[^>]+>(?P<block>.*?)</ul>' patronBlock = r'dropdown[^>]*>\s*Generi\s*<span.[^>]+>(?P<block>.*?)</ul>'
patronMenu = r'<input.*?name="(?P<name>[^"]+)" value="(?P<value>[^"]+)"\s*>[^>]+>(?P<title>[^<]+)</label>' patronMenu = r'<input.*?name="(?P<name>[^"]+)" value="(?P<value>[^"]+)"\s*>[^>]+>(?P<title>[^<]+)</label>'
@@ -75,9 +76,10 @@ def menu(item):
def submenu(item): def submenu(item):
action = 'peliculas' action = 'peliculas'
data = item.other data = item.other
# debug=True
patronMenu = r'<input.*?name="(?P<name>[^"]+)" value="(?P<value>[^"]+)"\s*>[^>]+>(?P<title>[^<]+)<\/label>' patronMenu = r'<input.*?name="(?P<name>[^"]+)" value="(?P<value>[^"]+)"\s*>[^>]+>(?P<title>[^<]+)<\/label>'
def itemHook(item): def itemHook(item):
item.url = host + '/filter?' + item.name + '=' + item.value + '&dub=' + item.args + ('&sort=' if item.name != 'sort' else '') item.url = '{}/filter?{}={}&{}{}'.format(host, item.name, item.value, item.args, ('&sort=' if item.name != 'sort' else ''))
return item return item
return locals() return locals()
@@ -85,9 +87,10 @@ def submenu(item):
def newest(categoria): def newest(categoria):
support.info(categoria) support.info(categoria)
item = support.Item() item = support.Item()
lang = config.get_setting('lang', channel=item.channel)
try: try:
if categoria == "anime": if categoria == "anime":
item.url = host + '/updated' item.url = host
item.args = "updated" item.args = "updated"
return peliculas(item) return peliculas(item)
# Continua la ricerca in caso di errore # Continua la ricerca in caso di errore
@@ -98,13 +101,13 @@ def newest(categoria):
return [] return []
def search(item, texto): def search(item, text):
support.info(texto) support.info(text)
if item.search: if item.search:
item.url = host + '/filter?dub=' + item.args + '&keyword=' + texto + '&sort=' item.url = '{}/filter?{}&keyword={}&sort='.format(host, item.args, text)
else: else:
item.args = 'noorder' lang = ['?', '?dub=1&', '?dub=0&'][config.get_setting('lang', channel=item.channel)]
item.url = host + '/search?keyword=' + texto item.url = '{}/filter{}&keyword={}&sort='.format(host, lang, text)
item.contentType = 'tvshow' item.contentType = 'tvshow'
try: try:
return peliculas(item) return peliculas(item)
@@ -118,8 +121,8 @@ def search(item, texto):
@support.scrape @support.scrape
def peliculas(item): def peliculas(item):
data = get_data(item)
anime = True anime = True
# debug = True
if item.args not in ['noorder', 'updated'] and not item.url[-1].isdigit(): item.url += order() # usa l'ordinamento di configura canale if item.args not in ['noorder', 'updated'] and not item.url[-1].isdigit(): item.url += order() # usa l'ordinamento di configura canale
data = get_data(item) data = get_data(item)
@@ -183,8 +186,8 @@ def findvideos(item):
title = support.match(url, patron=r'http[s]?://(?:www.)?([^.]+)', string=True).match title = support.match(url, patron=r'http[s]?://(?:www.)?([^.]+)', string=True).match
itemlist.append(item.clone(action="play", title=title, url=url, server='directo')) itemlist.append(item.clone(action="play", title=title, url=url, server='directo'))
else: else:
dataJson = support.match(host + '/api/episode/info?id=' + epID + '&alt=0', headers=headers).data json = support.match(host + '/api/episode/info?id=' + epID + '&alt=0', headers=headers).json
json = jsontools.load(dataJson) # json = jsontools.load(dataJson)
title = support.match(json['grabber'], patron=r'server\d+.([^.]+)', string=True).match title = support.match(json['grabber'], patron=r'server\d+.([^.]+)', string=True).match
if title: itemlist.append(item.clone(action="play", title=title, url=json['grabber'].split('=')[-1], server='directo')) if title: itemlist.append(item.clone(action="play", title=title, url=json['grabber'].split('=')[-1], server='directo'))
else: urls.append(json['grabber']) else: urls.append(json['grabber'])