From 17eea720bca34912e49dc48ffc5b19354124ef02 Mon Sep 17 00:00:00 2001 From: fatshotty Date: Thu, 24 Jun 2021 17:39:15 +0200 Subject: [PATCH 1/3] fix: maxstream --- servers/maxstream.py | 49 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/servers/maxstream.py b/servers/maxstream.py index d77e3e6c..aa6bbda8 100644 --- a/servers/maxstream.py +++ b/servers/maxstream.py @@ -2,21 +2,52 @@ from core import httptools from core import scrapertools, support from lib import jsunpack from platformcode import logger, config - +import re, ast, requests def test_video_exists(page_url): logger.debug("(page_url='%s')" % page_url) - global data + + page_url = re.sub(r'(.*\/)([^\/]+)$', '\\1cast/\\2', page_url) + data = httptools.downloadpage(page_url).data - if "File Not Found" in data or "File was deleted" in data: - return False, config.get_localized_string(70449) % "MaxStream" - return True, "" + lastIndexStart = data.rfind('') + + script = data[ (lastIndexStart + len('') - unpacked = jsunpack.unpack(packed) - return support.get_jwplayer_mediaurl(unpacked, 'MaxStream') + + # page_url = re.sub(r'(.*\/)([^\/]+)$', '\\1/cast/\\2', page_url) + + # data = httptools.downloadpage(page_url).data + + # packed = scrapertools.find_single_match(data, r'(eval.*?)') + # unpacked = jsunpack.unpack(packed) + # return support.get_jwplayer_mediaurl(unpacked, 'MaxStream') + + if url_video: + video_urls = [] + video_urls.append(["[MaxStream]", url_video]) + return video_urls + else: + raise "Something wrong: no url found before :(" + From 9f595ef4094cded6d5f1db4422d91ff7e5de0512 Mon Sep 17 00:00:00 2001 From: fatshotty Date: Fri, 25 Jun 2021 10:38:08 +0200 Subject: [PATCH 2/3] fix refactor code --- servers/maxstream.json | 2 +- servers/maxstream.py | 41 +++++++++++++++++------------------------ 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/servers/maxstream.json b/servers/maxstream.json index 8cb8257d..893c21e3 100644 --- a/servers/maxstream.json +++ b/servers/maxstream.json @@ -5,7 +5,7 @@ "patterns": [ { "pattern": "https?://maxstream.video/(?:e/)?([a-z0-9]+)", - "url": "https://maxstream.video/\\1" + "url": "https://maxstream.video/cast/\\1" }, { "pattern": "https?://maxstream.video/embed-([a-z0-9]+).html", diff --git a/servers/maxstream.py b/servers/maxstream.py index aa6bbda8..2607737b 100644 --- a/servers/maxstream.py +++ b/servers/maxstream.py @@ -7,10 +7,19 @@ import re, ast, requests def test_video_exists(page_url): logger.debug("(page_url='%s')" % page_url) - page_url = re.sub(r'(.*\/)([^\/]+)$', '\\1cast/\\2', page_url) - + global data data = httptools.downloadpage(page_url).data + if "file was deleted" in data: + return False, config.get_localized_string(70449) % "MaxStream" + + return True, "" + + + +def get_video_url(page_url, premium=False, user="", password="", video_password=""): + logger.debug("url=" + page_url) + lastIndexStart = data.rfind('') @@ -19,35 +28,19 @@ def test_video_exists(page_url): char_codes = ast.literal_eval(re.search('\[[^]+]+]',script).group(0)) hidden_js = "".join([chr(c - int(re.search('parseInt\(value\)\s?-\s?([0-9]+)', script).group(1))) for c in char_codes]) - newurl = re.search('\$.get\(\'([^\']+)', hidden_js).group(1) - global url_video + # newurl = re.search('\$.get\(\'([^\']+)', hidden_js).group(1) + newurl = scrapertools.find_single_match(hidden_js, r'\$.get\(\'([^\']+)') + url_video = None castpage = httptools.downloadpage(newurl, headers={'x-requested-with': 'XMLHttpRequest', 'Referer': page_url }).data - url_video = re.search( r"cc\.cast\('(http[s]?.*?)'", castpage) - if url_video: - url_video = url_video.group(1) - return True, "" - - return False, config.get_localized_string(70449) % "MaxStream" - - -def get_video_url(page_url, premium=False, user="", password="", video_password=""): - logger.debug("url=" + page_url) - - # page_url = re.sub(r'(.*\/)([^\/]+)$', '\\1/cast/\\2', page_url) - - # data = httptools.downloadpage(page_url).data - - # packed = scrapertools.find_single_match(data, r'(eval.*?)') - # unpacked = jsunpack.unpack(packed) - # return support.get_jwplayer_mediaurl(unpacked, 'MaxStream') + url_video = scrapertools.find_single_match(castpage, r"cc\.cast\('(http[s]?.*?)'") if url_video: video_urls = [] - video_urls.append(["[MaxStream]", url_video]) + video_urls.append(["mp4 [MaxStream]", url_video]) return video_urls else: - raise "Something wrong: no url found before :(" + raise "Something wrong: no url found before that :(" From 7c197f89f1c394dd6a1c998441fe2ed3949e4e66 Mon Sep 17 00:00:00 2001 From: fatshotty Date: Fri, 25 Jun 2021 11:09:58 +0200 Subject: [PATCH 3/3] fix maxstream for tvshows and movies --- servers/maxstream.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/servers/maxstream.json b/servers/maxstream.json index 893c21e3..353937a5 100644 --- a/servers/maxstream.json +++ b/servers/maxstream.json @@ -4,12 +4,8 @@ "ignore_urls": [], "patterns": [ { - "pattern": "https?://maxstream.video/(?:e/)?([a-z0-9]+)", + "pattern": "https?://maxstream.video/.*?([^\/]+)$", "url": "https://maxstream.video/cast/\\1" - }, - { - "pattern": "https?://maxstream.video/embed-([a-z0-9]+).html", - "url": "https://maxstream.video/\\1" } ] },