cloudvideo: fix

This commit is contained in:
Intel1
2018-08-08 11:35:27 -05:00
committed by GitHub
parent b05adcf4de
commit 0d1845ff81

View File

@@ -10,27 +10,21 @@ from platformcode import logger
def test_video_exists(page_url):
logger.info("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url)
if data.code == 404:
return False, "[Cloud] El archivo no existe o ha sido borrado"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
logger.info("url=" + page_url)
video_urls = []
data = httptools.downloadpage(page_url).data
data = re.sub(r'"|\n|\r|\t|&nbsp;|<br>|\s{2,}', "", data)
enc_data = scrapertools.find_single_match(data, "type='text/javascript'>(.*?)</script>")
dec_data = jsunpack.unpack(enc_data)
sources = scrapertools.find_single_match(dec_data, "sources:\[(.*?)]")
patron = "{file:(.*?)}"
matches = re.compile(patron, re.DOTALL).findall(sources)
scrapertools.printMatches(matches)
sources = scrapertools.find_single_match(data, "<source(.*?)</source")
patron = 'src="([^"]+)'
matches = scrapertools.find_multiple_matches(sources, patron)
for url in matches:
quality = 'm3u8'
video_url = url
@@ -39,5 +33,4 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
video_url = url[0]
quality = url[1].replace('label:','')
video_urls.append(['cloudvideo [%s]' % quality, video_url])
return video_urls
return video_urls