From 4a1735fbb42cc7603a55b50abf8f800332d023f3 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Sat, 18 Dec 2021 12:24:24 +0100 Subject: [PATCH] ulteriore fix StreamingCommunity --- channels/streamingcommunity.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/channels/streamingcommunity.py b/channels/streamingcommunity.py index 1cb22aeb..36c70dfa 100644 --- a/channels/streamingcommunity.py +++ b/channels/streamingcommunity.py @@ -237,14 +237,17 @@ def play(item): 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 + if info: + 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]) - 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')] + return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', video_urls=urls, subtitle=subs, manifest='hls')] + else: + return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', url=url, manifest='hls')]