From 09cc8564607ae2ef43abb06757ce06d5ad2f7e2d Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Sat, 16 Jan 2021 16:54:31 +0100 Subject: [PATCH] - Paramount in adesso in onda - StreamingCommunity come server --- channels/paramount.py | 2 +- channels/streamingcommunity.py | 11 ++----- servers/streamingcommunity_server.json | 41 ++++++++++++++++++++++++++ servers/streamingcommunity_server.py | 39 ++++++++++++++++++++++++ specials/filmontv.py | 2 +- 5 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 servers/streamingcommunity_server.json create mode 100644 servers/streamingcommunity_server.py diff --git a/channels/paramount.py b/channels/paramount.py index 1a56d8ea..f1d33281 100644 --- a/channels/paramount.py +++ b/channels/paramount.py @@ -57,7 +57,7 @@ def live(item): info = jsontools.load(support.match(host +'/api/on-air?channelId=' + ch_dict[title]).data) support.info(info) plot= '[B]' + info['seriesTitle'] +'[/B]\n' + info['description'] if 'seriesTitle' in info else '' - itemlist.append(item.clone(title=support.typo(title,'bold'), contentTitle=title, fulltitle=title, show=title, url=host+url, plot=plot, action='play', forcethumb=True)) + itemlist.append(item.clone(title=support.typo(title,'bold'), contentTitle=title, fulltitle=title, show=title, url=host+url, plot=plot, action='play', forcethumb=True, no_return=True)) return support.thumb(itemlist, live=True) diff --git a/channels/streamingcommunity.py b/channels/streamingcommunity.py index dfdfbc85..8dbcee33 100644 --- a/channels/streamingcommunity.py +++ b/channels/streamingcommunity.py @@ -190,12 +190,5 @@ def episodios(item): def findvideos(item): - getHeaders() - logger.debug() - itemlist=[] - url = support.match(support.match(item).data.replace('"','"').replace('\\',''), patron=r'video_url"\s*:\s*"([^"]+)"').match - for res in ['480p', '720p', '1080p']: - newurl = '{}/{}'.format(url, res) - if session.head(newurl, headers=headers).status_code == 200: - itemlist += [item.clone(title=support.config.get_localized_string(30137), server='directo', url=newurl, quality=res, action='play')] - return support.server(item, itemlist=itemlist) \ No newline at end of file + itemlist = [item.clone(title = 'StreamingCommunity', server='streamingcommunity_server')] + return support.server(item, item.url) \ No newline at end of file diff --git a/servers/streamingcommunity_server.json b/servers/streamingcommunity_server.json new file mode 100644 index 00000000..ef7afc58 --- /dev/null +++ b/servers/streamingcommunity_server.json @@ -0,0 +1,41 @@ +{ + "active": true, + "find_videos": { + "ignore_urls": [], + "patterns": [ + { + "pattern": "https://streamingcommunity.net/[^/]+/([A-Za-z0-9]+)", + "url": "https://streamingcommunity.net/watch/\\1" + } + ] + }, + "free": true, + "id":"streamingcommunity_server", + "name": "StreamingCommunity", + "settings": [ + { + "default": false, + "enabled": true, + "id": "black_list", + "label": "@70708", + "type": "bool", + "visible": true + }, + { + "default": 0, + "enabled": true, + "id": "favorites_servers_list", + "label": "@60655", + "lvalues": [ + "No", + "1", + "2", + "3", + "4", + "5" + ], + "type": "list", + "visible": false + } + ] +} diff --git a/servers/streamingcommunity_server.py b/servers/streamingcommunity_server.py new file mode 100644 index 00000000..4fa9acbd --- /dev/null +++ b/servers/streamingcommunity_server.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +import requests, sys +from core import httptools, support +from platformcode import config, logger + +if sys.version_info[0] >= 3: from concurrent import futures +else: from concurrent_py2 import futures + +headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14', + 'content-type': 'application/json;charset=UTF-8', + 'Referer': 'https://streamingcommunity.net'} + +def test_video_exists(page_url): + global data + logger.debug('page url=', page_url) + response = httptools.downloadpage(page_url, headers=headers) + + if response.code == 404: + return False, config.get_localized_string(70449) % 'StreamingCommunity' + else: + data = response.data + return True, "" + + +def get_video_url(page_url, premium=False, user="", password="", video_password=""): + logger.debug("url=" + page_url) + video_urls = [] + url = support.match(data.replace('"','"').replace('\\',''), patron=r'video_url"\s*:\s*"([^"]+)"').match + def videourls(res): + newurl = '{}/{}'.format(url, res) + if requests.head(newurl, headers=headers).status_code == 200: + video_urls.append(["m3u8 {} [StreamingCommunity]".format(res), newurl]) + + with futures.ThreadPoolExecutor() as executor: + for res in ['480p', '720p', '1080p']: + executor.submit(videourls, res) + if not video_urls: video_urls = [["m3u8 [StreamingCommunity]", url]] + else: video_urls.sort(key=lambda url: int(support.match(url[0], patron=r'(\d+)p').match)) + return video_urls diff --git a/specials/filmontv.py b/specials/filmontv.py index 0a44c78c..94d0bdb7 100644 --- a/specials/filmontv.py +++ b/specials/filmontv.py @@ -241,7 +241,7 @@ def live(item): from concurrent_py2 import futures itemlist = [] channels_dict = {} - channels = ['raiplay', 'mediasetplay', 'la7'] + channels = ['raiplay', 'mediasetplay', 'la7', 'paramount'] with futures.ThreadPoolExecutor() as executor: itlist = [executor.submit(load_live, channel) for channel in channels]