correcciones e info para los canales
This commit is contained in:
@@ -6,6 +6,7 @@ import urlparse
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from core import servertools
|
||||
from core import tmdb
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
|
||||
@@ -17,15 +18,21 @@ def mainlist(item):
|
||||
|
||||
itemlist = list()
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="estrenos", title="Estrenos", url=host))
|
||||
itemlist.append(Item(channel=item.channel, action="lista", title="Peliculas",
|
||||
url=urlparse.urljoin(host, "p/peliculas.html")))
|
||||
url=urlparse.urljoin(host, "p/peliculas.html"), type='pl', first=0))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="lista", title="Series",
|
||||
url=urlparse.urljoin(host, "p/series.html")))
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Orden Alfabético", url=host))
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Géneros", url=host))
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Año de Estreno", url=host))
|
||||
#itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=urlparse.urljoin(host, "/search?q=")))
|
||||
url=urlparse.urljoin(host, "p/series.html"), type='sr', first=0))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Géneros", url=host, cat='genre'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Calidad", url=host, cat='quality'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Orden Alfabético", url=host, cat='abc'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action="category", title="Año de Estreno", url=host, cat='year'))
|
||||
|
||||
itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=host+"/search?q="))
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -34,155 +41,175 @@ def category(item):
|
||||
itemlist = list()
|
||||
data = httptools.downloadpage(host).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
patron_generos = "<h2 class='title'>"+item.title+"<\/h2><div class='.+?'><ul class='.+?'><(.+?)><\/ul><\/div>"
|
||||
data_generos = scrapertools.find_single_match(data, patron_generos)
|
||||
patron = "<a href='(.+?)'>(.+?)<\/a>"
|
||||
matches = scrapertools.find_multiple_matches(data_generos, patron)
|
||||
for scrapedurl, scrapedtitle in matches:
|
||||
|
||||
if item.cat == 'abc':
|
||||
data = scrapertools.find_single_match(data, '<span>Orden Alfabético</span>.*?</ul>')
|
||||
elif item.cat == 'genre':
|
||||
data = scrapertools.find_single_match(data, '<span>Géneros</span>.*?</ul>')
|
||||
elif item.cat == 'year':
|
||||
data = scrapertools.find_single_match(data, '<span>Año</span>.*?</ul>')
|
||||
elif item.cat == 'quality':
|
||||
data = scrapertools.find_single_match(data, '<span>Calidad</span>.*?</ul>')
|
||||
|
||||
patron = "<li>([^<]+)<a href='([^']+)'>"
|
||||
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
for scrapedtitle, scrapedurl in matches:
|
||||
if scrapedtitle != 'Próximas Películas':
|
||||
itemlist.append(item.clone(action='lista', title=scrapedtitle, url=host+scrapedurl))
|
||||
itemlist.append(item.clone(action='lista', title=scrapedtitle, url=host+scrapedurl, type='cat', first=0))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def search_results(item):
|
||||
logger.info()
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
|
||||
patron = '<span class=.post-labels.>([^<]+)</span>.*?class="poster-bg" src="([^"]+)"/>.*?<h4>.*?'
|
||||
patron +=">(\d{4})</a>.*?<h6>([^<]+)<a href='([^']+)"
|
||||
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
|
||||
for scrapedtype, scrapedthumbnail, scrapedyear, scrapedtitle ,scrapedurl in matches:
|
||||
|
||||
title="%s [%s]" % (scrapedtitle,scrapedyear)
|
||||
new_item= Item(channel=item.channel, title=title, url=scrapedurl, thumbnail=scrapedthumbnail)
|
||||
if scrapedtype.strip() == 'Serie':
|
||||
new_item.contentSerieName = scrapedtitle
|
||||
new_item.action = 'episodios'
|
||||
new_item.type = 'sr'
|
||||
else:
|
||||
new_item.contentTitle = scrapedtitle
|
||||
new_item.action = 'findvideos'
|
||||
new_item.type = 'pl'
|
||||
|
||||
|
||||
itemlist.append(new_item)
|
||||
|
||||
return itemlist
|
||||
|
||||
def search(item, texto):
|
||||
logger.info()
|
||||
texto = texto.replace(" ", "+")
|
||||
item.url = item.url + texto
|
||||
if texto != '':
|
||||
return lista(item)
|
||||
return search_results(item)
|
||||
|
||||
def estrenos(item):
|
||||
logger.info()
|
||||
itemlist = list()
|
||||
data = httptools.downloadpage(host).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
patron_estre = "<div class='widget HTML' data-version='1' id='HTML9'><h2 class='title'>(.+?)<\/a><\/li><\/ul>"
|
||||
data_estre = scrapertools.find_single_match(data, patron_estre)
|
||||
patron = '<i class="([^"]+)"><\/i><div class="calidad">.+?' #serie o peli
|
||||
patron +='<img src="([^"]+)"\/>' #scrapedthumbnail
|
||||
patron +='<h4>([^"]+)<\/h4>.+?' #scrapedtitle
|
||||
patron +='<a href="([^"]+)">' #scrapedurl
|
||||
matches = scrapertools.find_multiple_matches(data_estre, patron)
|
||||
for scrapedtype, scrapedthumbnail,scrapedtitle,scrapedurl in matches:
|
||||
title = "%s [%s]" % (scrapedtitle, scrapedtype)
|
||||
if scrapedtype == "pelicula":
|
||||
itemlist.append(item.clone(title=title, url=host+scrapedurl, action="findvideos", extra=scrapedtype,
|
||||
show=scrapedtitle, thumbnail=scrapedthumbnail, contentType="movie",
|
||||
context=["buscar_trailer"]))
|
||||
else:
|
||||
itemlist.append(item.clone(title=title, url=host+scrapedurl, show=scrapedtitle,
|
||||
thumbnail=scrapedthumbnail, action="capitulos"))
|
||||
return itemlist
|
||||
def capitulos(item):
|
||||
def episodios(item):
|
||||
logger.info()
|
||||
itemlist = list()
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
patron_datos='<div class="output">(.+?)><\/section>'
|
||||
data_caps = scrapertools.find_single_match(data, patron_datos)
|
||||
patron_caps='<img alt=".+?" src="(.+?)"\/><a href="http:\/\/bit.ly\/(.+?)"'
|
||||
matches = scrapertools.find_multiple_matches(data_caps, patron_caps)
|
||||
cap=0
|
||||
for scrapedthumbnail,scrapedurl in matches:
|
||||
link = scrapedurl
|
||||
cap=cap+1
|
||||
link="http://www.trueurl.net/?q=http%3A%2F%2Fbit.ly%2F"+link+"&lucky=on&Uncloak=Find+True+URL"
|
||||
data_other = httptools.downloadpage(link).data
|
||||
data_other = re.sub(r"\n|\r|\t|\s{2}| ", "", data_other)
|
||||
patron='<A title="http:\/\/privatelink.de\/\?(.+?)"'
|
||||
url = scrapertools.find_single_match(data_other, patron)
|
||||
title="%s%s - %s" % (title,str(cap).zfill(2),item.show)
|
||||
itemlist.append(item.clone(action='findvideos', title=title,
|
||||
url=url,show=item.show,thumbnail=scrapedthumbnail))
|
||||
patron ='<div id="ep(\d+)" class="eps"> <section class="section-post online"><div class="player">.*?'
|
||||
patron += 'src="([^"]+)"/><a href="([^"]+)" target='
|
||||
|
||||
matches = re.compile(patron,re.DOTALL).findall(data)
|
||||
|
||||
for scrapedepi, scrapedthumbnail, scrapedurl in matches:
|
||||
url = scrapedurl
|
||||
title="1x%s - %s" % (scrapedepi, item.contentSerieName)
|
||||
itemlist.append(item.clone(action='findvideos', title=title, url=url, thumbnail=scrapedthumbnail, type=item.type,
|
||||
infoLabels=item.infoLabels))
|
||||
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0:
|
||||
itemlist.append(Item(channel=item.channel, title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]", url=item.url,
|
||||
action="add_serie_to_library", extra="episodios", show=item.show))
|
||||
itemlist.append(Item(channel=item.channel, title="[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]",
|
||||
url=item.url, action="add_serie_to_library", extra="episodios",
|
||||
contentSerieName=item.contentSerieName))
|
||||
return itemlist
|
||||
|
||||
def bitly(item):
|
||||
logger.info()
|
||||
itemlist = list()
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
patron = '<a href="http:\/\/bit.ly\/(.+?)"'
|
||||
link = scrapertools.find_single_match(data, patron)
|
||||
link="http://www.trueurl.net/?q=http%3A%2F%2Fbit.ly%2F"+link+"&lucky=on&Uncloak=Find+True+URL"
|
||||
data_other = httptools.downloadpage(link).data
|
||||
data_other = re.sub(r"\n|\r|\t|\s{2}| ", "", data_other)
|
||||
patron='<A title="http:\/\/privatelink.de\/\?(.+?)"'
|
||||
url = scrapertools.find_single_match(data_other, patron)
|
||||
if item.contentType=="movie":
|
||||
contentType="movie"
|
||||
else:
|
||||
contentType="serie"
|
||||
item=(item.clone(action='findvideos',url=url,show=item.show, thumbnail=item.thumbnail, contentType=contentType))
|
||||
return item
|
||||
|
||||
def lista(item):
|
||||
logger.info()
|
||||
next = True
|
||||
itemlist = []
|
||||
|
||||
data = httptools.downloadpage(item.url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
|
||||
patron = '<i class="(.+?)"><\/i>' # scrapedtype
|
||||
patron +='<div class="calidad">(.+?)<\/div>' # scrapedquality
|
||||
patron += '<img src="(.+?)"\/>' # scrapedthumbnail
|
||||
patron += '<h4>(.+?)<\/h4>' # scrapedtitle
|
||||
patron += "<h5>(.+?)<\/h5>" # scrapedyear
|
||||
patron += '<a href="(.+?)"' # scrapedurl
|
||||
#patron += "<\/a>.+?<div class='item-snippet'>(.+?)<" # scrapedplot
|
||||
if item.title!="Prueba":
|
||||
pat='<div id="tab-1"><ul class="post-gallery">(.+?)<\/ul><\/div>'
|
||||
data=scrapertools.find_single_match(data, pat)
|
||||
data = scrapertools.find_single_match(data, "itemprop='headline'>.*?</h2>.*?</ul>")
|
||||
|
||||
patron = '<span class="([^"]+)">.*?<figure class="poster-bg"><header><span>(\d{4})</span></header><img src="([^"]+)" />'
|
||||
patron += '<footer>(.*?)</footer></figure><h6>([^<]+)</h6><a href="([^"]+)"></a>'
|
||||
|
||||
matches = scrapertools.find_multiple_matches(data, patron)
|
||||
for scrapedtype,scrapedquality,scrapedthumbnail,scrapedtitle,scrapedyear,scrapedurl in matches:
|
||||
|
||||
first = int(item.first)
|
||||
last = first + 19
|
||||
if last > len(matches):
|
||||
last = len(matches)
|
||||
next = False
|
||||
|
||||
|
||||
for scrapedtype, scrapedyear, scrapedthumbnail, scrapedquality, scrapedtitle ,scrapedurl in matches[first:last]:
|
||||
patron_quality="<span>(.+?)</span>"
|
||||
quality = scrapertools.find_multiple_matches(scrapedquality, patron_quality)
|
||||
qual=""
|
||||
|
||||
for calidad in quality:
|
||||
qual=qual+"["+calidad+"] "
|
||||
|
||||
title="%s [%s] %s" % (scrapedtitle,scrapedyear,qual)
|
||||
if item.title =="Series":
|
||||
itemlist.append(item.clone(title=title, url=host+scrapedurl, extra=scrapedtitle, plot=scrapedtitle,
|
||||
show=scrapedtitle, thumbnail=scrapedthumbnail, contentType="serie", action="capitulos"))
|
||||
elif scrapedtype != 'serie':
|
||||
itemlist.append(
|
||||
item.clone(title=title, url=host+scrapedurl, action="findvideos", extra=scrapedtype, plot=scrapedtitle,
|
||||
show=scrapedtitle, thumbnail=scrapedthumbnail, contentType="movie", context=["buscar_trailer"]))
|
||||
new_item= Item(channel=item.channel, title=title, url=host+scrapedurl, thumbnail=scrapedthumbnail,
|
||||
type=scrapedtype, infoLabels={'year':scrapedyear})
|
||||
if scrapedtype.strip() == 'sr':
|
||||
new_item.contentSerieName = scrapedtitle
|
||||
new_item.action = 'episodios'
|
||||
else:
|
||||
new_item.contentTitle = scrapedtitle
|
||||
new_item.action = 'findvideos'
|
||||
|
||||
# Paginacion
|
||||
patron_genero = '<h1>([^"]+)<\/h1>'
|
||||
genero = scrapertools.find_single_match(data, patron_genero)
|
||||
if genero == "Romance" or genero == "Drama":
|
||||
patron = "<a rel='nofollow' class=previouspostslink' href='([^']+)'>Siguiente "
|
||||
else:
|
||||
patron = "<span class='current'>.+?href='(.+?)'>"
|
||||
if scrapedtype == item.type or item.type == 'cat':
|
||||
itemlist.append(new_item)
|
||||
|
||||
next_page_url = scrapertools.find_single_match(data, patron)
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
|
||||
#pagination
|
||||
|
||||
url_next_page = item.url
|
||||
first = last
|
||||
|
||||
if next:
|
||||
itemlist.append(item.clone(title="Siguiente >>", url=url_next_page, action='lista', first=first))
|
||||
|
||||
if next_page_url != "":
|
||||
item.url = next_page_url
|
||||
itemlist.append(Item(channel=item.channel, action="lista", title=">> Página siguiente", url=next_page_url,
|
||||
thumbnail='https://s32.postimg.cc/4zppxf5j9/siguiente.png'))
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.info()
|
||||
|
||||
itemlist = []
|
||||
|
||||
if item.extra == 'pelicula':
|
||||
item = bitly(item)
|
||||
|
||||
dl_links = []
|
||||
data = httptools.downloadpage(item.url).data
|
||||
itemlist.extend(servertools.find_video_items(data=data))
|
||||
show = item.show
|
||||
for videoitem in itemlist:
|
||||
videoitem.channel = item.channel
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0 and item.contentType=="movie" and item.contentChannel!='videolibrary':
|
||||
itemlist.append(
|
||||
Item(channel=item.channel, title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]', url=item.url,
|
||||
action="add_pelicula_to_library", extra="findvideos", contentTitle=show))
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
|
||||
return itemlist
|
||||
### obtiene los gvideo
|
||||
patron = 'class="Button Sm fa fa-download mg"></a><a target="_blank" rel="nofollow" href="([^"]+)"'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
|
||||
for dl_url in matches:
|
||||
g_data = httptools.downloadpage(dl_url).data
|
||||
video_id = scrapertools.find_single_match(g_data, 'jfk-button jfk-button-action" href="([^"]+)">')
|
||||
g_url = '%s%s' % ('https://drive.google.com', video_id)
|
||||
g_url = g_url.replace('&', '&')
|
||||
g_data = httptools.downloadpage(g_url, follow_redirects=False, only_headers=True).headers
|
||||
url = g_data['location']
|
||||
dl_links.append(Item(channel=item.channel, title='%s', url=url, action='play', infoLabels=item.infoLabels))
|
||||
|
||||
if item.type == 'pl':
|
||||
new_url = scrapertools.find_single_match(data, '<div class="player">.*?<a href="([^"]+)" target')
|
||||
|
||||
data = httptools.downloadpage(new_url).data
|
||||
data = re.sub(r"\n|\r|\t|\s{2}| ", "", data)
|
||||
|
||||
patron = '<li class="btn.*?" data-video="([^"]+)">'
|
||||
matches = re.compile(patron, re.DOTALL).findall(data)
|
||||
for video_id in matches:
|
||||
url_data = httptools.downloadpage('https://tinyurl.com/%s' % video_id, follow_redirects=False)
|
||||
url = url_data.headers['location']
|
||||
itemlist.append(Item(channel=item.channel, title = '%s', url=url, action='play', infoLabels=item.infoLabels))
|
||||
|
||||
itemlist.extend(dl_links)
|
||||
|
||||
itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize())
|
||||
|
||||
return itemlist
|
||||
Reference in New Issue
Block a user