StreamingCommunityWS
This commit is contained in:
@@ -218,22 +218,6 @@ def episodios(item):
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
if item.scws_id:
|
||||
from time import time
|
||||
from base64 import b64encode
|
||||
from hashlib import md5
|
||||
# support.dbg()
|
||||
|
||||
# Calculate Token
|
||||
# client_ip = support.httptools.downloadpage('https://scws.work/videos/{}'.format(item.scws_id)).json.get('client_ip')
|
||||
client_ip = support.httptools.downloadpage('http://ip-api.com/json/').json.get('query')
|
||||
logger.debug(client_ip)
|
||||
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.work/master/{}?token={}&expires={}&n=1'.format(item.scws_id, token, expires)
|
||||
itemlist = [item.clone(title=support.config.get_localized_string(30137), url=url, server='directo', action='play', manifest='hls',referer=False)]
|
||||
else:
|
||||
itemlist = [item.clone(title=support.config.get_localized_string(30137), url=item.video_url, server='directo', action='play',referer=False)]
|
||||
itemlist = [item.clone(title=support.config.get_localized_string(30137), server='streamingcommunityws')]
|
||||
return support.server(item, itemlist=itemlist, referer=False)
|
||||
|
||||
|
||||
@@ -233,46 +233,46 @@ def episodios(item):
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
itemlist = [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo')]
|
||||
return support.server(item, itemlist=itemlist)
|
||||
itemlist = [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='streamingcommunityws')]
|
||||
return support.server(item, itemlist=itemlist, referer=False)
|
||||
|
||||
def play(item):
|
||||
from time import time
|
||||
from base64 import b64encode
|
||||
from hashlib import md5
|
||||
# def play(item):
|
||||
# from time import time
|
||||
# from base64 import b64encode
|
||||
# from hashlib import md5
|
||||
|
||||
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
|
||||
# support.dbg()
|
||||
# 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
|
||||
# # support.dbg()
|
||||
|
||||
if not scws_id:
|
||||
if '<strong>Prossimamente' in data:
|
||||
platformtools.dialog_ok('StreamingCommunity', 'Il sito notifica che il contenuto sarà disponibile prossimamente')
|
||||
platformtools.play_canceled = True
|
||||
return []
|
||||
# if not scws_id:
|
||||
# if '<strong>Prossimamente' in data:
|
||||
# platformtools.dialog_ok('StreamingCommunity', 'Il sito notifica che il contenuto sarà disponibile prossimamente')
|
||||
# platformtools.play_canceled = True
|
||||
# return []
|
||||
|
||||
# Calculate Token
|
||||
# client_ip = support.httptools.downloadpage('https://scws.work/videos/{}'.format(scws_id)).json.get('client_ip')
|
||||
client_ip = support.httptools.downloadpage('http://ip-api.com/json/').json.get('query')
|
||||
# # Calculate Token
|
||||
# # client_ip = support.httptools.downloadpage('https://scws.work/videos/{}'.format(scws_id)).json.get('client_ip')
|
||||
# client_ip = support.httptools.downloadpage('http://ip-api.com/json/').json.get('query')
|
||||
|
||||
expires = int(time() + 172800)
|
||||
token = b64encode(md5('{}{} Yc8U6r8KjAKAepEA'.format(expires, client_ip).encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
|
||||
# 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.work/master/{}?token={}&expires={}&n=1'.format(scws_id, token, expires)
|
||||
subs = []
|
||||
urls = []
|
||||
# url = 'https://scws.work/master/{}?token={}&expires={}&n=1'.format(scws_id, token, expires)
|
||||
# subs = []
|
||||
# urls = []
|
||||
|
||||
info = support.match(url, patron=r'LANGUAGE="([^"]+)",\s*URI="([^"]+)|RESOLUTION=\d+x(\d+).*?(http[^"\s]+)', headers=headers).matches
|
||||
if info:
|
||||
for lang, sub, res, url in info:
|
||||
if sub and not logger.testMode: # ai test non piace questa parte
|
||||
if lang == 'auto': lang = 'ita-forced'
|
||||
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])
|
||||
# info = support.match(url, patron=r'LANGUAGE="([^"]+)",\s*URI="([^"]+)|RESOLUTION=\d+x(\d+).*?(http[^"\s]+)', headers=headers).matches
|
||||
# if info:
|
||||
# for lang, sub, res, url in info:
|
||||
# if sub and not logger.testMode: # ai test non piace questa parte
|
||||
# if lang == 'auto': lang = 'ita-forced'
|
||||
# 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', referer=False)]
|
||||
else:
|
||||
return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', url=url, manifest='hls', referer=False)]
|
||||
# return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='stt', video_urls=urls, subtitle=subs, manifest='hls', referer=False)]
|
||||
# else:
|
||||
# return [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', url=url, manifest='hls', referer=False)]
|
||||
|
||||
@@ -1,30 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
from core import httptools, support
|
||||
from platformcode import logger, config
|
||||
|
||||
import json
|
||||
import random
|
||||
from core import httptools, support, scrapertools
|
||||
from platformcode import platformtools, logger
|
||||
from lib.streamingcommunity import Client as SCClient
|
||||
|
||||
files = None
|
||||
|
||||
def test_video_exists(page_url):
|
||||
global scws_id
|
||||
logger.debug('page url=', page_url)
|
||||
# support.dbg()
|
||||
|
||||
# page_url is the {VIDEO_ID}. Es: 5957
|
||||
scws_id = support.match(page_url, patron=r'scws_id[^:]+:(\d+)').match
|
||||
|
||||
if not scws_id:
|
||||
return False, config.get_localized_string(70449) % 'StreamingCommunityWS'
|
||||
return True, ""
|
||||
|
||||
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
from time import time
|
||||
from base64 import b64encode
|
||||
from hashlib import md5
|
||||
|
||||
video_urls = []
|
||||
global scws_id
|
||||
video_urls = list()
|
||||
|
||||
global c
|
||||
c = SCClient("",video_id=page_url, is_playing_fnc=platformtools.is_playing)
|
||||
|
||||
media_url = c.get_manifest_url()
|
||||
|
||||
video_urls.append([scrapertools.get_filename_from_url(media_url)[-4:] + " [Streaming Community]", media_url])
|
||||
# clientIp = httptools.downloadpage(f'https://scws.work/videos/{scws_id}').json.get('client_ip')
|
||||
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'
|
||||
video_urls.append(['hls', url])
|
||||
|
||||
return video_urls
|
||||
|
||||
Reference in New Issue
Block a user