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
|
# 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()
|
# from core.support import dbg;dbg()
|
||||||
if item.manifest == 'hls':
|
if item.manifest == 'hls' or mediaurl.endswith('m3u8'):
|
||||||
if not install_inputstream():
|
if not install_inputstream():
|
||||||
return
|
return
|
||||||
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
|
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
|
||||||
|
|||||||
+17
-10
@@ -20,17 +20,24 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
|||||||
logger.debug("URL", page_url)
|
logger.debug("URL", page_url)
|
||||||
video_urls = []
|
video_urls = []
|
||||||
|
|
||||||
h = json.loads(support.match(data, patron='stream="([^"]+)"').match.replace('"','"'))
|
headers = {'User-Agent': httptools.get_user_agent(),
|
||||||
baseurl = decode(h['host']) + h['hash']
|
'Referer': page_url,
|
||||||
matches = support.match(baseurl + '/index.m3u8', patron=r'RESOLUTION=\d+x(\d+)\s*([^\s]+)').matches
|
'Origin': 'https://ninjastream.to',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'}
|
||||||
|
|
||||||
for quality, url in matches:
|
apiUrl = 'https://ninjastream.to/api/video/get'
|
||||||
video_urls.append(["{} {}p [NinjaStream]".format(url.split('.')[-1], quality), '{}/{}'.format(baseurl, url)])
|
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
|
return video_urls
|
||||||
|
|
||||||
def decode(host):
|
# def decode(host):
|
||||||
Host = ''
|
# Host = ''
|
||||||
for n in range(len(host)):
|
# for n in range(len(host)):
|
||||||
Host += chr(ord(host[n]) ^ ord('2'))
|
# Host += chr(ord(host[n]) ^ ord('2'))
|
||||||
return Host
|
# return Host
|
||||||
Reference in New Issue
Block a user