This commit is contained in:
pipcat
2018-09-05 18:06:17 +02:00
parent 62404eabfb
commit b8383e3842

View File

@@ -15,7 +15,7 @@ headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/2
def test_video_exists(page_url):
referer = page_url.replace('iframe', 'preview')
data = httptools.downloadpage(page_url, headers={'referer': referer}).data
if data == "File was deleted":
if data == "File was deleted" or data == '':
return False, "[powvideo] El video ha sido borrado"
return True, ""
@@ -33,26 +33,12 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
url = scrapertools.find_single_match(unpacked, "(?:src):\\\\'([^\\\\]+.mp4)\\\\'")
matches = scrapertools.find_single_match(data, "\['splice'\]\(0x([0-9a-fA-F]*),0x([0-9a-fA-F]*)\);")
if matches:
url = decode_powvideo_url(url, int(matches[0], 16), int(matches[1], 16))
else:
matches = scrapertools.find_single_match(data, "\(0x([0-9a-fA-F]*),0x([0-9a-fA-F]*)\);")
if matches:
url = decode_powvideo_url(url, int(matches[0], 16), int(matches[1], 16))
else:
logger.debug('No detectado splice! Revisar sistema de decode...')
# ~ logger.debug(data)
itemlist.append([".mp4" + " [powvideo]", url])
itemlist.append([".mp4" + " [powvideo]", decode_video_url(url)])
itemlist.sort(key=lambda x: x[0], reverse=True)
return itemlist
def decode_powvideo_url(url, desde, num):
def decode_video_url(url):
tria = re.compile('[0-9a-z]{40,}', re.IGNORECASE).findall(url)[0]
gira = tria[::-1]
if desde == 0:
x = gira[num:]
else:
x = gira[:desde] + gira[(desde+num):]
x = gira[1:]
return re.sub(tria, x, url)