Riscritto News e fix vari
This commit is contained in:
@@ -2,47 +2,190 @@
|
||||
# ------------------------------------------------------------
|
||||
# Canale per Altadefinizione Community
|
||||
|
||||
from core import jsontools, support
|
||||
from core import support
|
||||
from lib.fakeMail import Gmailnator
|
||||
from platformcode import config, platformtools, logger
|
||||
from core import scrapertools, httptools
|
||||
|
||||
|
||||
def findhost(url):
|
||||
global register_url
|
||||
register_url = url
|
||||
return support.match(url, patron=r'<a href="([^"]+)/\w+">Accedi').match
|
||||
|
||||
|
||||
host = config.get_channel_url(findhost)
|
||||
# register_url = 'https://altaregistrazione.com'
|
||||
headers = {'Referer': host, 'x-requested-with': 'XMLHttpRequest'}
|
||||
register_url = 'https://altaregistrazione.net'
|
||||
|
||||
if 'altadefinizionecommunity' not in host:
|
||||
config.get_channel_url(findhost, forceFindhost=True)
|
||||
|
||||
if host.endswith('/'):
|
||||
host = host[:-1]
|
||||
|
||||
headers = {'Referer': host}
|
||||
order = ['', 'i_piu_visti', 'i_piu_votati', 'i_piu_votati_dellultimo_mese', 'titolo_az', 'voto_imdb_piu_alto'][config.get_setting('order', 'altadefinizionecommunity')]
|
||||
|
||||
|
||||
@support.menu
|
||||
def mainlist(item):
|
||||
logger.debug(item)
|
||||
|
||||
film = ['/load-more-film?anno=&order=&support_webp=1&type=movie&page=1',
|
||||
# Voce Menu,['url','action','args',contentType]
|
||||
('Generi Film', ['', 'genres', 'genres']),
|
||||
]
|
||||
film = ['/type/movie',
|
||||
('Generi', ['/type/movie', 'genres', 'genres']),
|
||||
('Anni', ['/type/movie', 'genres', 'year']),]
|
||||
|
||||
tvshow = ['/load-more-film?type=tvshow&anno=&order=&support_webp=1&page=1',
|
||||
# Voce Menu,['url','action','args',contentType]
|
||||
('Generi Serie TV', ['', 'genres', 'genres']),
|
||||
]
|
||||
|
||||
altri = [
|
||||
# ('A-Z', ['/lista-film', 'genres', 'letters']),
|
||||
('Qualità', ['', 'genres', 'quality']),
|
||||
('Anni', ['/anno', 'genres', 'years'])
|
||||
]
|
||||
search = ''
|
||||
tvshow = ['/serie-tv/tvshow',
|
||||
('Generi', ['/serie-tv/tvshow', 'genres', 'genres']),
|
||||
('Anni', ['/serie-tv/tvshow', 'genres', 'year'])]
|
||||
|
||||
return locals()
|
||||
|
||||
|
||||
def search(item, text):
|
||||
logger.debug("search ", text)
|
||||
# per evitare fastidi da ricerca globale
|
||||
if not item.globalsearch:
|
||||
registerOrLogin()
|
||||
|
||||
item.args = 'search'
|
||||
item.url = host + "/search?s={}&f={}".format(text.replace(' ', '+'), item.contentType)
|
||||
try:
|
||||
return movies(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 genres(item):
|
||||
registerOrLogin()
|
||||
logger.debug(item)
|
||||
data = support.httptools.downloadpage(item.url).data
|
||||
blacklist= ['Film', 'Serie TV']
|
||||
|
||||
if item.args == 'genres':
|
||||
categories ={}
|
||||
res = support.match(host + '/cerca', patron=r'for="cat-(\d+)[^>]+>([^<]+)').matches
|
||||
for _id, name in res:
|
||||
categories[name] = _id
|
||||
|
||||
patronBlock = r'{}<span></span>(?P<block>.*?)</ul>\s*</li'.format('Film' if item.contentType == 'movie' else 'Serie TV')
|
||||
patronMenu = r'<a href="[^"]+">(?P<title>[^<]+)'
|
||||
|
||||
def itemHook(it):
|
||||
it.cat_id = categories[it.fulltitle]
|
||||
return it
|
||||
|
||||
if item.args == 'year':
|
||||
patronMenu = r'value="(?P<year_id>[^"]+)"[^>]*>(?P<title>\d+)'
|
||||
patronBlock = r'Anno</option>(?P<block>.*?</select>)'
|
||||
|
||||
elif item.args == 'quality':
|
||||
patronMenu = r'quality/(?P<quality_id>[^"]+)">(?P<title>[^<]+)'
|
||||
patronBlock = r'Risoluzione(?P<block>.*?)</ul>'
|
||||
|
||||
action = 'movies'
|
||||
return locals()
|
||||
|
||||
|
||||
@support.scrape
|
||||
def movies(item):
|
||||
item.quality = 'HD'
|
||||
json = {}
|
||||
if not item.page: item.page = 1
|
||||
params ={'type':item.contentType, 'anno':item.year_id, 'quality':item.quality_id, 'cat':item.cat_id, 'order':order, 'page':item.page}
|
||||
# debug = True
|
||||
|
||||
action = 'findvideos' if item.contentType == 'movie' else 'episodes'
|
||||
|
||||
try:
|
||||
# support.dbg()
|
||||
if item.args in ['search']:
|
||||
page = support.httptools.downloadpage(item.url, headers=headers)
|
||||
if page.json:
|
||||
data = "\n".join(page.json['data'])
|
||||
else:
|
||||
data = page.data
|
||||
else:
|
||||
params['page'] = item.page
|
||||
|
||||
url = '{}/load-more-film?{}'.format(host, support.urlencode(params))
|
||||
json = support.httptools.downloadpage(url, headers=headers).json
|
||||
data = "\n".join(json['data'])
|
||||
except:
|
||||
data = ' '
|
||||
|
||||
patron = r'wrapFilm"[^>]*>\s*<a href="(?P<url>[^"]+)">[^>]+>(?P<year>\d+)(?:[^>]+>){2}(?P<rating>[^<]+)(?:[^>]+>){4}\s*<img src="(?P<thumb>[^"]+)(?:[^>]+>){2,6}\s+<h3>(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA -]+))?'
|
||||
# patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">[^>]+>(?P<year>\d+)(?:[^>]+>){2}(?P<rating>[^<]+)(?:[^>]+>){4}\s*<img src="(?P<thumb>[^"]+)(?:[^>]+>){3}(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?'
|
||||
|
||||
def itemHook(item):
|
||||
item.quality = item.quality.replace('2K', 'HD').replace('4K', 'HD')
|
||||
item.title = item.title.replace('2K', 'HD').replace('4K', 'HD')
|
||||
return item
|
||||
|
||||
# paginazione
|
||||
if json.get('have_next') or support.match(data, patron=r'have_next_film\s*=\s*true').match:
|
||||
def fullItemlistHook(itemlist):
|
||||
cat_id = support.match(data, patron=r''''cat':"(\d+)"''').match
|
||||
if cat_id: item.cat_id = cat_id
|
||||
item.page += 1
|
||||
support.nextPage(itemlist, item, function_or_level='movies')
|
||||
return itemlist
|
||||
|
||||
return locals()
|
||||
|
||||
|
||||
@support.scrape
|
||||
def episodes(item):
|
||||
logger.debug(item)
|
||||
# debug = True
|
||||
data = item.data
|
||||
patron = r'class="playtvshow "\s+data-href="(?P<url>[^"]+)'
|
||||
|
||||
def itemHook(it):
|
||||
spl = it.url.split('/')[-2:]
|
||||
it.infoLabels['season'] = int(spl[0])+1
|
||||
it.infoLabels['episode'] = int(spl[1])+1
|
||||
it.url = it.url.replace('/watch-unsubscribed', '/watch-external')
|
||||
it.title = '{}x{:02d} - {}'.format(it.contentSeason, it.contentEpisodeNumber, it.fulltitle)
|
||||
return it
|
||||
|
||||
return locals()
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
itemlist = []
|
||||
resolve_url(item)
|
||||
|
||||
itemlist.append(item.clone(action='play', url=support.match(item.url, patron='allowfullscreen[^<]+src="([^"]+)"', cloudscraper=True).match, quality=''))
|
||||
|
||||
return support.server(item, itemlist=itemlist)
|
||||
|
||||
|
||||
def play(item):
|
||||
if host in item.url: # intercetto il server proprietario
|
||||
# if registerOrLogin():
|
||||
return support.get_jwplayer_mediaurl(support.httptools.downloadpage(item.url, cloudscraper=True).data, 'Diretto')
|
||||
# else:
|
||||
# platformtools.play_canceled = True
|
||||
# return []
|
||||
else:
|
||||
return [item]
|
||||
|
||||
|
||||
def resolve_url(item):
|
||||
registerOrLogin()
|
||||
if '/watch-unsubscribed' not in item.url and '/watch-external' not in item.url:
|
||||
playWindow = support.match(support.httptools.downloadpage(item.url, cloudscraper=True).data, patron='playWindow" href="([^"]+)')
|
||||
video_url = playWindow.match
|
||||
item.data = playWindow.data
|
||||
item.url = video_url.replace('/watch-unsubscribed', '/watch-external')
|
||||
return item
|
||||
|
||||
|
||||
def login():
|
||||
r = support.httptools.downloadpage(host, cloudscraper=True)
|
||||
Token = support.match(r.data, patron=r'name=\s*"_token"\s*value=\s*"([^"]+)', cloudscraper=True).match
|
||||
@@ -51,12 +194,12 @@ def login():
|
||||
else:
|
||||
logger.info('Login in corso')
|
||||
post = {'_token': '',
|
||||
'form_action':'login',
|
||||
'form_action':'login',
|
||||
'email': config.get_setting('username', channel='altadefinizionecommunity'),
|
||||
'password':config.get_setting('password', channel='altadefinizionecommunity')}
|
||||
|
||||
r = support.httptools.downloadpage(host + '/login', post=post, headers={'referer': host}, cloudscraper=True)
|
||||
if not r.status_code in [200, 302] or 'Email o Password non validi' in r.data:
|
||||
if r.code not in [200, 302] or 'Email o Password non validi' in r.data:
|
||||
platformtools.dialog_ok('AltadefinizioneCommunity', 'Username/password non validi')
|
||||
return False
|
||||
|
||||
@@ -127,143 +270,3 @@ def registerOrLogin():
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@support.scrape
|
||||
def movies(item):
|
||||
json = {}
|
||||
# debug=True
|
||||
|
||||
if item.contentType == 'undefined':
|
||||
# tmdbEnabled = False
|
||||
action = 'check'
|
||||
elif item.contentType == 'movie':
|
||||
action = 'findvideos'
|
||||
else:
|
||||
action = 'episodes'
|
||||
try:
|
||||
if '/load-more-film' not in item.url and '/search' not in item.url: # generi o altri menu, converto
|
||||
import ast
|
||||
ajax = support.match(item.url, patron='ajax_data\s*=\s*"?\s*([^;]+)', cloudscraper=True).match
|
||||
item.url = host + '/load-more-film?' + support.urlencode(ast.literal_eval(ajax)) + '&page=1'
|
||||
if not '/search' in item.url:
|
||||
json = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).json
|
||||
data = "\n".join(json['data'])
|
||||
else:
|
||||
json = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).json
|
||||
data = "\n".join(json['data'])
|
||||
except:
|
||||
data = ' '
|
||||
|
||||
patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">\s*<span class="year">(?P<year>[0-9]{4})</span>\s*<span[^>]+>(?P<rating>[^<]+)</span>\s*<span class="qual">(?P<quality>[^<]+)(?:[^>]+>){2}\s*<img src="(?P<thumbnail>[^"]+)(?:[^>]+>){1,6}\s*<h3>(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?'
|
||||
|
||||
# paginazione
|
||||
logger.debug('JSON FIND',jsontools.load(json))
|
||||
if json.get('have_next'):
|
||||
def fullItemlistHook(itemlist):
|
||||
spl = item.url.split('=')
|
||||
url = '='.join(spl[:-1])
|
||||
page = str(int(spl[-1])+1)
|
||||
total_pages = json.get('lastPage', 0)
|
||||
support.nextPage(itemlist, item, 'movies', next_page='='.join((url, page)), total_pages=total_pages)
|
||||
return itemlist
|
||||
|
||||
return locals()
|
||||
|
||||
|
||||
def search(item, texto):
|
||||
logger.debug("search ", texto)
|
||||
|
||||
item.args = 'search'
|
||||
item.url = host + "/search?s={}&page=1".format(texto)
|
||||
try:
|
||||
return movies(item)
|
||||
# Continua la ricerca in caso di errore
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error('{}'.format(line))
|
||||
return []
|
||||
|
||||
|
||||
@support.scrape
|
||||
def genres(item):
|
||||
logger.debug(item)
|
||||
data = support.httptools.downloadpage(item.url, cloudscraper=True).data
|
||||
blacklist = ['Film', 'Serie TV', 'Trovatore', 'Lista A-Z']
|
||||
patronGenreMenu = r'<a href="(?P<url>[^"]+)">(?P<title>[^<]+)'
|
||||
if item.args == 'quality':
|
||||
item.contentType = 'undefined'
|
||||
patronBlock = r'Risoluzione(?P<block>.*?)</ul>'
|
||||
def itemlistHook(itemlist):
|
||||
support.thumb(itemlist, mode='quality')
|
||||
quality_list = ['4k','2k','hd','sd', '2k.md', 'hd.md', 'ts.md', 'cam']
|
||||
itemlist.sort(key=lambda it: quality_list.index(it.title.lower()) if it.title.lower() in quality_list else 99)
|
||||
return itemlist
|
||||
elif item.args == 'years':
|
||||
item.contentType = 'undefined'
|
||||
patronBlock = r'ANNO(?P<block>.*?</section>)'
|
||||
else:
|
||||
patronBlock = ('Film' if item.contentType == 'movie' else 'Serie TV') + r'<span></span></a>\s+<ul class="dropdown-menu(?P<block>.*?)active-parent-menu'
|
||||
action = 'movies'
|
||||
|
||||
return locals()
|
||||
|
||||
|
||||
@support.scrape
|
||||
def episodes(item):
|
||||
logger.debug()
|
||||
data = item.data
|
||||
patron = r'class="playtvshow "\s*data-href="(?P<url>[^"]+)'
|
||||
|
||||
def itemHook(it):
|
||||
spl = it.url.split('/')[-2:]
|
||||
it.contentSeason = int(spl[0])+1
|
||||
it.contentEpisodeNumber = int(spl[1])+1
|
||||
it.url = it.url.replace('/watch-unsubscribed', '/watch-external')
|
||||
return it
|
||||
|
||||
return locals()
|
||||
|
||||
|
||||
def check(item):
|
||||
resolve_url(item)
|
||||
if '/tvshow' in item.url:
|
||||
item.contentType = 'tvshow'
|
||||
return episodes(item)
|
||||
else:
|
||||
item.contentType = 'movie'
|
||||
return findvideos(item)
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
itemlist = []
|
||||
# logger.dbg()
|
||||
resolve_url(item)
|
||||
|
||||
itemlist.append(item.clone(action='play', url=support.match(item.url, patron='allowfullscreen[^<]+src="([^"]+)"', cloudscraper=True).match, quality=''))
|
||||
|
||||
return support.server(item, itemlist=itemlist)
|
||||
|
||||
|
||||
def play(item):
|
||||
if host in item.url: # intercetto il server proprietario
|
||||
if registerOrLogin():
|
||||
return support.get_jwplayer_mediaurl(support.httptools.downloadpage(item.url, cloudscraper=True).data, 'Diretto')
|
||||
else:
|
||||
platformtools.play_canceled = True
|
||||
return []
|
||||
else:
|
||||
return [item]
|
||||
|
||||
|
||||
def resolve_url(item):
|
||||
registerOrLogin()
|
||||
if '/watch-unsubscribed' not in item.url and '/watch-external' not in item.url:
|
||||
data = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).data
|
||||
logger.debug()
|
||||
playWindow = support.match(data, patron='playWindow" href="([^"]+)')
|
||||
video_url = playWindow.match
|
||||
item.data = playWindow.data
|
||||
item.url = video_url.replace('/watch-unsubscribed', '/watch-external')
|
||||
return item
|
||||
|
||||
+56
-57
@@ -4,7 +4,8 @@
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import cloudscraper, json, copy, inspect
|
||||
from core import jsontools, support
|
||||
from core import jsontools, support, config
|
||||
from core.httptools import downloadpage
|
||||
from platformcode import autorenumber, logger
|
||||
|
||||
session = cloudscraper.create_scraper()
|
||||
@@ -13,10 +14,10 @@ host = support.config.get_channel_url()
|
||||
response = session.get(host + '/archivio')
|
||||
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
|
||||
headers = {'content-type': 'application/json;charset=UTF-8',
|
||||
'Referer': host,
|
||||
'x-csrf-token': csrf_token,
|
||||
'Cookie' : '; '.join([x.name + '=' + x.value for x in response.cookies])}
|
||||
|
||||
|
||||
@support.menu
|
||||
def mainlist(item):
|
||||
top = [('Ultimi Episodi', ['', 'news'])]
|
||||
@@ -40,13 +41,13 @@ def menu(item):
|
||||
Terminato = copy.copy(item.args)
|
||||
Terminato['status'] = 'Terminato'
|
||||
itemlist = [item.clone(title=support.typo('Tutti','bold')),
|
||||
item.clone(title=support.typo('ITA','bold'), args=ITA),
|
||||
item.clone(title=support.typo('Genere','bold'), action='genres'),
|
||||
item.clone(title=support.typo('Anno','bold'), action='years')]
|
||||
item.clone(title='ITA', args=ITA),
|
||||
item.clone(title='Genere', action='genres'),
|
||||
item.clone(title='Anno', action='years')]
|
||||
if item.contentType == 'tvshow':
|
||||
itemlist += [item.clone(title=support.typo('In Corso','bold'), args=InCorso),
|
||||
item.clone(title=support.typo('Terminato','bold'), args=Terminato)]
|
||||
itemlist +=[item.clone(title=support.typo('Cerca...','bold'), action='search', thumbnail=support.thumb('search'))]
|
||||
itemlist += [item.clone(title='In Corso', args=InCorso),
|
||||
item.clone(title='Terminato', args=Terminato)]
|
||||
itemlist +=[item.clone(title=support.typo(config.get_localized_string(70741).replace(' %s', '…'),'bold'), action='search', thumbnail=support.thumb('search'))]
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -58,7 +59,7 @@ def genres(item):
|
||||
|
||||
for genre in genres:
|
||||
item.args['genres'] = [genre]
|
||||
itemlist.append(item.clone(title=support.typo(genre['name'],'bold'), action='movies'))
|
||||
itemlist.append(item.clone(title=genre['name'], action='movies'))
|
||||
return support.thumb(itemlist)
|
||||
|
||||
def years(item):
|
||||
@@ -71,7 +72,7 @@ def years(item):
|
||||
|
||||
for year in list(reversed(range(oldest_year, current_year + 1))):
|
||||
item.args['year']=year
|
||||
itemlist.append(item.clone(title=support.typo(year,'bold'), action='movies'))
|
||||
itemlist.append(item.clone(title=year, action='movies'))
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -121,11 +122,14 @@ def news(item):
|
||||
session = cloudscraper.create_scraper()
|
||||
|
||||
fullJs = json.loads(support.match(session.get(item.url).text, headers=headers, patron=r'items-json="([^"]+)"').match.replace('"','"'))
|
||||
# logger.debug(jsontools.dump(fullJs))
|
||||
js = fullJs['data']
|
||||
|
||||
for it in js:
|
||||
itemlist.append(
|
||||
item.clone(title= support.typo(it['anime']['title'] + ' - EP. ' + it['number'], 'bold'),
|
||||
item.clone(title=it['anime']['title'],
|
||||
contentTitle = it['anime']['title'],
|
||||
contentEpisodeNumber = int(it['number']),
|
||||
fulltitle=it['anime']['title'],
|
||||
thumbnail=it['anime']['imageurl'],
|
||||
forcethumb = True,
|
||||
@@ -133,8 +137,8 @@ def news(item):
|
||||
plot=it['anime']['plot'],
|
||||
action='findvideos')
|
||||
)
|
||||
if 'next_page_url' in fullJs:
|
||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'),thumbnail=support.thumb(), url=fullJs['next_page_url']))
|
||||
if fullJs.get('next_page_url'):
|
||||
support.nextPage(itemlist, item, 'news', next_page=fullJs['next_page_url'], total_pages=int(fullJs['last_page_url'].split('=')[-1]))
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -151,7 +155,9 @@ def movies(item):
|
||||
item.args['order'] = order_list[order]
|
||||
|
||||
payload = json.dumps(item.args)
|
||||
records = session.post(host + '/archivio/get-animes', headers=headers, data=payload).json()['records']
|
||||
js = session.post(host + '/archivio/get-animes', headers=headers, data=payload).json()
|
||||
records = js['records']
|
||||
total_pages = int(js['tot'] / 30)
|
||||
|
||||
for it in records:
|
||||
logger.debug(jsontools.dump(it))
|
||||
@@ -161,18 +167,25 @@ def movies(item):
|
||||
if 'ita' in lang.lower(): language = 'ITA'
|
||||
else: language = 'Sub-ITA'
|
||||
|
||||
itm = item.clone(title=support.typo(title,'bold') + support.typo(language,'_ [] color kod') + (support.typo(it['title_eng'],'_ ()') if it['title_eng'] else ''))
|
||||
itm.contentLanguage = language
|
||||
itm.type = it['type']
|
||||
itm.thumbnail = it['imageurl']
|
||||
itm.plot = it['plot']
|
||||
itm.url = item.url
|
||||
itm = item.clone(title=title,
|
||||
contentLanguage = language,
|
||||
type = it['type'],
|
||||
thumbnail = it['imageurl'],
|
||||
plot = it['plot'],
|
||||
url = '{}/{}-{}'.format(item.url, it['id'], it['slug'])
|
||||
)
|
||||
# itm.contentLanguage = language
|
||||
# itm.type = it['type']
|
||||
# itm.thumbnail = it['imageurl']
|
||||
# itm.plot = it['plot']
|
||||
# itm.url = item.url
|
||||
|
||||
if it['episodes_count'] == 1:
|
||||
itm.contentType = 'movie'
|
||||
itm.fulltitle = itm.show = itm.contentTitle = title
|
||||
itm.contentSerieName = ''
|
||||
itm.action = 'findvideos'
|
||||
itm.action = 'play'
|
||||
item.forcethumb=True
|
||||
itm.video_url = it['episodes'][0]['scws_id']
|
||||
|
||||
else:
|
||||
@@ -181,33 +194,31 @@ def movies(item):
|
||||
itm.fulltitle = itm.show = itm.contentSerieName = title
|
||||
itm.action = 'episodes'
|
||||
itm.episodes = it['episodes'] if 'episodes' in it else it['scws_id']
|
||||
itm.video_url = item.url
|
||||
# itm.video_url = item.url
|
||||
|
||||
itemlist.append(itm)
|
||||
|
||||
autorenumber.start(itemlist)
|
||||
if len(itemlist) >= 30:
|
||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), page=page + 1))
|
||||
if len(itemlist) == 30:
|
||||
support.nextPage(itemlist, item, 'movies', page=page + 1, total_pages=total_pages)
|
||||
|
||||
return itemlist
|
||||
|
||||
def episodes(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
title = 'Parte ' if item.type.lower() == 'movie' else 'Episodio '
|
||||
# title = 'Parte ' if item.type.lower() == 'movie' else 'Episodio '
|
||||
for it in item.episodes:
|
||||
|
||||
episode2 = it['number'].split('.')[-1]
|
||||
episode = it['number'].split('.')[0]
|
||||
itemlist.append(
|
||||
item.clone(title=title,
|
||||
episode = it['number'],
|
||||
fulltitle=item.title,
|
||||
show=item.title,
|
||||
contentTitle='',
|
||||
contentEpisodeNumber=it['number'],
|
||||
contentSerieName=item.contentSerieName,
|
||||
thumbnail=item.thumbnail,
|
||||
plot=item.plot,
|
||||
action='findvideos',
|
||||
item.clone(episodes = [],
|
||||
contentEpisodeNumber=int(float(it['number'])),
|
||||
episodeExtra = '.' + it['number'].split('.')[-1] if '.' in it['number'] else '',
|
||||
action='play',
|
||||
contentType='episode',
|
||||
forcethumb=True,
|
||||
video_url=it['scws_id']))
|
||||
|
||||
if inspect.stack()[1][3] not in ['find_episodes']:
|
||||
@@ -217,29 +228,17 @@ def episodes(item):
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
directLink = False
|
||||
if item.video_url == None:
|
||||
if item.extra == "tvshow":
|
||||
epnum = item.episode
|
||||
logger.info('it is a episode', epnum)
|
||||
episode = None
|
||||
for ep in item.episodes:
|
||||
if ep["number"] == epnum:
|
||||
episode = ep
|
||||
break
|
||||
if episode == None:
|
||||
logger.warn('cannot found episode')
|
||||
else:
|
||||
item.url = episode["link"]
|
||||
directLink = True
|
||||
|
||||
if directLink:
|
||||
logger.info('try direct link')
|
||||
return support.server(item, itemlist=[item.clone(title=support.config.get_localized_string(30137), url=item.url, server='directo', action='play')])
|
||||
else:
|
||||
return support.server(item, itemlist=[item.clone(title="StreamingCommunityWS", url=str(item.video_url), manifest = 'hls', server='streamingcommunityws', action='play')])
|
||||
def play(item):
|
||||
from time import time
|
||||
from base64 import b64encode
|
||||
from hashlib import md5
|
||||
|
||||
# Calculate Token
|
||||
client_ip = support.httptools.downloadpage('https://scws.xyz/videos/{}'.format(item.video_url), headers=headers).json.get('client_ip')
|
||||
expires = int(time() + 172800)
|
||||
token = b64encode(md5('{}{} Yc8U6r8KjAKAepEA'.format(expires, client_ip).encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
|
||||
|
||||
url = 'https://scws.xyz/master/{}?token={}&expires={}&n=1'.format(item.video_url, token, expires)
|
||||
|
||||
return [item.clone(server='directo', url=url, manifest='hls')]
|
||||
|
||||
|
||||
+22
-15
@@ -1,5 +1,5 @@
|
||||
from platformcode import config, logger, autorenumber
|
||||
from core import httptools, scrapertools, support, tmdb
|
||||
from core import httptools, jsontools, scrapertools, support, tmdb
|
||||
from inspect import stack
|
||||
|
||||
import sys
|
||||
@@ -27,7 +27,7 @@ def mainlist(item):
|
||||
def submenu_az(item):
|
||||
itemlist = []
|
||||
for letter in ['0-9'] + list('ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
|
||||
itemlist.append(item.clone(title = support.typo(letter, 'bold'),
|
||||
itemlist.append(item.clone(title = letter,
|
||||
url= host + '/api/anime/find-by-char',
|
||||
action= 'movies',
|
||||
variable= '&character=' + letter,
|
||||
@@ -40,7 +40,7 @@ def submenu_year(item):
|
||||
current = date.today().year
|
||||
first = int(httptools.downloadpage('{}/api/anime/advanced-search?page=0&size=1&sort=startDate,asc&sort=id'.format(host)).json[0]['startDate'].split('-')[0]) -1
|
||||
for year in range(current, first, -1):
|
||||
itemlist.append(item.clone(title = support.typo(year, 'bold'),
|
||||
itemlist.append(item.clone(title = year,
|
||||
action= 'submenu_season',
|
||||
variable= year,
|
||||
thumbnail=support.thumb('year')))
|
||||
@@ -51,7 +51,7 @@ def submenu_top(item):
|
||||
links = {'Top del giorno':'daily-top', 'Top della settimana':'weekly-top', 'Top del mese':'monthly-top'}
|
||||
for label in links:
|
||||
link = links[label]
|
||||
itemlist.append(item.clone(title = support.typo(label, 'bold'),
|
||||
itemlist.append(item.clone(title = label,
|
||||
action= 'submenu_top_of',
|
||||
variable= link))
|
||||
return itemlist
|
||||
@@ -80,9 +80,9 @@ def submenu_top_of(item):
|
||||
title = fulltitle.split('(')[0].strip()
|
||||
scrapedlang = scrapertools.find_single_match(fulltitle, r'\(([^\)]+)')
|
||||
lang = scrapedlang.upper() if scrapedlang else 'Sub-ITA'
|
||||
long_title = support.typo(title, 'bold') + support.typo(lang, '_ [] color kod')
|
||||
# long_title = support.typo(title, 'bold') + support.typo(lang, '_ [] color kod')
|
||||
|
||||
itemlist.append(item.clone(title=long_title,
|
||||
itemlist.append(item.clone(title=title,
|
||||
id=anime['animeId'],
|
||||
url = '{}/api/anime/{}'.format(host, anime['animeId']),
|
||||
thumbnail = get_thumbnail(anime, 'animeHorizontalImages'),
|
||||
@@ -123,18 +123,21 @@ def newest(category):
|
||||
|
||||
def latest_added(item):
|
||||
itemlist = []
|
||||
if config.get_setting("window_type") == 0:
|
||||
item.window = True
|
||||
item.folder = False
|
||||
page = item.page if item.page else 0
|
||||
url= '{}/api/home/latest-episodes?page={}'.format(host, page)
|
||||
js = httptools.downloadpage(url).json
|
||||
|
||||
for episode in js:
|
||||
title = episode['title']
|
||||
logger.debug(jsontools.dump(episode))
|
||||
title = episode['title'] if episode['title'] else episode['animeTitle']
|
||||
animeTitle, lang = get_lang(episode['animeTitle'])
|
||||
quality = 'Full HD' if episode['fullHd'] else 'HD'
|
||||
long_title = support.typo('{}. {}{}'.format(int(float(episode['episodeNumber'])), title + ' - ' if title else '', animeTitle), 'bold') + support.typo(lang, '_ [] color kod') + support.typo(quality, '_ [] color kod')
|
||||
image = get_thumbnail(episode, 'episodeImages')
|
||||
|
||||
itemlist.append(item.clone(title=long_title,
|
||||
itemlist.append(item.clone(title=title,
|
||||
fulltitle=title,
|
||||
animeId = episode['animeId'],
|
||||
id=episode['id'],
|
||||
@@ -165,9 +168,7 @@ def movies(item):
|
||||
for it in js:
|
||||
title, lang = get_lang(it['title'])
|
||||
|
||||
long_title = support.typo(title, 'bold') + support.typo(lang, '_ [] color kod')
|
||||
|
||||
itemlist.append(item.clone(title = long_title,
|
||||
itemlist.append(item.clone(title = title,
|
||||
fulltitle = title,
|
||||
show = title,
|
||||
contentLanguage = lang,
|
||||
@@ -193,6 +194,10 @@ def episodes(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
|
||||
if config.get_setting("window_type") == 0:
|
||||
item.window = True
|
||||
item.folder = False
|
||||
|
||||
# url = '{}/api/anime/{}'.format(host, item.id)
|
||||
json = httptools.downloadpage(item.url, CF=False ).json
|
||||
|
||||
@@ -208,6 +213,7 @@ def episodes(item):
|
||||
title = it['name']
|
||||
|
||||
itemlist.append(item.clone(title = title,
|
||||
contentTitle = title,
|
||||
id= '{}/season/{}'.format(it['animeId'], it['id']),
|
||||
contentType = 'season',
|
||||
action = 'list_episodes',
|
||||
@@ -259,10 +265,11 @@ def list_episodes(item, json=None):
|
||||
else:
|
||||
episode = '{:02d}'.format(int(it['episodeNumber'].split('.')[0]))
|
||||
|
||||
title = support.typo('{}. {}'.format(episode, it['title']), 'bold')
|
||||
# title = support.typo('{}. {}'.format(episode, it['title']), 'bold')
|
||||
image = get_thumbnail(it, 'episodeImages')
|
||||
|
||||
itemlist.append(item.clone(title = title,
|
||||
itemlist.append(item.clone(title = it['title'],
|
||||
contentTitle = it['title'],
|
||||
id= it['id'],
|
||||
url= 'api/episode/{}'.format(it['id']),
|
||||
contentType = 'episode',
|
||||
@@ -283,7 +290,7 @@ def list_episodes(item, json=None):
|
||||
def findvideos(item):
|
||||
logger.debug()
|
||||
|
||||
url = '{}/api/{}/{}'.format(host, 'episode' if item.contentType == 'episode' else 'anime', item.id)
|
||||
url = '{}/api/{}/{}'.format(host, 'episode' if item.contentType != 'movie' else 'anime', item.id)
|
||||
|
||||
json = httptools.downloadpage(url, CF=False ).json
|
||||
|
||||
|
||||
@@ -6,5 +6,15 @@
|
||||
"thumbnail": "streamingcommunity.png",
|
||||
"banner": "streamingcommunity.png",
|
||||
"categories": ["movie","tvshow"],
|
||||
"settings": []
|
||||
"settings": [
|
||||
{
|
||||
"id": "pagination",
|
||||
"type": "list",
|
||||
"label": "Pagination",
|
||||
"default": 1,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": ["10", "20", "30", "40", "50", "60"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import json, requests, sys
|
||||
from core import support, channeltools
|
||||
from platformcode import logger
|
||||
from platformcode import config, logger
|
||||
if sys.version_info[0] >= 3:
|
||||
from concurrent import futures
|
||||
else:
|
||||
@@ -17,12 +17,17 @@ def findhost(url):
|
||||
host = support.config.get_channel_url(findhost)
|
||||
session = requests.Session()
|
||||
headers = {}
|
||||
perpage = config.get_setting('pagination', 'streamingcommunity', default=1) * 10 + 10
|
||||
|
||||
def getHeaders():
|
||||
global headers
|
||||
global host
|
||||
# support.dbg()
|
||||
if not headers:
|
||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'}
|
||||
response = session.get(host, headers=headers)
|
||||
if response.status_code != 200 or response.url != host:
|
||||
host = support.config.get_channel_url(findhost, forceFindhost=True)
|
||||
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
|
||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14',
|
||||
'content-type': 'application/json;charset=UTF-8',
|
||||
@@ -55,7 +60,7 @@ def genres(item):
|
||||
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='movies'))
|
||||
support.thumb(itemlist, genre=True)
|
||||
support.thumb(itemlist, mode=True)
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -105,14 +110,12 @@ def movies(item):
|
||||
# getHeaders()
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
recordlist = []
|
||||
videoType = 'movie' if item.contentType == 'movie' else 'tv'
|
||||
|
||||
page = item.page if item.page else 0
|
||||
offset = page * 60
|
||||
if item.records:
|
||||
records = item.records
|
||||
elif type(item.args) == int:
|
||||
offset = page * perpage
|
||||
|
||||
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:
|
||||
@@ -129,20 +132,27 @@ def movies(item):
|
||||
else:
|
||||
js = records
|
||||
|
||||
for i, it in enumerate(js):
|
||||
if i < 20:
|
||||
itemlist.append(makeItem(i, it, item))
|
||||
else:
|
||||
recordlist.append(it)
|
||||
itemlist = makeItems(item, js)
|
||||
|
||||
itemlist.sort(key=lambda item: item.n)
|
||||
if recordlist:
|
||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), page=page, records=recordlist))
|
||||
elif len(itemlist) >= 20:
|
||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), records=[], page=page + 1))
|
||||
support.tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
if len(itemlist) == perpage:
|
||||
support.nextPage(itemlist, item, 'movies', page=page + 1)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def makeItems(item, items):
|
||||
itemlist = []
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
itlist = [executor.submit(makeItem, n, it, item) for n, it in enumerate(items) if n < perpage]
|
||||
for res in futures.as_completed(itlist):
|
||||
if res.result():
|
||||
itemlist.append(res.result())
|
||||
itemlist.sort(key=lambda item: item.n)
|
||||
return itemlist
|
||||
|
||||
|
||||
def makeItem(n, it, item):
|
||||
info = session.post(host + '/api/titles/preview/{}'.format(it['id']), headers=headers).json()
|
||||
title, lang = support.match(info['name'], patron=r'([^\[|$]+)(?:\[([^\]]+)\])?').match
|
||||
@@ -196,34 +206,26 @@ def episodes(item):
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
video_urls = []
|
||||
data = support.match(item.url + item.episodeid, headers=headers).data.replace('"','"').replace('\\','')
|
||||
url = support.match(data, patron=r'video_url"\s*:\s*"([^"]+)"').match
|
||||
channelParams = channeltools.get_channel_parameters(item.channel)
|
||||
itemlist = [item.clone(title = channelParams['title'], server='directo', thumbnail=channelParams["thumbnail"], forcethumb=True, action='play')]
|
||||
return support.server(item, itemlist=itemlist)
|
||||
|
||||
def calculateToken():
|
||||
from time import time
|
||||
from base64 import b64encode as b64
|
||||
import hashlib
|
||||
o = 48
|
||||
n = support.match(host + '/client-address').data
|
||||
i = 'Yc8U6r8KjAKAepEA'
|
||||
t = int(time() + (3600 * o))
|
||||
l = '{}{} {}'.format(t, n, i)
|
||||
md5 = hashlib.md5(l.encode())
|
||||
s = '?token={}&expires={}'.format(b64(md5.digest()).decode().replace('=', '').replace('+', "-").replace('\\', "_"), t)
|
||||
return s
|
||||
token = calculateToken()
|
||||
def play(item):
|
||||
from time import time
|
||||
from base64 import b64encode
|
||||
from hashlib import md5
|
||||
|
||||
data = support.httptools.downloadpage(item.url + item.episodeid, headers=headers).data.replace('"','"').replace('\\','')
|
||||
scws_id = support.match(data, patron=r'scws_id"\s*:\s*(\d+)').match
|
||||
|
||||
def videourls(res):
|
||||
newurl = '{}/{}{}'.format(url, res, token)
|
||||
if requests.head(newurl, headers=headers).status_code == 200:
|
||||
video_urls.append({'type':'m3u8', 'res':res, 'url':newurl})
|
||||
if not scws_id:
|
||||
return []
|
||||
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
for res in ['480p', '720p', '1080p']:
|
||||
executor.submit(videourls, res)
|
||||
# Calculate Token
|
||||
client_ip = support.httptools.downloadpage('https://scws.xyz/videos/' + scws_id, headers=headers).json.get('client_ip')
|
||||
expires = int(time() + 172800)
|
||||
token = b64encode(md5('{}{} Yc8U6r8KjAKAepEA'.format(expires, client_ip).encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
|
||||
|
||||
if not video_urls: video_urls = [{'type':'m3u8', 'url':url + token}]
|
||||
itemlist = [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', video_urls=video_urls, thumbnail=channeltools.get_channel_parameters(item.channel)["thumbnail"], forcethumb=True)]
|
||||
return support.server(item, itemlist=itemlist)
|
||||
url = 'https://scws.xyz/master/{}?token={}&expires={}&n=1'.format(scws_id, token, expires)
|
||||
|
||||
return [item.clone(server='directo', url=url, manifest='hls')]
|
||||
+11
-7
@@ -3,8 +3,8 @@
|
||||
# Canale per vvvvid
|
||||
# ----------------------------------------------------------
|
||||
import requests, sys, inspect
|
||||
from core import support, tmdb
|
||||
from platformcode import autorenumber, logger, config
|
||||
from core import channeltools, support, tmdb
|
||||
from platformcode import autorenumber, logger, config, platformtools
|
||||
|
||||
host = support.config.get_channel_url()
|
||||
|
||||
@@ -140,6 +140,10 @@ def movies(item):
|
||||
|
||||
def episodes(item):
|
||||
itemlist = []
|
||||
if config.get_setting("window_type") == 0:
|
||||
item.window = True
|
||||
item.folder = False
|
||||
|
||||
if item.episodes:
|
||||
episodes = item.episodes
|
||||
show_id = item.show_id
|
||||
@@ -164,10 +168,11 @@ def episodes(item):
|
||||
if type(title) == tuple: title = title[0]
|
||||
itemlist.append(
|
||||
item.clone(title = title,
|
||||
contentType = 'episode',
|
||||
contentEpisodeNumber = int(episode['number']),
|
||||
url= main_host + show_id + '/season/' + str(season_id),
|
||||
action= 'findvideos',
|
||||
video_id= episode['video_id']))
|
||||
url= main_host + show_id + '/season/' + str(season_id),
|
||||
action= 'findvideos',
|
||||
video_id= episode['video_id']))
|
||||
|
||||
if inspect.stack()[1][3] not in ['find_episodes']:
|
||||
autorenumber.start(itemlist, item)
|
||||
@@ -209,8 +214,7 @@ def findvideos(item):
|
||||
item.clone(action= 'play',
|
||||
title=config.get_localized_string(30137),
|
||||
url= item.url + '?' + key,
|
||||
server= 'directo')
|
||||
)
|
||||
server= 'directo'))
|
||||
|
||||
return support.server(item, itemlist=itemlist, Download=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user