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