Fix Ninjastream
This commit is contained in:
@@ -712,7 +712,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
||||
|
||||
# if it is a video in mpd format, the listitem is configured to play it ith the inpustreamaddon addon implemented in Kodi 17
|
||||
# from core.support import dbg;dbg()
|
||||
if item.manifest == 'hls':
|
||||
if item.manifest == 'hls' or mediaurl.endswith('m3u8'):
|
||||
if not install_inputstream():
|
||||
return
|
||||
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
|
||||
|
||||
@@ -20,17 +20,24 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
logger.debug("URL", page_url)
|
||||
video_urls = []
|
||||
|
||||
h = json.loads(support.match(data, patron='stream="([^"]+)"').match.replace('"','"'))
|
||||
baseurl = decode(h['host']) + h['hash']
|
||||
matches = support.match(baseurl + '/index.m3u8', patron=r'RESOLUTION=\d+x(\d+)\s*([^\s]+)').matches
|
||||
headers = {'User-Agent': httptools.get_user_agent(),
|
||||
'Referer': page_url,
|
||||
'Origin': 'https://ninjastream.to',
|
||||
'X-Requested-With': 'XMLHttpRequest'}
|
||||
|
||||
for quality, url in matches:
|
||||
video_urls.append(["{} {}p [NinjaStream]".format(url.split('.')[-1], quality), '{}/{}'.format(baseurl, url)])
|
||||
apiUrl = 'https://ninjastream.to/api/video/get'
|
||||
post = {'id':page_url.split('/')[-1]}
|
||||
data = httptools.downloadpage(apiUrl, headers=headers, post=post).json
|
||||
|
||||
if data.get('result',{}).get('playlist'):
|
||||
url = data.get('result',{}).get('playlist')
|
||||
|
||||
video_urls.append([url.split('.')[-1], url])
|
||||
|
||||
return video_urls
|
||||
|
||||
def decode(host):
|
||||
Host = ''
|
||||
for n in range(len(host)):
|
||||
Host += chr(ord(host[n]) ^ ord('2'))
|
||||
return Host
|
||||
# def decode(host):
|
||||
# Host = ''
|
||||
# for n in range(len(host)):
|
||||
# Host += chr(ord(host[n]) ^ ord('2'))
|
||||
# return Host
|
||||
Reference in New Issue
Block a user