Fix Novità + fix alcuni canali

This commit is contained in:
Alhaziel01
2020-08-05 17:35:27 +02:00
parent 96fb57109a
commit 4b99e2a057
10 changed files with 203 additions and 24 deletions

View File

@@ -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()

View File

@@ -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":

View File

@@ -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)

View File

@@ -31,7 +31,8 @@ def mainlist(item):
def peliculas(item):
action = 'episodios'
if item.args == 'newest':
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>'
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>'

View File

@@ -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

View File

@@ -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

View File

@@ -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('&quot;','"'))
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('&quot;','"').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)

View File

@@ -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()

View File

@@ -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

View File

@@ -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())