Fix maxstream
This commit is contained in:
+31
-30
@@ -30,10 +30,6 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
|||||||
video_urls = []
|
video_urls = []
|
||||||
global data
|
global data
|
||||||
|
|
||||||
# support.dbg()
|
|
||||||
cast_url = support.match('http://maxstream.video/?op=page&tmpl=../../download1', patron='<a\s+id="cast"\s+href="([^"]+)').match
|
|
||||||
data = httptools.downloadpage(cast_url.replace('https:', 'http:') + page_url.split('/')[-1]).data
|
|
||||||
|
|
||||||
|
|
||||||
# sitekey = scrapertools.find_multiple_matches(data, """data-sitekey=['"] *([^"']+)""")
|
# sitekey = scrapertools.find_multiple_matches(data, """data-sitekey=['"] *([^"']+)""")
|
||||||
# if sitekey: sitekey = sitekey[-1]
|
# if sitekey: sitekey = sitekey[-1]
|
||||||
@@ -55,34 +51,39 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
|||||||
# url = scrapertools.find_single_match(unpack, 'src:\s*"([^"]+)')
|
# url = scrapertools.find_single_match(unpack, 'src:\s*"([^"]+)')
|
||||||
# if url:
|
# if url:
|
||||||
# video_urls.append(['m3u8 [MaxStream]', url])
|
# video_urls.append(['m3u8 [MaxStream]', url])
|
||||||
url_video = ''
|
|
||||||
|
|
||||||
lastIndexStart = data.rfind('<script>')
|
# support.dbg()
|
||||||
lastIndexEnd = data.rfind('</script>')
|
possible_cast_url = support.match('http://maxstream.video/?op=page&tmpl=../../download1', patron='<a[^<]+href="(?:https://maxstream\.video/)?([^".?]+/)"').matches
|
||||||
|
for cast_url in possible_cast_url:
|
||||||
|
data = httptools.downloadpage('http://maxstream.video/' + cast_url + page_url.split('/')[-1]).data
|
||||||
|
url_video = ''
|
||||||
|
|
||||||
script = data[ (lastIndexStart + len('<script>')):lastIndexEnd ]
|
lastIndexStart = data.rfind('<script>')
|
||||||
|
lastIndexEnd = data.rfind('</script>')
|
||||||
|
|
||||||
match = scrapertools.find_single_match(script, r'(\[[^\]]+\])[^\{]*\{[^\(]+\(parseInt\(value\)\s?-\s?([0-9]+)')
|
script = data[ (lastIndexStart + len('<script>')):lastIndexEnd ]
|
||||||
if match:
|
|
||||||
char_codes = ast.literal_eval(match[0])
|
|
||||||
hidden_js = "".join([chr(c - int(match[1])) for c in char_codes])
|
|
||||||
|
|
||||||
newurl = scrapertools.find_single_match(hidden_js, r'\$.get\(\'([^\']+)').replace('https://', 'http://')
|
match = scrapertools.find_single_match(script, r'(\[[^\]]+\])[^\{]*\{[^\(]+\(parseInt\(value\)\s?-\s?([0-9]+)')
|
||||||
castpage = httptools.downloadpage(newurl, headers={'x-requested-with': 'XMLHttpRequest', 'Referer': page_url}).data
|
if match:
|
||||||
url_video = scrapertools.find_single_match(castpage, r"cc\.cast\('(http[s]?.[^']+)'")
|
char_codes = ast.literal_eval(match[0])
|
||||||
else:
|
hidden_js = "".join([chr(c - int(match[1])) for c in char_codes])
|
||||||
logger.debug('Something wrong: no url found before that :(')
|
|
||||||
|
|
||||||
if url_video:
|
newurl = scrapertools.find_single_match(hidden_js, r'\$.get\(\'([^\']+)').replace('https://', 'http://')
|
||||||
import random, string
|
castpage = httptools.downloadpage(newurl, headers={'x-requested-with': 'XMLHttpRequest', 'Referer': page_url}).data
|
||||||
parse = urlparse.urlparse(url_video)
|
url_video = scrapertools.find_single_match(castpage, r"cc\.cast\('(http[s]?.[^']+)'")
|
||||||
video_urls.append(['mp4 [MaxStream]', url_video])
|
else:
|
||||||
try:
|
logger.debug('Something wrong: no url found before that :(')
|
||||||
r1 = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(19))
|
|
||||||
r2 = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(19))
|
if url_video and url_video.split('/')[-1] == page_url.split('/')[-1]:
|
||||||
r3 = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(19))
|
import random, string
|
||||||
video_urls.append(['m3u8 [MaxStream]', '{}://{}/hls/{},{},{},{},.urlset/master.m3u8'.format(parse.scheme, parse.netloc, parse.path.split('/')[1], r1, r2, r3)])
|
parse = urlparse.urlparse(url_video)
|
||||||
# video_urls.append(['m3u8 [MaxStream]', '{}://{}/hls/{},wpsc2hllm5g5fkjvslq,4jcc2hllm5gzykkkgha,fmca2hllm5jtpb7cj5q,.urlset/master.m3u8'.format(parse.scheme, parse.netloc, parse.path.split('/')[1])])
|
video_urls = [['mp4 [MaxStream]', url_video]]
|
||||||
except:
|
try:
|
||||||
logger.debug('Something wrong: Impossible get HLS stream')
|
r1 = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(19))
|
||||||
return video_urls
|
r2 = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(19))
|
||||||
|
r3 = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(19))
|
||||||
|
video_urls.append(['m3u8 [MaxStream]', '{}://{}/hls/{},{},{},{},.urlset/master.m3u8'.format(parse.scheme, parse.netloc, parse.path.split('/')[1], r1, r2, r3)])
|
||||||
|
# video_urls.append(['m3u8 [MaxStream]', '{}://{}/hls/{},wpsc2hllm5g5fkjvslq,4jcc2hllm5gzykkkgha,fmca2hllm5jtpb7cj5q,.urlset/master.m3u8'.format(parse.scheme, parse.netloc, parse.path.split('/')[1])])
|
||||||
|
except:
|
||||||
|
logger.debug('Something wrong: Impossible get HLS stream')
|
||||||
|
return video_urls
|
||||||
|
|||||||
Reference in New Issue
Block a user