Corrección vidoza y platformtools

This commit is contained in:
pipcat
2018-07-20 21:48:32 +02:00
parent aa72291d2b
commit 27f0375e4e
2 changed files with 22 additions and 19 deletions
+17 -6
View File
@@ -20,13 +20,24 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
logger.info("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url).data
video_urls = []
matches = scrapertools.find_multiple_matches(data, 'src\s*:\s*"([^"]+)".*?label:\'([^\']+)\'')
for media_url, calidad in matches:
ext = media_url[-4:]
video_urls.append(["%s %s [vidoza]" % (ext, calidad), media_url])
s = scrapertools.find_single_match(data, 'sourcesCode\s*:\s*(\[\{.*?\}\])')
s = s.replace('src:', '"src":').replace('type:', '"type":').replace('label:', '"label":').replace('res:', '"res":')
try:
data = json.loads(str(s))
for enlace in data:
if 'src' in enlace:
tit = ''
if 'label' in enlace: tit += '[%s]' % enlace['label']
if 'res' in enlace: tit += '[%s]' % enlace['res']
if tit == '' and 'type' in enlace: tit = enlace['type']
if tit == '': tit = '.mp4'
video_urls.append(["%s [vidoza]" % tit, enlace['src']])
except:
logger.debug('No se detecta json %s' % s)
pass
video_urls.reverse()
for video_url in video_urls:
logger.info("%s - %s" % (video_url[0], video_url[1]))
return video_urls