This commit is contained in:
Alhaziel01
2022-09-27 10:44:32 +02:00
parent 10f0899e81
commit 1542f6493a
2 changed files with 8 additions and 5 deletions
+6 -4
View File
@@ -6,9 +6,11 @@ from platformcode import logger, config
def test_video_exists(page_url):
global scws_id
logger.debug('page url=', page_url)
# support.dbg()
scws_id = support.match(page_url, patron=r'scws_id[^:]+:(\d+)').match
if page_url.isdigit():
scws_id = page_url
else:
scws_id = support.match(page_url, patron=r'scws_id[^:]+:(\d+)').match
if not scws_id:
return False, config.get_localized_string(70449) % 'StreamingCommunityWS'
@@ -27,8 +29,8 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
clientIp = httptools.downloadpage('http://ip-api.com/json/').json.get('query')
if clientIp:
expires = int(time() + 172800)
token = b64encode(md5(f'{expires}{clientIp} Yc8U6r8KjAKAepEA'.encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
url = f'https://scws.work/master/{scws_id}?token={token}&expires={expires}&n=1'
token = b64encode(md5('{}{} Yc8U6r8KjAKAepEA'.format(expires, clientIp).encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
url = 'https://scws.work/master/{}?token={}&expires={}&n=1'.format(scws_id, token, expires)
video_urls.append(['hls', url])
return video_urls