fix StreamingCommunity

This commit is contained in:
Alhaziel01
2021-12-18 12:00:48 +01:00
parent 3b52812f55
commit 2bfad01bd5
3 changed files with 50 additions and 15 deletions

View File

@@ -5,8 +5,8 @@
import functools
import json, requests, sys
from channels.mediasetplay import Token
from core import support, channeltools, httptools
from platformcode import logger
from core import support, channeltools, httptools, jsontools, filetools
from platformcode import logger, config, platformtools
# def findhost(url):
@@ -191,7 +191,9 @@ def episodios(item):
js = json.loads(support.match(item.url, patron=r'seasons="([^"]+)').match.replace('"','"'))
for episodes in js:
logger.debug(jsontools.dump(js))
for it in episodes['episodes']:
itemlist.append(
item.clone(title=support.typo(str(episodes['number']) + 'x' + str(it['number']).zfill(2) + ' - ' + support.cleantitle(it['name']), 'bold'),
episode=it['number'],
@@ -233,5 +235,16 @@ def play(item):
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(scws_id, token, expires)
subs = []
urls = []
info = support.match(url, patron='(?:NAME="([^"]+)".*?URI="([^"]+)|RESOLUTION=\d+x(\d+).*?(http[^"\s]+))').matches
return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', url=url)]
for lang, sub, res, url in info:
if sub:
s = config.get_temp_file(lang +'.srt')
subs.append(s)
filetools.write(s, support.vttToSrt(httptools.downloadpage(support.match(sub, patron=r'(http[^\s\n]+)').match).data))
elif url:
urls.append(['hls [{}]'.format(res), url])
return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', video_urls=urls, subtitle=subs, manifest='hls')]