Hay un nuevo cambio en streamplay, no se si empezó ayer o hoy.
Os dejo el py que uso pero con las librerias que uso insertadas dentro del archivo para que poáis probarlo hasta que alguien lo adapte a la versión del github o para que alguno la adapte a la suya si es diferente
Código: Seleccionar todo
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para streamplay
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
from core.scrapertools import *
headers = [
['User-Agent','Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0'],
['Host','streamplay.to'],
]
host = "http://streamplay.to/"
def test_video_exists(page_url):
logger.info("pelisalacarta.streamplay test_video_exists(page_url='%s')" % page_url)
data = cache_page(page_url)
if "<title>watch </title>" in data.lower(): return False, "[Streamplay] El archivo no existe o ha sido borrado"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
logger.info("pelisalacarta.streamplay get_video_url(page_url='%s')" % page_url)
url = page_url.replace(host, host + "embed-") + ".html"
data = cache_page(url)
'''
data = cache_page(page_url, headers=headers)
data = find_multiple_matches(data.replace('"',"'"), "name='([^']+)'\s*value='([^']*)'")
post = urllib.urlencode({k:v for k, v in data})
import time
time.sleep(5)
data = cache_page(page_url, post=post, headers=headers+[['Referer',page_url]])
'''
jj_encode = find_single_match(data, "(\w+=~\[\];.*?\)\(\)\)\(\);)")
jj_decode = None; jj_patron = None; reverse = False; substring = False
if jj_encode: jj_decode = jjdecode(jj_encode)
if jj_decode: jj_patron = find_single_match(jj_decode, "/([^/]+)/")
if not "(" in jj_patron: jj_patron = "(" + jj_patron
if not ")" in jj_patron: jj_patron+= ")"
if "x72x65x76x65x72x73x65" in jj_decode: reverse = True
if "x73x75x62x73x74x72x69x6Ex67" in jj_decode: substring = True
data = find_single_match(data, "<script type=.text/javascript.>(eval\(function\(p,a,c,k,e,d.*?)</script>")
data = unPack(data).replace("\\", "")
data = find_single_match(data, "sources\s*=[^\[]*\[([^\]]+)\]")
matches = find_multiple_matches(data.replace('"', "'"), "[src|file]:'([^']+)'")
video_urls = []
for video_url in matches:
_hash = find_single_match(video_url, '\w{40,}')
if substring:
substring = int(find_single_match(jj_decode, "_\w+.\d...(\d)...;"))
if reverse: _hash = _hash[:-substring]
else: _hash = _hash[substring:]
if reverse: video_url = re.sub(r'\w{40,}', _hash[::-1], video_url)
filename = get_filename_from_url(video_url)[-4:]
if video_url.startswith("rtmp"):
rtmp, playpath = video_url.split("vod/", 1)
video_url = "%s playpath=%s swfUrl=%splayer6/jwplayer.flash.swf pageUrl=%s" % (rtmp + "vod/", playpath, host, page_url)
filename = "RTMP"
elif "m3u8" in video_url:
video_url += "|User-Agent=" + headers[0][1]
elif video_url.endswith("/v.mp4"):
video_url_flv = re.sub(r'/v.mp4$','/v.flv',video_url)
video_urls.append( [ ".flv" + " [powvideo]", re.sub(r'%s' % jj_patron, r'\1', video_url_flv)])
video_urls.append( [ filename + " [powvideo]", re.sub(r'%s' % jj_patron, r'\1', video_url)])
for video_url in video_urls:
logger.info("[streamplay.py] %s - %s" % (video_url[0], video_url[1]))
return video_urls
def find_videos(data):
encontrados = set()
devuelve = []
patronvideos = host + "(?:embed-|iframe-|preview-|)([a-z0-9]+)(?:-\d+[xX]\d.html|.html|)"
logger.info("pelisalacarta.streamplay find_videos #" + patronvideos + "#")
matches = re.compile(patronvideos, re.DOTALL).findall(data)
for match in matches:
titulo = "[streamplay]"
url = host + match
if url not in encontrados:
logger.info(" url=" + url)
devuelve.append([titulo, url, 'streamplay'])
encontrados.add(url)
else:
logger.info(" url duplicada=" + url)
return devuelve
def unPack(packed):
pattern = "}\('(.*)', *(\d+), *(\d+), *'(.*)'\.split\('([^']+)'\)"
d = [ d for d in re.search(pattern, packed, re.DOTALL).groups() ]
p = d[0]; a = int(d[1]); c = int(d[2]); k = d[3].split(d[4])
if a <= 62: toString = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
else: toString = """ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"""
def e(c):
return toString[c] if c < a else toString[c // a] + toString[c % a]
while c > 0:
c-= 1
if k[c]: x = e(c)
else: x = k[c]
y = k[c]
p = re.sub(r"(\b%s\b)" % x, y, p)
return p
def jjdecode(t):
x = '0123456789abcdef'
j = get_match(t, '^([^=]+)=')
t = t.replace(j + '.', 'j.')
t = re.sub(r'^.*?"\\""\+(.*?)\+"\\"".*?$', r'\1', t.replace('\\\\', '\\')) + '+""'
t = re.sub('(\(!\[\]\+""\)\[j\._\$_\])', '"l"', t)
t = re.sub(r'j\._\$\+', '"o"+', t)
t = re.sub(r'j\.__\+', '"t"+', t)
t = re.sub(r'j\._\+', '"u"+', t)
p = find_multiple_matches(t, '(j\.[^\+]+\+)')
for c in p:
t = t.replace(c, c.replace('_', '0').replace('$', '1'))
p = find_multiple_matches(t, 'j\.(\d{4})')
for c in p:
t = re.sub(r'j\.%s' % c, '"' + x[int(c, 2)] + '"', t)
p = find_multiple_matches(t, '\\"\+j\.(001)\+j\.(\d{3})\+j\.(\d{3})\+')
for c in p:
t = re.sub(r'\\"\+j\.%s\+j\.%s\+j\.%s\+' % (c[0], c[1], c[2]), chr(int("".join(c), 2)) + '"+', t)
p = find_multiple_matches(t, '\\"\+j\.(\d{3})\+j\.(\d{3})\+')
for c in p:
t = re.sub(r'\\"\+j\.%s\+j\.%s\+' % (c[0], c[1]), chr(int("".join(c),2)) + '"+', t)
p = find_multiple_matches(t, 'j\.(\d{3})')
for c in p:
t = re.sub(r'j\.%s' % c, '"' + str(int(c, 2)) + '"', t)
r = re.sub(r'"\+"|\\\\','',t[1:-1])
return r