fix refactor code
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"pattern": "https?://maxstream.video/(?:e/)?([a-z0-9]+)",
|
"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",
|
"pattern": "https?://maxstream.video/embed-([a-z0-9]+).html",
|
||||||
|
|||||||
+17
-24
@@ -7,10 +7,19 @@ import re, ast, requests
|
|||||||
def test_video_exists(page_url):
|
def test_video_exists(page_url):
|
||||||
logger.debug("(page_url='%s')" % 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
|
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('<script>')
|
lastIndexStart = data.rfind('<script>')
|
||||||
lastIndexEnd = data.rfind('</script>')
|
lastIndexEnd = data.rfind('</script>')
|
||||||
|
|
||||||
@@ -19,35 +28,19 @@ def test_video_exists(page_url):
|
|||||||
char_codes = ast.literal_eval(re.search('\[[^]+]+]',script).group(0))
|
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])
|
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)
|
# newurl = re.search('\$.get\(\'([^\']+)', hidden_js).group(1)
|
||||||
global url_video
|
newurl = scrapertools.find_single_match(hidden_js, r'\$.get\(\'([^\']+)')
|
||||||
|
|
||||||
url_video = None
|
url_video = None
|
||||||
|
|
||||||
castpage = httptools.downloadpage(newurl, headers={'x-requested-with': 'XMLHttpRequest', 'Referer': page_url }).data
|
castpage = httptools.downloadpage(newurl, headers={'x-requested-with': 'XMLHttpRequest', 'Referer': page_url }).data
|
||||||
|
|
||||||
url_video = re.search( r"cc\.cast\('(http[s]?.*?)'", castpage)
|
url_video = scrapertools.find_single_match(castpage, r"cc\.cast\('(http[s]?.*?)'")
|
||||||
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.*?)</script>')
|
|
||||||
# unpacked = jsunpack.unpack(packed)
|
|
||||||
# return support.get_jwplayer_mediaurl(unpacked, 'MaxStream')
|
|
||||||
|
|
||||||
if url_video:
|
if url_video:
|
||||||
video_urls = []
|
video_urls = []
|
||||||
video_urls.append(["[MaxStream]", url_video])
|
video_urls.append(["mp4 [MaxStream]", url_video])
|
||||||
return video_urls
|
return video_urls
|
||||||
else:
|
else:
|
||||||
raise "Something wrong: no url found before :("
|
raise "Something wrong: no url found before that :("
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user