Fix AnimeUnity e SCWS
This commit is contained in:
@@ -200,10 +200,10 @@ def peliculas(item):
|
|||||||
def episodios(item):
|
def episodios(item):
|
||||||
support.info()
|
support.info()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
title = 'Parte ' if item.type.lower() == 'movie' else 'Episodio '
|
title = 'Parte' if item.type.lower() == 'movie' else 'Episodio'
|
||||||
for it in item.episodes:
|
for it in item.episodes:
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
item.clone(title=support.typo(title + it['number'], 'bold'),
|
item.clone(title=support.typo('{}. {} {}'.format(it['number'], title, it['number']), 'bold'),
|
||||||
episode = it['number'],
|
episode = it['number'],
|
||||||
fulltitle=item.title,
|
fulltitle=item.title,
|
||||||
show=item.title,
|
show=item.title,
|
||||||
@@ -213,7 +213,8 @@ def episodios(item):
|
|||||||
plot=item.plot,
|
plot=item.plot,
|
||||||
action='findvideos',
|
action='findvideos',
|
||||||
contentType='episode',
|
contentType='episode',
|
||||||
scws_id=it.get('scws_id', ''))
|
url = '{}/{}'.format(item.url, it['id'])
|
||||||
|
)
|
||||||
# video_url=it.get('link', ''))
|
# video_url=it.get('link', ''))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -17,15 +17,9 @@ vttsupport = False if int(xbmc.getInfoLabel('System.BuildVersion').split('.')[0]
|
|||||||
|
|
||||||
|
|
||||||
def test_video_exists(page_url):
|
def test_video_exists(page_url):
|
||||||
global server_url
|
|
||||||
global iframeParams
|
global iframeParams
|
||||||
|
server_url = support.scrapertools.decodeHtmlentities(support.match(page_url, patron=['<iframe [^>]+src="([^"]+)', 'embed_url="([^"]+)']).match)
|
||||||
server_url = support.scrapertools.decodeHtmlentities(support.match(page_url, patron='<iframe [^>]+src="([^"]+)').match)
|
iframeParams = support.match(server_url, patron=r'''"quality":(\d+)[^;]+;\s+window\.masterPlaylist\s+=\s+{[^{]+({[^}]+}),\s+url:\s+'([^']+)''').match
|
||||||
if not server_url:
|
|
||||||
server_url = support.match(page_url, patron='embed_url="([^"]+)').match
|
|
||||||
iframeParams = support.match(server_url, patron=['window.masterPlaylist\s=\s{\s.*params:\s(.*?}),',
|
|
||||||
'''},\s*url:\s.(http[^"']+).,''']).matches
|
|
||||||
logger.info(iframeParams)
|
|
||||||
|
|
||||||
if not iframeParams or len(iframeParams) < 2:
|
if not iframeParams or len(iframeParams) < 2:
|
||||||
return 'StreamingCommunity', 'Prossimamente'
|
return 'StreamingCommunity', 'Prossimamente'
|
||||||
@@ -34,53 +28,16 @@ def test_video_exists(page_url):
|
|||||||
|
|
||||||
|
|
||||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||||
urls = list()
|
|
||||||
subs = list()
|
|
||||||
local_subs = list()
|
|
||||||
video_urls = list()
|
video_urls = list()
|
||||||
|
|
||||||
# scws_id = urlparse(server_url).path.split('/')[-1]
|
quality, params, url = iframeParams
|
||||||
masterPlaylistParams = ast.literal_eval(iframeParams[0])
|
|
||||||
url = iframeParams[1] + '?{}&n=1'.format(urllib.urlencode(masterPlaylistParams))
|
|
||||||
|
|
||||||
# info = support.match(url, patron=r'LANGUAGE="([^"]+)",\s*URI="([^"]+)|(http.*?rendition=(\d+)[^\s]+)').matches
|
masterPlaylistParams = ast.literal_eval(params)
|
||||||
#
|
masterPlaylistParams['h'] = 1
|
||||||
# if info:
|
if quality == '720':
|
||||||
# for lang, sub, url, res in info:
|
masterPlaylistParams['b'] = 1
|
||||||
# if sub:
|
url = '{}?{}'.format(url,urllib.urlencode(masterPlaylistParams))
|
||||||
# if lang == 'auto': lang = 'ita-forced'
|
|
||||||
# subs.append([lang, sub])
|
video_urls = [['hls [{}]'.format(quality), url]]
|
||||||
# elif not 'token=&' in url:
|
|
||||||
# urls.append([res, url])
|
|
||||||
#
|
|
||||||
# if subs:
|
|
||||||
# local_subs = subs_downloader(subs)
|
|
||||||
# video_urls = [['m3u8 [{}]'.format(res), url, 0, local_subs] for res, url in urls]
|
|
||||||
# else:
|
|
||||||
# video_urls = [['m3u8 [{}]'.format(res), url] for res, url in urls]
|
|
||||||
# else:
|
|
||||||
video_urls = [['hls', url]]
|
|
||||||
|
|
||||||
return video_urls
|
return video_urls
|
||||||
|
|
||||||
|
|
||||||
def subs_downloader(subs):
|
|
||||||
def subs_downloader_thread(n, s):
|
|
||||||
lang, url = s
|
|
||||||
match = support.match(url, patron=r'(http[^\s\n]+)').match
|
|
||||||
if match:
|
|
||||||
data = httptools.downloadpage(match).data
|
|
||||||
if lang == 'auto': lang = 'ita-forced'
|
|
||||||
sub = config.get_temp_file('{}.{}'.format(lang, 'vtt' if vttsupport else 'str'))
|
|
||||||
filetools.write(sub, data if vttsupport else support.vttToSrt(data))
|
|
||||||
return n, sub
|
|
||||||
|
|
||||||
local_subs = list()
|
|
||||||
|
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
|
||||||
itlist = [executor.submit(subs_downloader_thread, n, s) for n, s in enumerate(subs)]
|
|
||||||
for res in futures.as_completed(itlist):
|
|
||||||
if res.result():
|
|
||||||
local_subs.append(res.result())
|
|
||||||
|
|
||||||
return [s[1] for s in sorted(local_subs, key=lambda n: n[0])]
|
|
||||||
|
|||||||
Reference in New Issue
Block a user