From 139a7fe588ed2e3754ea8cc330b961464ac8d472 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Fri, 17 Dec 2021 17:40:05 +0100 Subject: [PATCH] Test StreamingCommunity --- channels/streamingcommunity.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/channels/streamingcommunity.py b/channels/streamingcommunity.py index ba6891bd..73109bfb 100644 --- a/channels/streamingcommunity.py +++ b/channels/streamingcommunity.py @@ -220,6 +220,7 @@ def play(item): from time import time from base64 import b64encode from hashlib import md5 + video_urls = [] data = support.httptools.downloadpage(item.url + item.episodeid, headers=headers).data.replace('"','"').replace('\\','') scws_id = support.match(data, patron=r'scws_id"\s*:\s*(\d+)').match @@ -232,6 +233,9 @@ def play(item): expires = int(time() + 172800) 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) + sub = 'https://scws.xyz/master/{}?token={}&expires={}&n=1'.format(scws_id, token, expires) + urls = support.match(sub, patron=r'RESOLUTION=\d+x(\d+)(?:\s*,\s*SUBTITLES="[^"]+")\s*([^\s\n]+)').matches + for quality, url in urls: + video_urls.append(['hls [{}p]'.format(quality),url]) - return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', url=url)] + return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', video_urls=video_urls, manifest='hls', subtitle=sub)]