Fix e Migliorie a Cloudvideo, Supervideo e vidoza
This commit is contained in:
@@ -9,8 +9,10 @@ from platformcode import logger
|
|||||||
|
|
||||||
def test_video_exists(page_url):
|
def test_video_exists(page_url):
|
||||||
logger.info("(page_url='%s')" % page_url)
|
logger.info("(page_url='%s')" % page_url)
|
||||||
data = httptools.downloadpage(page_url)
|
html = httptools.downloadpage(page_url)
|
||||||
if data.code == 404:
|
global data
|
||||||
|
data = html.data
|
||||||
|
if html.code == 404:
|
||||||
return False, config.get_localized_string(70292) % "CloudVideo"
|
return False, config.get_localized_string(70292) % "CloudVideo"
|
||||||
return True, ""
|
return True, ""
|
||||||
|
|
||||||
@@ -18,7 +20,8 @@ def test_video_exists(page_url):
|
|||||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||||
logger.info("url=" + page_url)
|
logger.info("url=" + page_url)
|
||||||
video_urls = []
|
video_urls = []
|
||||||
data = httptools.downloadpage(page_url).data
|
global data
|
||||||
|
# data = httptools.downloadpage(page_url).data
|
||||||
# enc_data = scrapertools.find_single_match(data, "text/javascript">(.+?)</script>")
|
# enc_data = scrapertools.find_single_match(data, "text/javascript">(.+?)</script>")
|
||||||
# dec_data = jsunpack.unpack(enc_data)
|
# dec_data = jsunpack.unpack(enc_data)
|
||||||
sources = scrapertools.find_single_match(data, "<source(.*?)</source")
|
sources = scrapertools.find_single_match(data, "<source(.*?)</source")
|
||||||
|
|||||||
+18
-10
@@ -9,7 +9,7 @@ import ast
|
|||||||
|
|
||||||
def test_video_exists(page_url):
|
def test_video_exists(page_url):
|
||||||
logger.info("(page_url='%s')" % page_url)
|
logger.info("(page_url='%s')" % page_url)
|
||||||
|
global data
|
||||||
data = httptools.downloadpage(page_url, cookies=False).data
|
data = httptools.downloadpage(page_url, cookies=False).data
|
||||||
if 'File Not Found' in data:
|
if 'File Not Found' in data:
|
||||||
return False, config.get_localized_string(70449) % "SuperVideo"
|
return False, config.get_localized_string(70449) % "SuperVideo"
|
||||||
@@ -20,27 +20,35 @@ def test_video_exists(page_url):
|
|||||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||||
logger.info("url=" + page_url)
|
logger.info("url=" + page_url)
|
||||||
video_urls = []
|
video_urls = []
|
||||||
data = httptools.downloadpage(page_url).data
|
# data = httptools.downloadpage(page_url).data
|
||||||
logger.info('SUPER DATA= '+data)
|
global data
|
||||||
|
|
||||||
code_data = scrapertools.find_single_match(data, "<script type='text/javascript'>(eval.*)")
|
code_data = scrapertools.find_single_match(data, "<script type='text/javascript'>(eval.*)")
|
||||||
if code_data:
|
if code_data:
|
||||||
code = jsunpack.unpack(code_data)
|
code = jsunpack.unpack(code_data)
|
||||||
|
|
||||||
|
# corrections
|
||||||
|
if 'file' in code and not '"file"'in code: code = code.replace('file','"file"')
|
||||||
|
if 'label' in code and not '"label"'in code: code = code.replace('label','"label"')
|
||||||
|
|
||||||
match = scrapertools.find_single_match(code, r'sources:(\[[^]]+\])')
|
match = scrapertools.find_single_match(code, r'sources:(\[[^]]+\])')
|
||||||
lSrc = ast.literal_eval(match)
|
lSrc = ast.literal_eval(match)
|
||||||
|
|
||||||
lQuality = ['360p', '720p', '1080p', '4k'][:len(lSrc)-1]
|
# lQuality = ['360p', '720p', '1080p', '4k'][:len(lSrc)-1]
|
||||||
lQuality.reverse()
|
# lQuality.reverse()
|
||||||
|
|
||||||
|
for source in lSrc:
|
||||||
|
quality = source['label'] if source.has_key('label') else 'auto'
|
||||||
|
video_urls.append(['.' + source['file'].split('.')[-1] + ' [' + quality + '] [SuperVideo]', source['file']])
|
||||||
|
|
||||||
for n, source in enumerate(lSrc):
|
|
||||||
quality = 'auto' if n==0 else lQuality[n-1]
|
|
||||||
video_urls.append(['.' + source.split('.')[-1] + '(' + quality + ') [SuperVideo]', source])
|
|
||||||
else:
|
else:
|
||||||
logger.info('ELSE!')
|
logger.info('ELSE!')
|
||||||
matches = scrapertools.find_multiple_matches(data, r'src:\s*"([^"]+)",\s*type:\s*"[^"]+"(?:\s*, res:\s(\d+))?')
|
matches = scrapertools.find_multiple_matches(data, r'src:\s*"([^"]+)",\s*type:\s*"[^"]+"(?:\s*, res:\s(\d+))?')
|
||||||
for url, quality in matches:
|
for url, quality in matches:
|
||||||
if url.split('.')[-1] != 'm3u8':
|
if url.split('.')[-1] != 'm3u8':
|
||||||
video_urls.append([url.split('.')[-1] + ' [' + quality + ']', url])
|
video_urls.append([url.split('.')[-1] + ' [' + quality + '] [SuperVideo]', url])
|
||||||
else:
|
else:
|
||||||
video_urls.append([url.split('.')[-1], url])
|
video_urls.append([url.split('.')[-1], url])
|
||||||
video_urls.sort(key=lambda x: x[0].split()[-1])
|
|
||||||
|
video_urls.sort(key=lambda x: x[0].split()[-2])
|
||||||
return video_urls
|
return video_urls
|
||||||
|
|||||||
+4
-3
@@ -8,6 +8,7 @@ from platformcode import logger
|
|||||||
|
|
||||||
def test_video_exists(page_url):
|
def test_video_exists(page_url):
|
||||||
logger.info("(page_url='%s')" % page_url)
|
logger.info("(page_url='%s')" % page_url)
|
||||||
|
global data
|
||||||
data = httptools.downloadpage(page_url).data
|
data = httptools.downloadpage(page_url).data
|
||||||
if "Page not found" in data or "File was deleted" in data:
|
if "Page not found" in data or "File was deleted" in data:
|
||||||
return False, "[vidoza] El archivo no existe o ha sido borrado"
|
return False, "[vidoza] El archivo no existe o ha sido borrado"
|
||||||
@@ -19,7 +20,7 @@ def test_video_exists(page_url):
|
|||||||
|
|
||||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||||
logger.info("(page_url='%s')" % page_url)
|
logger.info("(page_url='%s')" % page_url)
|
||||||
data = httptools.downloadpage(page_url).data
|
global data
|
||||||
video_urls = []
|
video_urls = []
|
||||||
|
|
||||||
s = scrapertools.find_single_match(data, r'sourcesCode\s*:\s*(\[\{.*?\}\])')
|
s = scrapertools.find_single_match(data, r'sourcesCode\s*:\s*(\[\{.*?\}\])')
|
||||||
@@ -30,8 +31,8 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
|||||||
if 'src' in enlace or 'file' in enlace:
|
if 'src' in enlace or 'file' in enlace:
|
||||||
url = enlace['src'] if 'src' in enlace else enlace['file']
|
url = enlace['src'] if 'src' in enlace else enlace['file']
|
||||||
tit = ''
|
tit = ''
|
||||||
if 'label' in enlace: tit += '[%s]' % enlace['label']
|
if 'label' in enlace: tit += ' [%s]' % enlace['label']
|
||||||
if 'res' in enlace: tit += '[%s]' % enlace['res']
|
if 'res' in enlace: tit += ' [%s]' % enlace['res']
|
||||||
if tit == '' and 'type' in enlace: tit = enlace['type']
|
if tit == '' and 'type' in enlace: tit = enlace['type']
|
||||||
if tit == '': tit = '.mp4'
|
if tit == '': tit = '.mp4'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user