From 612921b61dc5c627339548036cb7c358e6f70fe8 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Tue, 28 Sep 2021 15:18:59 +0200 Subject: [PATCH] Nuovo Server HighLoad --- platformcode/launcher.py | 4 +- servers/directo.json | 2 +- servers/highload.json | 42 ++++++++++++++++++++ servers/highload.py | 84 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 servers/highload.json create mode 100644 servers/highload.py diff --git a/platformcode/launcher.py b/platformcode/launcher.py index ca612b95..637bc619 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -467,12 +467,12 @@ def play_from_library(item): logger.debug() # Modify the action (currently the video library needs "findvideos" since this is where the sources are searched - item.action = "findvideos" + item.action = item.next_action if item.next_action else "findvideos" window_type = config.get_setting("window_type", "videolibrary") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 1 # and launch kodi again - if xbmc.getCondVisibility('Window.IsMedia') and not window_type == 1: + if (xbmc.getCondVisibility('Window.IsMedia') and not window_type == 1) or item.action != 'findvideos': xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")") else: diff --git a/servers/directo.json b/servers/directo.json index a1b0a9fd..187384b2 100644 --- a/servers/directo.json +++ b/servers/directo.json @@ -4,7 +4,7 @@ "ignore_urls": [], "patterns": [ { - "pattern": "((?:https?://).\\S+.(m3u8|mp4|mpeg|mpd|flv)[^\"'\n]*)", + "pattern": "(https?://.\\S+.(?:m3u8|mpd)[^\"'\n]*)", "url": "\\1" }, { diff --git a/servers/highload.json b/servers/highload.json new file mode 100644 index 00000000..281dcb43 --- /dev/null +++ b/servers/highload.json @@ -0,0 +1,42 @@ +{ + "active": true, + "find_videos": { + "ignore_urls": [], + "patterns": [ + { + "pattern": "(https://highload.to/[ef]/[A-z0-9]+)", + "url": "\\1" + } + ] + }, + "free": true, + "id": "highload", + "name": "HighLoad", + "settings": [ + { + "default": false, + "enabled": true, + "id": "black_list", + "label": "@60654", + "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 + } + ], + "thumbnail": "https://i.postimg.cc/3JrRZv5w/highload.png" + } \ No newline at end of file diff --git a/servers/highload.py b/servers/highload.py new file mode 100644 index 00000000..5e738f52 --- /dev/null +++ b/servers/highload.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- +try: + from urllib.parse import urlparse +except: + from urlparse import urlparse + +from core import httptools, support +from platformcode import logger, config +from functools import reduce +import base64 + + +def test_video_exists(page_url): + logger.info('page_url="{}"'.format(page_url)) + global data + data = httptools.downloadpage(page_url) + if data.code == 404 or "We can't find the video" in data.data or 'sorry' in data.data: + return False, config.get_localized_string(70449) % "HighLoad" + data = data.data + return True, "" + + +def get_video_url(page_url, premium=False, user="", password="", video_password=""): + logger.info("url=" + page_url) + + global data + media_url = '' + video_urls = [] + + host = 'https://' + urlparse(page_url).netloc + + first = unhunt(support.match(data, patron =r'(.+?)').match) + + second_url = host + support.match(data, patron=r'src="(/assets/js/(?:master|tabber).js)').match + second = unhunt(httptools.downloadpage(second_url).data) + + v, r1, r2 = support.match(second, patron=r'var\s*res\s*=\s*([^.]+)\.replace\("([^"]+).+?replace\("([^"]+)').match + match = support.match(first, patron=r'var\s*{}\s*=\s*"([^"]+)'.format(v)).match + + if match: + media_url = base64.b64decode(match.replace(r1, '').replace(r2, '')).decode('utf-8') + + if media_url: + video_urls.append([media_url.split('.')[-1] +' [HighLoad]', media_url]) + return video_urls + + +def unhunt(source): + def decode(params): + h = params[0] + n = params[1] + t = int(params[2]) + e = int(params[3]) + r = "" + i = 0 + while i < len(h): + s = "" + while h[i] != n[e]: + s += h[i] + i += 1 + + for j in enumerate(n): + s = s.replace(j[1], str(j[0])) + + r += chr(int(dehunt(s, e, 10)) - t) + i += 1 + + return r + + def dehunt(d, e, f): + g = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/" + h = g[0:e] + i = g[0:f] + d = d[::-1] + j = reduce(lambda a, b: a + int(h[int(b[1])]) * (e ** int(b[0])) if int(h[int(b[1])]) != -1 else None, enumerate(d), 0) + k = "" + while j > 0: + k = i[int(j % f)] + k + j = (j - (j % f)) / f + + return k or "0" + + return decode(support.match(source, patron=r'\(h,\s*u,\s*n,\s*t,\s*e,\s*r\).+}\("([^"]+)",[^,]+,\s*"([^"]+)",\s*(\d+),\s*(\d+)').match) +