From 2867f2845814f419e35a36671163bce72e40cb0f Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Wed, 29 Jul 2020 19:58:16 +0200 Subject: [PATCH] Aggiunto AnimeUniverse --- channels.json | 1 + channels/animeuniverse.json | 21 +++++++++ channels/animeuniverse.py | 87 +++++++++++++++++++++++++++++++++++++ core/support.py | 3 ++ 4 files changed, 112 insertions(+) create mode 100644 channels/animeuniverse.json create mode 100644 channels/animeuniverse.py diff --git a/channels.json b/channels.json index 65c8f414..6d8b6ae5 100644 --- a/channels.json +++ b/channels.json @@ -9,6 +9,7 @@ "animesubita": "http://www.animesubita.org", "animetubeita": "http://www.animetubeita.com", "animeunity": "https://www.animeunity.it", + "animeuniverse" : "https://www.animeuniverse.it/", "animeworld": "https://www.animeworld.tv", "casacinema": "https://www.casacinema.rest", "cb01anime": "https://www.cineblog01.red", diff --git a/channels/animeuniverse.json b/channels/animeuniverse.json new file mode 100644 index 00000000..34f11412 --- /dev/null +++ b/channels/animeuniverse.json @@ -0,0 +1,21 @@ +{ + "id": "animeuniverse", + "name": "AnimeUniverse", + "active": true, + "language": ["ita", "sub-ita"], + "thumbnail": "animeuniverse.png", + "banner": "animeuniverse.png", + "categories": ["anime", "sub-ita"], + "not_active": ["include_in_newest"], + "settings": [ + { + "id": "perpage", + "type": "list", + "label": "Elementi per pagina", + "default": 3, + "enabled": true, + "visible": true, + "lvalues": ["20","30","40","50","60","70","80","90","100"] + } + ] +} diff --git a/channels/animeuniverse.py b/channels/animeuniverse.py new file mode 100644 index 00000000..e16e1b5a --- /dev/null +++ b/channels/animeuniverse.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# Canale per animeuniverse +# ---------------------------------------------------------- + +from core import support + +host = support.config.get_channel_url() +headers = {} + +perpage_list = ['20','30','40','50','60','70','80','90','100'] +perpage = perpage_list[support.config.get_setting('perpage' , 'animeuniverse')] + + +@support.menu +def mainlist(item): + anime=['/anime/', + ('Tipo',['', 'menu', 'Anime']), + ('Anno',['', 'menu', 'Anno']), + ('Genere', ['', 'menu','Genere']), + ('Hentai', ['/hentai/', 'peliculas'])] + return locals() + + +@support.scrape +def menu(item): + action = 'peliculas' + data = support.match(item, patron= item.args + r'').match + patronMenu = r'(?P[^<]+)<' + return locals() + + +def search(item, texto): + support.log(texto) + item.search = texto + 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 [] + + +@support.scrape +def peliculas(item): + if '/mos/' in item.url: + item.contentType = 'movie' + action='findvideos' + else: + item.contentType = 'tvshow' + action='episodios' + if item.search: + query = 's' + searchtext = item.search + else: + query='category_name' + searchtext = item.url.split('/')[-2] + if not item.pag: item.pag = 1 + + anime=True + data = support.match(host + '/wp-content/themes/animeuniverse/functions/ajax.php', post='sorter=recent&location=&loop=main+loop&action=sort&numarticles='+perpage+'&paginated='+str(item.pag)+'¤tquery%5B'+query+'%5D='+searchtext+'&thumbnail=1').data.replace('\\','') + patron=r'<a href="(?P<url>[^"]+)"><img width="[^"]+" height="[^"]+" src="(?P<thumb>[^"]+)" class="[^"]+" alt="" title="(?P<title>[^\["]+)\s+(?P<lang>(?:[Ss][Uu][Bb].)?[Ii][Tt][Aa])' + + def ItemItemlistHook(item, itemlist): + if len(itemlist) == int(perpage): + item.pag += 1 + itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), action='peliculas')) + return itemlist + return locals() + + + + +@support.scrape +def episodios(item): + pagination = int(perpage) + patron = r'<td>\s*(?P<title>[A-Za-z]+ \d+)[^>]+>[^>]+>\s*<a href="(?P<url>[^"]+)"' + return locals() + + +def findvideos(item): + url = support.match(support.httptools.downloadpage(item.url).url, string=True, patron=r'file=([^$]+)').match + if 'http' not in url: url = 'http://' + url + itemlist=[item.clone(title='Diretto', url=url, server='directo', action='play')] + return support.server(item, itemlist=itemlist) diff --git a/core/support.py b/core/support.py index dffea303..61214289 100755 --- a/core/support.py +++ b/core/support.py @@ -475,6 +475,9 @@ def scrape(func): if 'itemlistHook' in args: itemlist = args['itemlistHook'](itemlist) + if 'ItemItemlistHook' in args: + itemlist = args['ItemItemlistHook'](item, itemlist) + # if url may be changed and channel has findhost to update if 'findhost' in func.__globals__ and not itemlist: logger.info('running findhost ' + func.__module__)