From 4b99e2a057cd5a68caaf5a84ad66843d4bd5b2dc Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Wed, 5 Aug 2020 17:35:27 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20Novit=C3=A0=20+=20fix=20alcuni=20canali?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channels/altadefinizione01.py | 1 + channels/altadefinizione01_link.py | 1 + channels/altadefinizioneclick.py | 1 + channels/eurostreaming.py | 3 +- channels/serietvonline.py | 2 +- channels/serietvsubita.py | 2 + channels/streamingcommunity.py | 183 +++++++++++++++++++++++++++++ channels/tantifilm.py | 11 +- core/support.py | 4 +- specials/news.py | 19 +-- 10 files changed, 203 insertions(+), 24 deletions(-) create mode 100644 channels/streamingcommunity.py diff --git a/channels/altadefinizione01.py b/channels/altadefinizione01.py index 0fa60cfa..43faedb5 100644 --- a/channels/altadefinizione01.py +++ b/channels/altadefinizione01.py @@ -130,6 +130,7 @@ def newest(categoria): if categoria == "peliculas": item.url = host item.action = "peliculas" + item.contentType = 'movie' itemlist = peliculas(item) if itemlist[-1].action == "peliculas": itemlist.pop() diff --git a/channels/altadefinizione01_link.py b/channels/altadefinizione01_link.py index 1005856e..85376215 100644 --- a/channels/altadefinizione01_link.py +++ b/channels/altadefinizione01_link.py @@ -88,6 +88,7 @@ def newest(categoria): if categoria == "peliculas": item.url = host item.action = "peliculas" + item.contentType='movie' itemlist = peliculas(item) if itemlist[-1].action == "peliculas": diff --git a/channels/altadefinizioneclick.py b/channels/altadefinizioneclick.py index 633ba333..a1d91ebc 100644 --- a/channels/altadefinizioneclick.py +++ b/channels/altadefinizioneclick.py @@ -116,6 +116,7 @@ def newest(categoria): try: if categoria == "peliculas": item.args = 'news' + item.contentType = 'movie' item.url = host + "/nuove-uscite/" item.action = "peliculas" itemlist = peliculas(item) diff --git a/channels/eurostreaming.py b/channels/eurostreaming.py index c691cd82..532b46d7 100644 --- a/channels/eurostreaming.py +++ b/channels/eurostreaming.py @@ -31,7 +31,8 @@ def mainlist(item): def peliculas(item): action = 'episodios' if item.args == 'newest': - patron = r'(?P[^<]+)–\s*<a href="(?P<url>[^"]+)"[^>]*>\s?(?P<episode>\d+[×x]\d+-\d+|\d+[×x]\d+) (?P<title2>[^<]+)\s?\(?(?P<lang>SUB ITA)?\)?</a>' + item.contentType = 'episode' + patron = r'<span class="serieTitle" style="font-size:20px">(?P<title>[^<]+) –\s*<a href="(?P<url>[^"]+)"[^>]*>\s?(?P<episode>\d+[×x]\d+-\d+|\d+[×x]\d+) (?P<title2>[^<\(]+)\s?\(?(?P<lang>SUB ITA)?\)?</a>' pagination = '' else: patron = r'<div class="post-thumb">.*?\s<img src="(?P<thumb>[^"]+)".*?><a href="(?P<url>[^"]+)"[^>]+>(?P<title>.+?)\s?(?: Serie Tv)?\s?\(?(?P<year>\d{4})?\)?<\/a><\/h2>' diff --git a/channels/serietvonline.py b/channels/serietvonline.py index 98ea0e4a..5b2be3f5 100644 --- a/channels/serietvonline.py +++ b/channels/serietvonline.py @@ -72,7 +72,7 @@ def peliculas(item): elif item.contentType == 'episode': pagination = 35 action = 'findvideos' - patron = r'<td><a href="(?P<url>[^"]+)"(?:[^>]+)?>\s?(?P<title>[^<]+)(?P<episode>[\d\-x]+)?(?P<title2>[^<]+)?<' + patron = r'<td><a href="(?P<url>[^"]+)"(?:[^>]+)?>\s?(?P<title>.*?)(?P<episode>\d+x\d+)[ ]?(?P<title2>[^<]+)?<' elif item.contentType == 'tvshow': # SEZIONE Serie TV- Anime - Documentari diff --git a/channels/serietvsubita.py b/channels/serietvsubita.py index 10729256..d55adfce 100644 --- a/channels/serietvsubita.py +++ b/channels/serietvsubita.py @@ -276,6 +276,8 @@ def newest(categoria): try: if categoria == "series": itemlist = peliculas_tv(item) + if itemlist[-1].action == 'peliculas_tv': + itemlist.pop(-1) except: import sys diff --git a/channels/streamingcommunity.py b/channels/streamingcommunity.py new file mode 100644 index 00000000..84ad6f2e --- /dev/null +++ b/channels/streamingcommunity.py @@ -0,0 +1,183 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# Canale per AnimeUnity +# ------------------------------------------------------------ + +import requests, json, copy +from core import support, jsontools +from specials import autorenumber + +try: from lib import cloudscraper +except: from lib import cloudscraper + + +host = support.config.get_channel_url() + +session=requests.Session() +response = session.get(host) +csrf_token = support.match(response.text, patron= 'name="csrf-token" content="([^"]+)"').match +headers = {'content-type': 'application/json;charset=UTF-8', + 'x-csrf-token': csrf_token, + 'Cookie' : '; '.join([x.name + '=' + x.value for x in response.cookies])} + +@support.menu +def mainlist(item): + film=['', + ('Generi',['/film','genres']), + ('Titoli del Momento',['/film','peliculas',0]), + ('Novità',['/film','peliculas',1]), + ('Popolari',['/film','peliculas',2])] + tvshow=['', + ('Generi',['/serie-tv','genres']), + ('Titoli del Momento',['/serie-tv','peliculas',0]), + ('Novità',['/serie-tv','peliculas',1]), + ('Popolari',['/serie-tv','peliculas',2])] + search='' + return locals() + + +def genres(item): + support.log() + itemlist = [] + data = support.scrapertools.decodeHtmlentities(support.match(item).data) + args = support.match(data, patronBlock=r'genre-options-json="([^\]]+)\]', patron=r'name"\s*:\s*"([^"]+)').matches + for arg in args: + itemlist.append(item.clone(title=support.typo(arg, 'bold'), args=arg, action='peliculas')) + support.thumb(itemlist, genre=True) + return itemlist + + +def search(item, text): + support.log('search', item) + item.search = text + + try: + return peliculas(item) + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + support.log('search log:', line) + return [] + + +def newest(category): + support.log(category) + itemlist = [] + item = support.Item() + item.args = 1 + if category == 'peliculas': + item.url = host + '/film' + else: + item.url = host + '/serie-tv' + + try: + itemlist = peliculas(item) + + if itemlist[-1].action == 'peliculas': + itemlist.pop() + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + support.log(line) + return [] + + return itemlist + + + +def peliculas(item): + support.log() + itemlist = [] + videoType = 'movie' if item.contentType == 'movie' else 'tv' + + page = item.page if item.page else 0 + offset = page * 60 + + if type(item.args) == int: + data = support.scrapertools.decodeHtmlentities(support.match(item).data) + records = json.loads(support.match(data, patron=r'slider-title titles-json="(.*?)" slider-name="').matches[item.args]) + elif not item.search: + payload = json.dumps({'type': videoType, 'offset':offset, 'genre':item.args}) + records = json.loads(requests.post(host + '/infinite/browse', headers=headers, data=payload).json()['records']) + else: + records = requests.get(host + '/search?q=' + item.search + '&live=true', headers=headers).json()['records'] + + if records and type(records[0]) == list: + js = [] + for record in records: + js += record + else: + js = records + + for it in js: + title, lang = support.match(it['name'], patron=r'([^\[|$]+)(?:\[([^\]]+)\])?').match + if not lang: + lang = 'ITA' + itm = item.clone(title=support.typo(title,'bold') + support.typo(lang,'_ [] color kod bold')) + itm.type = it['type'] + itm.thumbnail = 'https://image.tmdb.org/t/p/w500' + it['images'][0]['url'] + itm.fanart = 'https://image.tmdb.org/t/p/w1280' + it['images'][2]['url'] + itm.plot = it['plot'] + itm.infoLabels['tmdb_id'] = it['tmdb_id'] + itm.language = lang + + + if itm.type == 'movie': + itm.contentType = 'movie' + itm.fulltitle = itm.show = itm.contentTitle = title + itm.contentSerieName = '' + itm.action = 'findvideos' + itm.url = host + '/watch/%s' % it['id'] + + else: + itm.contentType = 'tvshow' + itm.contentTitle = '' + itm.fulltitle = itm.show = itm.contentSerieName = title + itm.action = 'episodios' + itm.season_count = it['seasons_count'] + itm.url = host + '/titles/%s-%s' % (it['id'], it['slug']) + + itemlist.append(itm) + + if len(itemlist) >= 60: + itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), page=page + 1)) + support.tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + return itemlist + +def episodios(item): + support.log() + itemlist = [] + + js = json.loads(support.match(item.url, patron=r'seasons="([^"]+)').match.replace('"','"')) + support.log(js) + + for episodes in js: + for it in episodes['episodes']: + support.log(it) + itemlist.append( + support.Item(channel=item.channel, + title=support.typo(str(episodes['number']) + 'x' + str(it['number']).zfill(2) + ' - ' + it['name'], 'bold'), + episode = it['number'], + season=episodes['number'], + thumbnail='https://image.tmdb.org/t/p/w1280' + it['images'][0]['url'], + fanart='https://image.tmdb.org/t/p/w1280' + it['images'][0]['url'], + plot=it['plot'], + action='findvideos', + contentType='episode', + url=host + '/watch/' + str(episodes['title_id']) + '?e=' + str(it['id']))) + + support.videolibrary(itemlist, item) + support.download(itemlist, item) + return itemlist + + +def findvideos(item): + support.log() + itemlist=[] + url = support.match(support.match(item).data.replace('"','"').replace('\\',''), patron=r'video_url"\s*:\s*"([^"]+)"').match + playlist = support.match(url, patron=r'\./([^.]+)').matches + for res in playlist: + itemlist.append(item.clone(title='Diretto', server='directo', url=url.replace('playlist',res), quality=res, action='play')) + return support.server(item, itemlist=itemlist) \ No newline at end of file diff --git a/channels/tantifilm.py b/channels/tantifilm.py index 9e2fa93a..5e0e0e1d 100644 --- a/channels/tantifilm.py +++ b/channels/tantifilm.py @@ -145,13 +145,10 @@ def search(item, texto): def newest(categoria): if categoria == 'series': item = Item(url=host + '/aggiornamenti-giornalieri-serie-tv-2') - item.contentType = 'tvshow' - patronBlock = 'Aggiornamenti Giornalieri Serie TV.*?<div class="sp-body folded">(?P<block>.*?)</div>' - patron = '<p>(?P<title>.*?)\((?P<year>[0-9]{4})-?\)\s*streaming.*?href="(?P<url>[^"]+)' - - def itemHook(item): - item.title = item.contentTitle = item.fulltitle = item.contentSerieName = item.contentTitle = scrapertools.htmlclean(item.title) - return item + data = support.match(item).data.replace('<u>','').replace('</u>','') + item.contentType = 'episode' + patronBlock = r'Aggiornamenti Giornalieri Serie TV.*?<div class="sp-body folded">(?P<block>.*?)</div>' + patron = r'<p>(?P<title>.*?)\((?P<year>[0-9]{4})[^\)]*\)[^<]+<a href="(?P<url>[^"]+)">(?P<episode>[^ ]+) (?P<lang>[Ss][Uu][Bb].[Ii][Tt][Aa])?(?P<title2>[^<]+)?' return locals() diff --git a/core/support.py b/core/support.py index dde717a3..44b59c96 100755 --- a/core/support.py +++ b/core/support.py @@ -285,8 +285,8 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t # make formatted Title [longtitle] s = ' - ' - title = episode + (s if episode and title else '') + title - longtitle = title + (s if title and title2 else '') + title2 + '\n' + # title = episode + (s if episode and title else '') + title + longtitle = episode + (s if episode and title else '') + title + (s if title and title2 else '') + title2 if sceneTitle: from lib.guessit import guessit diff --git a/specials/news.py b/specials/news.py index 800161ee..24bd890d 100644 --- a/specials/news.py +++ b/specials/news.py @@ -435,9 +435,9 @@ def get_title(item): if item.quality: title += support.typo(item.quality, '_ [] color kod') - season_ = support.typo(config.get_localized_string(70736), '_ [] color white bold') if (type(item.args) != bool and 'season_completed' in item.news and not item.episode) else '' - if season_: - title += season_ + # season_ = support.typo(config.get_localized_string(70736), '_ [] color white bold') if (type(item.args) != bool and 'season_completed' in item.news and not item.episode) else '' + # if season_: + # title += season_ return title @@ -473,15 +473,10 @@ def group_by_channel(list_result_canal): # We add the content found in the list_result list for c in sorted(dict_canales): - itemlist.append(Item(channel="news", title=channels_id_name[c] + ':', text_color=color1, text_bold=True)) + channel_params = channeltools.get_channel_parameters(c) + itemlist.append(Item(channel="news", title=support.typo(channel_params['title'],'bullet bold color kod'), thumbnail=channel_params['thumbnail'])) for i in dict_canales[c]: -## if i.contentQuality: -## i.title += ' (%s)' % i.contentQuality -## if i.contentLanguage: -## i.title += ' [%s]' % i.contentLanguage -## i.title = ' %s' % i.title -#### i.text_color = color3 itemlist.append(i.clone()) return itemlist @@ -527,12 +522,10 @@ def group_by_content(list_result_canal): else: title += config.get_localized_string(70211) % (', '.join([i for i in canales_no_duplicados])) - new_item = v[0].clone(channel="news", title=title, action="show_channels", - sub_list=[i.tourl() for i in v], extra=channels_id_name) + new_item = v[0].clone(channel="news", title=title, action="show_channels", sub_list=[i.tourl() for i in v], extra=channels_id_name) else: new_item = v[0].clone(title=title) -## new_item.text_color = color3 list_result.append(new_item) return sorted(list_result, key=lambda it: it.title.lower())