From d6c338e9499f8c333654dd4c8a80ac933f0eb2ee Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Fri, 31 Jul 2020 09:22:25 +0200 Subject: [PATCH 1/6] Fix Ricerca in cache --- platformcode/launcher.py | 4 ++-- specials/search.py | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/platformcode/launcher.py b/platformcode/launcher.py index e1e97ed4..36242bee 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -245,7 +245,7 @@ def run(item=None): # Special action for searching, first asks for the words then call the "search" function elif item.action == "search": # from core.support import dbg;dbg() - if filetools.isfile(temp_search_file): + if filetools.isfile(temp_search_file) and config.get_setting('videolibrary_kodi'): itemlist = [] f = filetools.read(temp_search_file) strList = f.split(',') @@ -356,7 +356,7 @@ def new_search(item, channel=None): return itemlist def set_search_temp(item): - if filetools.isfile(temp_search_file): + if filetools.isfile(temp_search_file) and config.get_setting('videolibrary_kodi'): f = '[V],' + filetools.read(temp_search_file) filetools.write(temp_search_file, f) diff --git a/specials/search.py b/specials/search.py index 164f72e9..821f28f9 100644 --- a/specials/search.py +++ b/specials/search.py @@ -201,8 +201,7 @@ def channel_search(item): searching_titles += channel_titles cnt = 0 - progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(70744) % len(channel_list), - ', '.join(searching_titles)) + progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(70744) % len(channel_list), ', '.join(searching_titles)) config.set_setting('tmdb_active', False) search_action_list = [] @@ -250,14 +249,12 @@ def channel_search(item): cnt += 1 searching_titles.remove(searching_titles[searching.index(channel)]) searching.remove(channel) - progress.update(old_div(((total_search_actions - len(search_action_list)) * 100), total_search_actions), config.get_localized_string(70744) % str(len(channel_list) - cnt), - ', '.join(searching_titles)) + progress.update(old_div(((total_search_actions - len(search_action_list)) * 100), total_search_actions), config.get_localized_string(70744) % str(len(channel_list) - cnt), ', '.join(searching_titles)) progress.close() cnt = 0 - progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(60295), - config.get_localized_string(60293)) + progress = platformtools.dialog_progress(config.get_localized_string(30993) % item.title, config.get_localized_string(60295), config.get_localized_string(60293)) config.set_setting('tmdb_active', True) # res_count = 0 From 6cda4be6914b2a4aa359db32031020631194d9db Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Fri, 31 Jul 2020 09:23:24 +0200 Subject: [PATCH 2/6] Aggiunto AnimeAltadefinizione e fix AnimeUniverse --- channels.json | 1 + channels/animealtadefinizione.json | 21 ++++++ channels/animealtadefinizione.py | 107 +++++++++++++++++++++++++++++ channels/animeuniverse.py | 26 +++++-- 4 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 channels/animealtadefinizione.json create mode 100644 channels/animealtadefinizione.py diff --git a/channels.json b/channels.json index 6d8b6ae5..08362f96 100644 --- a/channels.json +++ b/channels.json @@ -2,6 +2,7 @@ "altadefinizione01": "https://www.altadefinizione01.photo", "altadefinizione01_link": "https://altadefinizione01.wine", "altadefinizioneclick": "https://altadefinizione.group", + "animealtadefinizione": "https://www.animealtadefinizione.it", "animeforce": "https://ww1.animeforce.org", "animeleggendari": "https://animeora.com", "animesaturn": "https://www.animesaturn.com", diff --git a/channels/animealtadefinizione.json b/channels/animealtadefinizione.json new file mode 100644 index 00000000..80bf5a4c --- /dev/null +++ b/channels/animealtadefinizione.json @@ -0,0 +1,21 @@ +{ + "id": "animealtadefinizione", + "name": "AnimealtAdefinizione", + "active": true, + "language": ["ita", "sub-ita"], + "thumbnail": "animealtadefinizione.png", + "banner": "animealtadefinizione.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/animealtadefinizione.py b/channels/animealtadefinizione.py new file mode 100644 index 00000000..f3bd68c2 --- /dev/null +++ b/channels/animealtadefinizione.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# Canale per animealtadefinizione +# ---------------------------------------------------------- + +from core import support + +host = support.config.get_channel_url() +headers = [['Referer', host]] + +perpage_list = ['20','30','40','50','60','70','80','90','100'] +perpage = perpage_list[support.config.get_setting('perpage' , 'animealtadefinizione')] +epPatron = r'\s*(?P[^<]+)[^>]+>[^>]+>\s*<a href="(?P<url>[^"]+)"' + + +@support.menu +def mainlist(item): + anime=['/anime/', + ('Tipo',['', 'menu', 'Anime']), + ('Anno',['', 'menu', 'Anno']), + ('Genere', ['', 'menu','Genere'])] + return locals() + + +@support.scrape +def menu(item): + action = 'peliculas' + data = support.match(item, patron= r'<a href="' + host + r'/category/' + item.args.lower() + r'/">' + item.args + r'</a><ul class="sub-menu">(.*?)</ul>').match + patronMenu = r'<a href="(?P<url>[^"]+)">(?P<title>[^<]+)<' + 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 '/movie/' 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-admin/admin-ajax.php', post='action=itajax-sort&loop=main+loop&location=&thumbnail=1&rating=1sorter=recent&columns=4&numarticles='+perpage+'&paginated='+str(item.pag)+'¤tquery%5B'+query+'%5D='+searchtext).data.replace('\\','') + patron=r'<a href="(?P<url>[^"]+)"><img width="[^"]+" height="[^"]+" src="(?P<thumb>[^"]+)" class="[^"]+" alt="" title="(?P<title>.*?)\s+(?P<type>Movie)?\s*(?P<lang>Sub Ita|Ita)' + + typeContentDict = {'movie':['movie']} + typeActionDict = {'findvideos':['movie']} + + def ItemItemlistHook(item, itemlist): + if item.search: + itemlist = [ it for it in itemlist if ' Episodio ' not in it.title ] + 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 = epPatron + return locals() + + +def findvideos(item): + itemlist = [] + if item.contentType == 'movie': + matches = support.match(item, patron=epPatron).matches + for title, url in matches: + get_video_list(url, title, itemlist) + else: + get_video_list(item.url, 'Diretto', itemlist) + return support.server(item, itemlist=itemlist) + + +def get_video_list(url, title, itemlist): + from requests import get + if not url.startswith('http'): url = host + url + + url = support.match(get(url).url, string=True, patron=r'file=([^$]+)').match + if 'http' not in url: url = 'http://' + url + itemlist.append(support.Item(title=title, url=url, server='directo', action='play')) + + return itemlist \ No newline at end of file diff --git a/channels/animeuniverse.py b/channels/animeuniverse.py index e16e1b5a..b170a7c4 100644 --- a/channels/animeuniverse.py +++ b/channels/animeuniverse.py @@ -10,6 +10,7 @@ headers = {} perpage_list = ['20','30','40','50','60','70','80','90','100'] perpage = perpage_list[support.config.get_setting('perpage' , 'animeuniverse')] +epPatron = r'<td>\s*(?P<title>[^<]+)[^>]+>[^>]+>\s*<a href="(?P<url>[^"]+)"' @support.menu @@ -61,7 +62,7 @@ def peliculas(item): 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])' + patron=r'<a href="(?P<url>[^"]+)"><img width="[^"]+" height="[^"]+" src="(?P<thumb>[^"]+)" class="[^"]+" alt="" title="(?P<title>.*?)\s+(?P<lang>Sub ITA|ITA)' def ItemItemlistHook(item, itemlist): if len(itemlist) == int(perpage): @@ -76,12 +77,27 @@ def peliculas(item): @support.scrape def episodios(item): pagination = int(perpage) - patron = r'<td>\s*(?P<title>[A-Za-z]+ \d+)[^>]+>[^>]+>\s*<a href="(?P<url>[^"]+)"' + patron = epPatron 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')] + itemlist = [] + if item.contentType == 'movie': + matches = support.match(item, patron=epPatron).matches + for title, url in matches: + get_video_list(url, title, itemlist) + else: + get_video_list(item.url, 'Diretto', itemlist) return support.server(item, itemlist=itemlist) + + +def get_video_list(url, title, itemlist): + from requests import get + if not url.startswith('http'): url = host + url + + url = support.match(get(url).url, string=True, patron=r'file=([^$]+)').match + if 'http' not in url: url = 'http://' + url + itemlist.append(support.Item(title=title, url=url, server='directo', action='play')) + + return itemlist From 11443ab0eac364a7274728a010784021cc8ae5a2 Mon Sep 17 00:00:00 2001 From: Alhaziel01 <alhaziel01@gmail.com> Date: Fri, 31 Jul 2020 09:23:35 +0200 Subject: [PATCH 3/6] Fix Deltabit --- servers/deltabit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers/deltabit.py b/servers/deltabit.py index ad811ae0..957dca72 100644 --- a/servers/deltabit.py +++ b/servers/deltabit.py @@ -25,7 +25,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= global data post = urllib.urlencode({k: v for k, v in scrapertools.find_multiple_matches(data, "name='([^']+)' value='([^']*)'")}) - time.sleep(2.1) + time.sleep(2.5) data = httptools.downloadpage(page_url, post=post).data videos_packed = scrapertools.find_single_match(data, r"</div>\s*<script type='text/javascript'>(eval.function.p,a,c,k,e,.*?)\s*</script>") From 7486484b0d1dba98c42c1c9400cf26ed033e1854 Mon Sep 17 00:00:00 2001 From: Alhaziel01 <alhaziel01@gmail.com> Date: Fri, 31 Jul 2020 16:53:33 +0200 Subject: [PATCH 4/6] Fix AW --- channels/animeworld.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/channels/animeworld.py b/channels/animeworld.py index cdced9be..835f88e2 100644 --- a/channels/animeworld.py +++ b/channels/animeworld.py @@ -23,8 +23,8 @@ def get_data(item, head=[]): 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://') + jstr, location = support.match(item, patron=r'<script>(.*?location.href=".*?(http[^"]+)";)</').match + item.url=support.re.sub(r':\d+', '', 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) @@ -38,7 +38,7 @@ def get_data(item, head=[]): # set cookie headers['cookie'] = config.get_setting('key', item.channel) - res = support.match(item, headers=headers, patron=r';\s*location.href="([^"]+)"') + res = support.match(item, headers=headers, patron=r';\s*location.href=".*?(http[^"]+)"') if res.match: item.url= res.match.replace('http://','https://') data = support.match(item, headers=headers).data @@ -70,8 +70,8 @@ def mainlist(item): def genres(item): action = 'peliculas' data = get_data(item) - patronBlock = r'<button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown"> Generi <span.[^>]+>(?P<block>.*?)</ul>' - patronMenu = r'<input.*?name="(?P<name>[^"]+)" value="(?P<value>[^"]+)"\s*>[^>]+>(?P<title>[^<]+)<\/label>' + patronBlock = r'dropdown[^>]*>\s*Generi\s*<span.[^>]+>(?P<block>.*?)</ul>' + patronMenu = r'<input.*?name="(?P<name>[^"]+)" value="(?P<value>[^"]+)"\s*>[^>]+>(?P<title>[^<]+)</label>' def itemHook(item): item.url = host + '/filter?' + item.name + '=' + item.value + '&sort=' @@ -149,7 +149,7 @@ def peliculas(item): action='episodios' # Controlla la lingua se assente - patronNext=r'href="([^"]+)" rel="next"' + patronNext=r'</span></a><a href="([^"]+)"' typeContentDict={'movie':['movie', 'special']} typeActionDict={'findvideos':['movie', 'special']} def itemHook(item): From 009a3ecabb4a65a93bfcedc198a8a14f483ef98d Mon Sep 17 00:00:00 2001 From: Alhaziel01 <alhaziel01@gmail.com> Date: Fri, 31 Jul 2020 17:53:41 +0200 Subject: [PATCH 5/6] Ultimi Episodi: AnimeAltadefinizione, AnimeUniverse --- channels/animealtadefinizione.json | 2 +- channels/animealtadefinizione.py | 24 ++++++++++++++++++++--- channels/animeuniverse.json | 2 +- channels/animeuniverse.py | 31 ++++++++++++++++++++++++++---- 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/channels/animealtadefinizione.json b/channels/animealtadefinizione.json index 80bf5a4c..ce0c0876 100644 --- a/channels/animealtadefinizione.json +++ b/channels/animealtadefinizione.json @@ -6,7 +6,7 @@ "thumbnail": "animealtadefinizione.png", "banner": "animealtadefinizione.png", "categories": ["anime", "sub-ita"], - "not_active": ["include_in_newest"], + "default_off": ["include_in_newest"], "settings": [ { "id": "perpage", diff --git a/channels/animealtadefinizione.py b/channels/animealtadefinizione.py index f3bd68c2..df9c3229 100644 --- a/channels/animealtadefinizione.py +++ b/channels/animealtadefinizione.py @@ -18,7 +18,8 @@ def mainlist(item): anime=['/anime/', ('Tipo',['', 'menu', 'Anime']), ('Anno',['', 'menu', 'Anno']), - ('Genere', ['', 'menu','Genere'])] + ('Genere', ['', 'menu','Genere']), + ('Ultimi Episodi',['', 'peliculas', 'last'])] return locals() @@ -43,11 +44,30 @@ def search(item, texto): return [] +def newest(categoria): + support.log(categoria) + item = support.Item() + try: + if categoria == "anime": + item.url = host + item.args = "last" + return peliculas(item) + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + support.logger.error("{0}".format(line)) + return [] + + @support.scrape def peliculas(item): if '/movie/' in item.url: item.contentType = 'movie' action='findvideos' + elif item.args == 'last': + item.contentType = 'episode' + action='findvideos' else: item.contentType = 'tvshow' action='episodios' @@ -76,8 +96,6 @@ def peliculas(item): return locals() - - @support.scrape def episodios(item): pagination = int(perpage) diff --git a/channels/animeuniverse.json b/channels/animeuniverse.json index 34f11412..0fa509cc 100644 --- a/channels/animeuniverse.json +++ b/channels/animeuniverse.json @@ -6,7 +6,7 @@ "thumbnail": "animeuniverse.png", "banner": "animeuniverse.png", "categories": ["anime", "sub-ita"], - "not_active": ["include_in_newest"], + "default_off": ["include_in_newest"], "settings": [ { "id": "perpage", diff --git a/channels/animeuniverse.py b/channels/animeuniverse.py index b170a7c4..8a496698 100644 --- a/channels/animeuniverse.py +++ b/channels/animeuniverse.py @@ -19,6 +19,7 @@ def mainlist(item): ('Tipo',['', 'menu', 'Anime']), ('Anno',['', 'menu', 'Anno']), ('Genere', ['', 'menu','Genere']), + ('Ultimi Episodi',['/2/', 'peliculas', 'last']), ('Hentai', ['/hentai/', 'peliculas'])] return locals() @@ -44,28 +45,50 @@ def search(item, texto): return [] +def newest(categoria): + support.log(categoria) + item = support.Item() + try: + if categoria == "anime": + item.url = host + item.args = "last" + return peliculas(item) + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + support.logger.error("{0}".format(line)) + return [] + + @support.scrape def peliculas(item): if '/mos/' in item.url: item.contentType = 'movie' action='findvideos' + elif item.args == 'last': + query='cat%5D=1¤tquery%5Bcategory__not_in%5D%5B' + searchtext='' + item.contentType = 'episode' + action='findvideos' else: item.contentType = 'tvshow' action='episodios' if item.search: query = 's' searchtext = item.search - else: + if not query: query='category_name' - searchtext = item.url.split('/')[-2] + searchtext = item.url.split('/')[-2] if item.url != host else '' if not item.pag: item.pag = 1 anime=True + blacklist=['Altri Hentai'] 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>Sub ITA|ITA)' + patron=r'<a href="(?P<url>[^"]+)"><img width="[^"]+" height="[^"]+" src="(?P<thumb>[^"]+)" class="[^"]+" alt="" title="(?P<title>.*?)\s*(?P<lang>Sub ITA|ITA)?(?:"| \[)' def ItemItemlistHook(item, itemlist): - if len(itemlist) == int(perpage): + if len(itemlist) == int(perpage) - len(blacklist): item.pag += 1 itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), action='peliculas')) return itemlist From 0959ff5b7cdf3b592eaa9978b84d2b86c911a3b7 Mon Sep 17 00:00:00 2001 From: Alhaziel01 <alhaziel01@gmail.com> Date: Fri, 31 Jul 2020 17:54:10 +0200 Subject: [PATCH 6/6] =?UTF-8?q?Ordine=20di=20default=20per=20novit=C3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- specials/news.json | 11 ++++------- specials/news.py | 5 +++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/specials/news.json b/specials/news.json index 5c5e7f87..8aa732a7 100644 --- a/specials/news.json +++ b/specials/news.json @@ -29,18 +29,15 @@ ] }, { - "id": "perfil", + "id": "order", "type": "list", - "label": "@60666", + "label": "Ordinamento", "default": 0, "enabled": true, "visible": true, "lvalues": [ - "@60667", - "@60668", - "@60669", - "@60670", - "@60671" + "Default", + "Alfabetico" ] } ] diff --git a/specials/news.py b/specials/news.py index 870731df..800161ee 100644 --- a/specials/news.py +++ b/specials/news.py @@ -453,8 +453,9 @@ def no_group(list_result_canal): # i.text_color = color3 itemlist.append(i.clone()) - - return sorted(itemlist, key=lambda it: it.title.lower()) + if config.get_setting('order','news') == 1: + itemlist = sorted(itemlist, key=lambda it: it.title.lower()) + return itemlist def group_by_channel(list_result_canal):