def get_video_url(page_url, premium=False, user="", password="", video_password=""): logger.info("url=" + page_url) data = httptools.downloadpage(page_url).data media_urls = scrapertools.find_multiple_matches(data, 'file\:"([^"]+\.mp4)",label:"([^"]+)"') if not media_urls: match = scrapertools.find_single_match(data, "<script type='text/javascript'>(.*?)</script>") data = jsunpack.unpack(match) media_urls = scrapertools.find_multiple_matches(data, '\[\{file\:"([^"]+)"') # Extrae la URL calidades = [] video_urls = [] for media_url in sorted(media_urls, key= lambda x:int(x[1][-3:])): calidades.append(int(media_url[1][-3:])) try: title = ".%s %sp [datoporn]" % (media_url[0].rsplit('.',1)[1], media_url[1][-3:]) except: title = ".%s %sp [datoporn]" % (media_url[-4:], media_url[1][-3:]) video_urls.append([title, media_url[0]]) sorted(calidades) m3u8 = scrapertools.find_single_match(data,'file\:"([^"]+\.m3u8)"') if m3u8: video_urls.insert(0, [".m3u8 %s [datoporn]" % calidades[-1], m3u8]) for video_url in video_urls: logger.info("%s - %s" % (video_url[0], video_url[1])) return video_urls
def ultimas(item): logger.info("pelisalacarta.channels.verseriesynovelas ultimas") itemlist = [] data = scrapertools.cachePage(item.url) data = data.replace("\n","").replace("\t","") bloque = scrapertools.find_single_match(data, '<ul class="list-paginacion">(.*?)</section>') patron = '<li><a href=(.*?)</li>' bloque2 = scrapertools.find_multiple_matches(bloque, patron) for match in bloque2: patron = '([^"]+)".*?<img class="fade" src="([^"]+)".*?<h2>(.*?)</h2>' matches = scrapertools.find_multiple_matches(match, patron) for scrapedurl, scrapedthumbnail, scrapedtitle in matches: scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle).replace(" online","") titleinfo = re.sub(r'(?i)((primera|segunda|tercera|cuarta|quinta|sexta) Temporada)', "Temporada", scrapedtitle) titleinfo = titleinfo.split('Temporada')[0] try: sinopsis, fanart, thumbnail = info(titleinfo) if thumbnail == "": thumbnail = scrapedthumbnail except: sinopsis = "" fanart = item.fanart thumbnail = scrapedthumbnail pass if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+thumbnail+"]") itemlist.append( Item(channel=__channel__, action='episodios', title= scrapedtitle , url=scrapedurl , thumbnail=thumbnail, fanart=fanart, fulltitle=titleinfo, plot=str(sinopsis), contentTitle=titleinfo, context="2", folder=True) ) #Paginación patron = '<a class="nextpostslink".*?href="([^"]+)">' match = scrapertools.find_single_match(data, patron) if len(match) > 0: itemlist.append( Item(channel=__channel__, action='ultimas', title= ">>Siguiente Página" , url=match , fanart=item.fanart, folder=True) ) return itemlist
def findvideos(item): logger.info("pelisalacarta.channels.streamsports play") itemlist = [] if item.match == "": item.match = "[COLOR darkorange]"+item.competicion+"[/COLOR]" data = scrapertools.cachePage(item.url) data = re.sub(r"\n|\r|\t|\s{2}| ","",data) bloque = scrapertools.find_single_match(data, '<h4 class="streamTypes" id="p2p">(.*?)</table>') if bloque != "": bloques = scrapertools.find_multiple_matches(bloque, '(<td>[^<]+<span style="font-size:10px">.*?</span></span></td>)') for match in bloques: patron = '<td>(.*?)<.*?<td>(.*?)<.*?<td>(.*?)<.*?<a href="([^"]+)"' matches = scrapertools.find_multiple_matches(match, patron) for bitrate, server, idioma, scrapedurl in matches: if not scrapedurl.startswith("acestream") and not scrapedurl.startswith("sop"): continue server = "[COLOR blue]"+server.strip()+"[/COLOR] " bitrate = " [COLOR green]("+bitrate.strip()+")[/COLOR]" idioma = " [COLOR gold]("+idioma.strip()+")[/COLOR]" scrapedtitle = server + item.match + bitrate + idioma scrapedurl= scrapedurl + "|" + item.match itemlist.append(Item(channel=__channel__, title=scrapedtitle, url=scrapedurl, action="play", idioma=idioma, thumbnail=item.thumbnail, fanart= item.fanart,folder=False)) itemlist.sort(key=lambda item: item.idioma, reverse=True) if "No Sopcast/Acestream streams added yet" in data or len(itemlist) == 0: itemlist.append(Item(channel=__channel__, title="[COLOR yellow]No hay enlaces disponibles. Inténtalo más tarde[/COLOR]", url="", action="", thumbnail=item.thumbnail,fanart= "http://s6.postimg.org/8wp93eaa9/streamsportsnolinks.jpg", folder=False)) return itemlist
def findvideos(item): logger.info("pelisalacarta.channels.boxingclub findvideos") itemlist = [] if item.extra == "": data = scrapertools.cachePage(item.url) data = re.sub(r"\n|\r|\t", '', data) matches = scrapertools.find_multiple_matches(data, '">(\w+)[^<]+<\/p><p style="text-align: center;">(.*?)(?:3px;|<p class="no-break">)') for server, enlaces in matches: try: server = server.replace("VIDTO","vidtome").replace("MOVHSARE","movshare").lower() if server != "download": servers_module = __import__("servers."+server) title = "[COLOR indianred]Enlaces en [/COLOR][COLOR darkorange]"+server.capitalize()+"[/COLOR]" else: title = "[COLOR indianred]Enlaces de [/COLOR][COLOR darkorange]Descarga[/COLOR]" itemlist.append(Item(channel=__channel__, title=title, url=item.url, action="findvideos", server=server, thumbnail=item.thumbnail, plot=item.plot, extra=enlaces, referer=item.url, folder=True)) except: pass else: matches = scrapertools.find_multiple_matches(item.extra, 'a href="([^"]+)".*?>([^<]+)<') for scrapedurl, scrapedtitle in matches: if "Descarga" in item.title: try: server = re.sub(r'(?i)uploaded','uploadedto', scrapedtitle) servers_module = __import__("servers."+server.lower()) scrapedtitle = "[COLOR indianred]Descarga en [/COLOR][COLOR darkorange]"+scrapedtitle+"[/COLOR]" itemlist.append(Item(channel=__channel__, title=scrapedtitle, url=scrapedurl, action="play", server=server.lower(), thumbnail=item.thumbnail, plot=item.plot, folder=False)) except: pass else: scrapedtitle = "[COLOR indianred]"+scrapedtitle+"[/COLOR] [COLOR darkorange]["+item.server+"][/COLOR]" if "Protect" in scrapedurl: scrapedurl = "http://prowrestlingreports.com/cgi-bin/%s" % scrapedurl itemlist.append(Item(channel=__channel__, title=scrapedtitle, url=scrapedurl, action="play", server=item.server, thumbnail=item.thumbnail, plot=item.plot, referer=item.referer, folder=False)) return itemlist
def busqueda(item): logger.info("pelisalacarta.channels.boxingclub busqueda") itemlist = [] data = scrapertools.cachePage(item.url) data = re.sub(r"\n|\r|\t", '', data) bloque_entradas = scrapertools.find_multiple_matches(data, '<div class=" search-result search-result-link(.*?)<\/div><\/div>') for bloque in bloque_entradas: if 'may-blank thumbnail default' in bloque: patron = '(may-blank thumbnail default).*?class="search-title may-blank" >(.*?)</a>.*?class="search-link may-blank" >(.*?)</a>' else: patron = 'src="([^"]+)".*?class="search-title may-blank" >(.*?)</a>.*?class="search-link may-blank" >(.*?)</a>' matches = scrapertools.find_multiple_matches(bloque, patron) for scrapedthumbnail, scrapedtitle, scrapedurl in matches: if scrapedthumbnail == "may-blank thumbnail default": scrapedthumbnail = item.thumbnail else: scrapedthumbnail = "http:" + scrapedthumbnail date = scrapertools.find_single_match(scrapedtitle, '([\d]+/[\d]+/[\d]+)') if date != "": month, day, year = scrapertools.find_single_match(date, '([\d]+)/([\d]+)/([\d]+)') scrapedtitle = scrapedtitle.replace(date, day+"/"+month+"/"+year) scrapedtitle = scrapedtitle.replace("[Boxing]","[Boxeo]") scrapedtitle = "[COLOR darkorange]"+scrapedtitle.split("]",1)[0]+"][/COLOR][COLOR red]"+scrapedtitle.split("]",1)[1]+"[/COLOR]" if "youtu.be" in scrapedurl: scrapedurl = scrapedurl.replace("youtu.be/","www.youtube.com/watch?v=") itemlist.append(Item(channel=__channel__, title=scrapedtitle, action="play", url=scrapedurl, thumbnail=scrapedthumbnail, folder=False)) next_page = scrapertools.find_single_match(data, '<a href="([^"]+)" rel="nofollow next"') if next_page != "": itemlist.append(Item(channel=__channel__, title=">> Siguiente", action="busqueda", url=next_page, thumbnail=item.thumbnail, folder=True)) return itemlist
def get_video_url(page_url, premium=False, user="", password="", video_password=""): logger.info("pelisalacarta.servers.dailymotion get_video_url(page_url='%s')" % page_url) video_urls = [] data, headers = scrapertools.read_body_and_headers(page_url, headers=DEFAULT_HEADERS) data = data.replace("\\", "") ''' "240":[{"type":"video/mp4","url":"http://www.dailymotion.com/cdn/H264-320x240/video/x33mvht.mp4?auth=1441130963-2562-u49z9kdc-84796332ccab3c7ce84e01c67a18b689"}] ''' for cookie in headers: if cookie[0] == "set-cookie": header_cookie = cookie[1] DEFAULT_HEADERS.append(['Cookie', header_cookie]) subtitle = scrapertools.find_single_match(data, '"subtitles":.*?"es":.*?urls":\["([^"]+)"') qualities = scrapertools.find_multiple_matches(data, '"([^"]+)":(\[\{"type":".*?\}\])') for calidad, urls in qualities: if calidad == "auto": continue patron = '"type":"(?:video|application)/([^"]+)","url":"([^"]+)"' matches = scrapertools.find_multiple_matches(urls, patron) for stream_type, stream_url in matches: stream_type = stream_type.replace('x-mpegURL', 'm3u8') if stream_type == "mp4": stream_url = scrapertools.get_header_from_response(stream_url, header_to_get="location", headers=DEFAULT_HEADERS) else: data_m3u8 = scrapertools.downloadpage(stream_url) stream_url = scrapertools.find_single_match(data_m3u8, '(http:.*?\.m3u8)') video_urls.append([calidad + "p ." + stream_type + " [dailymotion]", stream_url, 0, subtitle]) for video_url in video_urls: logger.info("pelisalacarta.servers.dailymotion %s - %s" % (video_url[0], video_url[1])) return video_urls
def novedades_pokeryour(item): logger.info("pelisalacarta.channels.boxingclub novedades_pokeryour") itemlist = [] ## Petición 1 url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u="+item.url data = scrapertools.decodeHtmlentities( scrapertools.downloadpage(url,follow_redirects=False) ) ## Petición 2 url = scrapertools.get_match(data, ' src="([^"]+)" name=c ') data = scrapertools.decodeHtmlentities( scrapertools.downloadpage(url,follow_redirects=False) ) ## Petición 3 url = scrapertools.get_match(data, 'URL=([^"]+)"') data = scrapertools.decodeHtmlentities( scrapertools.cachePage(url) ) data = re.sub(r"\n|\r|\t|</span> comentario de Rusia.</span>", '', data) bloque_entradas = scrapertools.find_multiple_matches(data, '<div class="item column(.*?)<div class=item-separator>') for bloque in bloque_entradas: patron = 'title="([^>]+)>.*?<a href=([^>]+)>.*?' \ '<img src=(/sport/media/com_hwdmediashare/files/[^\s]+).*?' \ '<dd class=media-info-description>.*?</span>(.*?)</span>' matches = scrapertools.find_multiple_matches(bloque, patron) for scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot in matches: scrapedthumbnail = host + scrapedthumbnail scrapedtitle = scrapedtitle.replace("vídeo de alta definición","HD").replace('::"','') scrapedtitle = re.sub(r'(?i)- tarjeta principal|tarjeta de|tarjeta|en línea de|el vídeo|el video|vídeo|video|en línea|en ruso|::','',scrapedtitle) if not "/" in scrapedtitle: scrapedtitle += "/" scrapedtitle = "[COLOR darkorange]"+scrapedtitle.split("/",1)[0]+"/[/COLOR][COLOR red]"+scrapedtitle.split("/",1)[1]+"[/COLOR]" scrapedurl = scrapedurl.replace("http://translate.googleusercontent.com/translate_c?depth=2&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=","") scrapedurl = urllib.unquote(scrapedurl) itemlist.append(Item(channel=__channel__, title=scrapedtitle, action="play", url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot, folder=True)) next_page = scrapertools.find_single_match(data, '<li class=pagination-next>.*?href=([^\s]+)') if next_page != "": itemlist.append(Item(channel=__channel__, title=">> Siguiente", action="novedades_pokeryour", url=next_page, thumbnail=item.thumbnail, folder=True)) return itemlist
def dict_indices(): indice_genero = {} indice_alfa = list(string.ascii_uppercase) indice_alfa.append("0-9") indice_idioma = {} indice_year = [] indice_calidad = {} data = scrapertools.cachePage("http://allpeliculas.co/Search/advancedSearch&ajax=1") data = data.replace("\n","").replace("\t", "") data = scrapertools.decodeHtmlentities(data) bloque_genero = scrapertools.find_single_match(data, '<select name="movieGenre".*?<option value="" selected(.*?)</select>') matches = scrapertools.find_multiple_matches(bloque_genero, '<option value="([^"]+)" >(.*?)</option>') for key1, key2 in matches: if key2 != "Series": if key2 == "Mystery": key2= "Misterio" indice_genero [key1] = key2 bloque_year = scrapertools.find_single_match(data, '<select name="movieYear".*?<option value="" selected(.*?)</select>') matches = scrapertools.find_multiple_matches(bloque_year, '<option value="([^"]+)"') for key1 in matches: indice_year.append(key1) bloque_idioma = scrapertools.find_single_match(data, '<select name="language".*?<option value="" selected(.*?)</select>') matches = scrapertools.find_multiple_matches(bloque_idioma, '<option value="([^"]+)" >(.*?)</option>') for key1, key2 in matches: if key2 == "INGLES": key2 = "Versión original" indice_idioma [key1] = key2.capitalize() bloque_calidad = scrapertools.find_single_match(data, '<select name="movieTypeId".*?<option value="" selected(.*?)</select>') matches = scrapertools.find_multiple_matches(bloque_calidad, '<option value="([^"]+)" >(.*?)</option>') for key1, key2 in matches: indice_calidad [key1] = key2 return indice_genero, indice_alfa, indice_idioma, indice_year, indice_calidad
def findvideos(item): logger.info("pelisalacarta.channels.verseriesynovelas findvideos") itemlist = [] if item.title.startswith("http"): item.url = item.title.split('%')[0] data = anti_cloudflare(item.url) data = data.replace("\n","").replace("\t","") patron = '<tr><td data-th="Idioma">(.*?)</div>' bloque = scrapertools.find_multiple_matches(data, patron) for match in bloque: patron = '.*?data-th="Calidad">(.*?)<.*?' patron += '"Servidor".*?src="http://www.google.com/s2/favicons\?domain=(.*?)\.' patron += '.*?<td data-th="Enlace"><a href="(http://www.verseriesynovelas.tv/enlaces.php.*?)"' matches = scrapertools.find_multiple_matches(match, patron) for quality, server, url in matches: if server == "streamin": server = "streaminto" if server== "waaw": server = "netutv" if server == "ul": server = "uploadedto" try: servers_module = __import__("servers."+server) title = "Enlace encontrado en "+server+" ["+quality+"]" if "Español.png" in match: title += " [COLOR sandybrown][CAST][/COLOR]" if "VOS.png" in match: title += " [COLOR green][VOSE][/COLOR]" if "Latino.png" in match: title += " [COLOR red][LAT][/COLOR]" if "VO.png" in match: title += " [COLOR blue][V.O][/COLOR]" itemlist.append( Item(channel=__channel__, action="play", title=title , url=url , fulltitle = item.fulltitle, thumbnail=item.thumbnail , fanart=item.fanart, plot=item.plot, folder=True) ) except: pass if len(itemlist) == 0: itemlist.append( Item(channel=__channel__, action="", title="No se ha encontrado ningún enlace" , url="" , thumbnail="", fanart=item.fanart, folder=False) ) else: if config.get_library_support() and item.category == "": itemlist.append( Item(channel=__channel__, title="[COLOR green]Añadir enlaces a la biblioteca[/COLOR]", url=item.url, action="add_pelicula_to_library", fulltitle=item.title.split(" [")[0], show=item.title)) return itemlist
def findvideos(item): logger.info() itemlist = [] data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}|-\s", "", data) if item.fulltitle == "Cosmos (Carl Sagan)": matches = scrapertools.find_multiple_matches(data, '<p><strong>(.*?)</strong><br /><iframe.+?src="(https://www\.youtube\.com/[^?]+)') for title, url in matches: new_item = item.clone(title=title, url=url) from core import servertools aux_itemlist = servertools.find_video_items(new_item) for videoitem in aux_itemlist: videoitem.title = new_item.title videoitem.fulltitle = new_item.title videoitem.channel = item.channel # videoitem.thumbnail = item.thumbnail itemlist.extend(aux_itemlist) else: data = scrapertools.find_multiple_matches(data, '<iframe.+?src="(https://www\.youtube\.com/[^?]+)') from core import servertools itemlist.extend(servertools.find_video_items(data=",".join(data))) for videoitem in itemlist: videoitem.fulltitle = item.fulltitle videoitem.channel = item.channel # videoitem.thumbnail = item.thumbnail return itemlist
def get_video_url(page_url, premium=False, user="", password="", video_password=""): logger.info("(page_url='%s')" % page_url) video_urls = [] response = httptools.downloadpage(page_url, cookies=False) cookie = {'Cookie': response.headers["set-cookie"]} data = response.data.replace("\\", "") ''' "240":[{"type":"video/mp4","url":"http://www.dailymotion.com/cdn/H264-320x240/video/x33mvht.mp4?auth=1441130963-2562-u49z9kdc-84796332ccab3c7ce84e01c67a18b689"}] ''' subtitle = scrapertools.find_single_match(data, '"subtitles":.*?"es":.*?urls":\["([^"]+)"') qualities = scrapertools.find_multiple_matches(data, '"([^"]+)":(\[\{"type":".*?\}\])') for calidad, urls in qualities: if calidad == "auto": continue patron = '"type":"(?:video|application)/([^"]+)","url":"([^"]+)"' matches = scrapertools.find_multiple_matches(urls, patron) for stream_type, stream_url in matches: stream_type = stream_type.replace('x-mpegURL', 'm3u8') if stream_type == "mp4": stream_url = httptools.downloadpage(stream_url, headers=cookie, only_headers=True, follow_redirects=False).headers.get("location", stream_url) else: data_m3u8 = httptools.downloadpage(stream_url).data stream_url = scrapertools.find_single_match(data_m3u8, '(http:.*?\.m3u8)') video_urls.append(["%sp .%s [dailymotion]" % (calidad, stream_type), stream_url, 0, subtitle]) for video_url in video_urls: logger.info("%s - %s" % (video_url[0], video_url[1])) return video_urls
def novedades(item): logger.info("pelisalacarta.channels.pelisdanko novedades") itemlist = [] # Descarga la pagina data = scrapertools.downloadpage(item.url) bloque = scrapertools.find_multiple_matches(data, '<div class="col-xs-[\d] col-sm-[\d] col-md-[\d] col-lg-[\d]' ' text-center"(.*?)</div>') for match in bloque: calidades = scrapertools.find_multiple_matches(match, '<span class="badge badge-critic badge-qualities[^>]+>' '([^<]+)</span>') calidad = "[COLOR darkseagreen] " for quality in calidades: calidad += "[" + quality + "]" patron = 'title="([^"]+)".*?href="([^"]+)".*?class="img-responsive img-thumbnail" src="([^"]+)"' matches = scrapertools.find_multiple_matches(match, patron) for scrapedtitle, scrapedurl, scrapedthumbnail in matches: contentTitle = scrapedtitle[:] scrapedtitle = "[COLOR darkorange][B]" + scrapedtitle + "[/B][/COLOR]" + calidad + "[/COLOR]" if (DEBUG): logger.info( "title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") itemlist.append(item.clone(action="enlaces", title=bbcode_kodi2html(scrapedtitle), url=scrapedurl, thumbnail=scrapedthumbnail, fanart=scrapedthumbnail, fulltitle=contentTitle, filtro=False, contentTitle=contentTitle, context=["buscar_trailer"], contentType="movie", trailer=True)) # Busca enlaces de paginas siguientes... next_page_url = scrapertools.find_single_match(data, '<a href="([^"]+)" rel="next">') if len(next_page_url) > 0: itemlist.append(item.clone(action="novedades", title=">> Página siguiente", url=next_page_url)) return itemlist
def series(item): logger.info("pelisalacarta.channels.cinefox series") itemlist = [] if "valores" in item: itemlist.append(item.clone(action="", title=item.valores, text_color=color4)) data = scrapertools.downloadpage(item.url) bloque = scrapertools.find_multiple_matches(data, ' <div class="media-card "(.*?)<div class="info-availability ' 'one-line">') for match in bloque: patron = '<div class="audio-info">.*?<img class.*?src="([^"]+)".*?href="([^"]+)">([^<]+)</a>' matches = scrapertools.find_multiple_matches(match, patron) for scrapedthumbnail, scrapedurl, scrapedtitle in matches: url = urlparse.urljoin(host, scrapedurl + "/episodios") itemlist.append(Item(channel=item.channel, action="episodios", title=scrapedtitle, url=url, thumbnail=scrapedthumbnail, contentTitle=scrapedtitle, fulltitle=scrapedtitle, show=scrapedtitle, text_color=color2, context="25")) try: from core import tmdb tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__) except: pass next_page = scrapertools.find_single_match(data, 'href="([^"]+)"[^>]+>Siguiente') if next_page != "": itemlist.append(Item(channel=item.channel, action="series", title=">> Siguiente", url=next_page, thumbnail=item.thumbnail, text_color=color3)) return itemlist
def novedades(item): logger.info("tvalacarta.channels.discoverymax novedades") itemlist = [] data = scrapertools.cache_page(item.url).replace("\n","") listcat = scrapertools.find_multiple_matches(data, '<a href="#".*?data="([^"]+)".*?<p>([^<]+)</p>') dict = {} for key, value in listcat: dict[key] = value patron = '<div\s+data="([^"]+)"(.*?)<div class="dni-video-playlist-page-controls-bottom">' bloque = scrapertools.find_multiple_matches(data, patron) for title, content in bloque: titulo = "[COLOR yellow] ****"+dict[title]+"****[/COLOR]" patron = '<div class="dni-video-playlist-thumb-box.*?<a href="([^"]+)".*?' patron += '<img src="([^"]+)".*?<h3 data-content=.*?>([^<]+)<.*?' patron += '<p class="desc".*?>([^<]+)<' matches = scrapertools.find_multiple_matches(content, patron) extra = len(matches)+1 if "kodi" in config.get_platform(): action = "move" else: action = "" itemlist.append( Item(channel=CHANNELNAME, title=titulo, action=action, url="", thumbnail=item.thumbnail, fanart=item.fanart, extra=str(extra),folder=False) ) for scrapedurl, scrapedthumbnail, scrapedtitle, scrapedplot in matches: scrapedurl = item.url + scrapedurl itemlist.append( Item(channel=CHANNELNAME, title=scrapedtitle, action="play", url=scrapedurl, thumbnail=scrapedthumbnail, plot=scrapedplot, fanart=scrapedthumbnail, viewmode="list", folder=False) ) return itemlist
def get_video_url( page_url , premium = False , user="" , password="", video_password="" ): logger.info("pelisalacarta.servers.clicknupload url="+page_url) data = scrapertools.cache_page( page_url ) data = data.replace("\n","").replace("\t","") post = "" block = scrapertools.find_single_match(data, '<Form method="POST"(.*?)</Form>') matches = scrapertools.find_multiple_matches(block, 'input.*?name="([^"]+)".*?value="([^"]*)"') for inputname, inputvalue in matches: post += inputname + "=" + inputvalue + "&" #Primera solicitud post data = scrapertools.cache_page( page_url , post=post) data = data.replace("\n","").replace("\t","") import time time.sleep(5) post = "" block = scrapertools.find_single_match(data, '<Form name="F1" method="POST"(.*?)</Form>') matches = scrapertools.find_multiple_matches(block, '<input.*?name="([^"]+)".*?value="([^"]*)">') for inputname, inputvalue in matches: post += inputname + "=" + inputvalue + "&" #Segunda solicitud post tras 5 segundos de espera data = scrapertools.cache_page( page_url , post=post) video_urls = [] media = scrapertools.find_single_match(data,"onClick=\"window.open\('([^']+)'") #Solo es necesario codificar la ultima parte de la url url_strip = urllib.quote(media.rsplit('/', 1)[1]) media_url = media.rsplit('/', 1)[0] +"/"+url_strip video_urls.append( [ scrapertools.get_filename_from_url(media_url)[-4:]+" [clicknupload]",media_url]) for video_url in video_urls: logger.info("pelisalacarta.servers.clicknupload %s - %s" % (video_url[0],video_url[1])) return video_urls
def resumenes(item): logger.info("pelisalacarta.channels.9score resumenes") itemlist = [] data = scrapertools.cachePage(item.url) data = re.sub(r"\n|\r|\t", '', data) bloque = scrapertools.find_multiple_matches(data, '<div class="leaguelogo column">(.*?)</li>') for match in bloque: patron = 'alt="([^"]+)".*?shortdate">(.*?)<.*?alt="([^"]+)" src="([^"]+)"' \ '.*?alt="([^"]+)" src="([^"]+)".*?play_btn column"><a href="([^"]+)"' matches = scrapertools.find_multiple_matches(match, patron) for liga, fecha, team1, team1image, team2, team2image, scrapedurl in matches: scrapedthumbnail = host+team1image.replace('small/','big/').replace('.jpg','.png') if "no_image" in scrapedthumbnail: scrapedthumbnail = host+team2image.replace('small/','big/').replace('.jpg','.png') if "no_image" in scrapedthumbnail: scrapedthumbnail = item.thumbnail scrapedurl = host+scrapedurl fulltitle = "[COLOR darkorange]"+team1+" vs "+team2+"[/COLOR]" fecha = "[COLOR red]["+fecha+"][/COLOR] " scrapedtitle = fecha + fulltitle + " [COLOR blue]("+liga+")[/COLOR]" itemlist.append(Item(channel=__channel__, title=scrapedtitle, url=scrapedurl, action="findvideos", thumbnail=scrapedthumbnail, fanart=item.fanart, fulltitle=fulltitle, folder=True)) next_page = scrapertools.find_single_match(data, '<span class=\'current\'>[^<]+</span><a href="([^"]+)"') if len(next_page) > 0: itemlist.append(Item(channel=__channel__, title=">> Siguiente", url=host+next_page, action="resumenes", thumbnail=item.thumbnail, fanart=item.fanart, folder=True)) return itemlist
def busqueda(item, texto=""): logger.info() itemlist = [] item.text_color = color2 data = httptools.downloadpage(item.url).data data = data.replace("\n", "").replace("\t", "") bloque = scrapertools.find_single_match(data, '<ul class="list-paginacion">(.*?)</section>') bloque = scrapertools.find_multiple_matches(bloque, '<li><a href=(.*?)</li>') for match in bloque: patron = '([^"]+)".*?<img class="fade" src="([^"]+)".*?<h2>(.*?)</h2>' matches = scrapertools.find_multiple_matches(match, patron) for scrapedurl, scrapedthumbnail, scrapedtitle in matches: # fix para el buscador para que no muestre entradas con texto que no es correcto if unicode(texto, "utf8").lower().encode("utf8") not in \ unicode(scrapedtitle, "utf8").lower().encode("utf8"): continue scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle).replace(" online", "") titleinfo = re.sub(r'(?i)((primera|segunda|tercera|cuarta|quinta|sexta) temporada)', "Temporada", scrapedtitle) titleinfo = titleinfo.split("Temporada")[0].strip() titleinfo = re.sub(r'(\(\d{4}\))|(\(\d{4}\s*-\s*\d{4}\))', '', titleinfo) itemlist.append(item.clone(action="episodios", title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, fulltitle=scrapedtitle, show=titleinfo, contentType="tvshow", contentTitle=titleinfo)) # Paginación next_page = scrapertools.find_single_match(data, '<a class="nextpostslink".*?href="([^"]+)">') if next_page != "": itemlist.append(item.clone(title=">> Siguiente", url=next_page)) return itemlist
def busqueda(item, texto=""): logger.info("pelisalacarta.channels.verseriesynovelas busqueda") itemlist = [] item.text_color = color2 data = scrapertools.downloadpage(item.url, headers=CHANNEL_HEADERS) data = data.replace("\n", "").replace("\t", "") bloque = scrapertools.find_single_match(data, '<ul class="list-paginacion">(.*?)</section>') bloque = scrapertools.find_multiple_matches(bloque, '<li><a href=(.*?)</li>') for match in bloque: patron = '([^"]+)".*?<img class="fade" src="([^"]+)".*?<h2>(.*?)</h2>' matches = scrapertools.find_multiple_matches(match, patron) for scrapedurl, scrapedthumbnail, scrapedtitle in matches: # fix para el buscador para que no muestre entradas con texto que no es correcto if texto.lower() not in scrapedtitle.lower(): continue scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle).replace(" online", "") if DEBUG: logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") itemlist.append(item.clone(action="episodios", title=scrapedtitle, url=scrapedurl, thumbnail=scrapedthumbnail, fulltitle=scrapedtitle)) # Paginación next_page = scrapertools.find_single_match(data, '<a class="nextpostslink".*?href="([^"]+)">') if next_page != "": itemlist.append(item.clone(title=">> Siguiente", url=next_page)) return itemlist
def entradas(item): logger.info("pelisalacarta.channels.grabaciones_deportivas entradas") itemlist = [] data = scrapertools.cachePage(item.url) data = scrapertools.decodeHtmlentities(data) title = item.title.replace("+++ ","") ymd = scrapertools.find_single_match(data, '<div id="vafs".*?value="([^"]+)"') cat = scrapertools.find_single_match(data, '<label for="s([^"]+)">(?:<b>|)'+title+'(?:</b>|)</label>') item.extra = cat item.url = item.url + ymd itemlist = partidos(item) if itemlist[0].action== "": return itemlist if not "Primer día con vídeos disponibles" in itemlist[0].title: itemlist.insert(0, Item(channel=__channel__, title="--Hoy--", url="", action="", thumbnail=item.thumbnail, folder=False)) itemlist.append(Item(channel=__channel__, title=bbcode_kodi2html(" [COLOR red]***Elegir Fecha***[/COLOR]"), url="", action="", thumbnail=item.thumbnail, folder=False)) matches = scrapertools.find_multiple_matches(data, '<a class="small"href="([^"]+)".*?<b>(.*?)</b>') length = len(itemlist) for scrapedurl, scrapedtitle in matches: if scrapedtitle == "Hoy": continue scrapedurl = host_live + scrapedurl itemlist.insert(length, Item(channel=__channel__, title=scrapedtitle, url=scrapedurl, action="partidos", extra=cat, thumbnail=item.thumbnail, folder=True)) calendar = scrapertools.cachePage("http://livetv.sx/ajax/vacal.php?cal&lng=es") matches = scrapertools.find_multiple_matches(calendar, "load\('([^']+)'\).*?<b>(.*?)</b>") for scrapedurl, scrapedtitle in matches: scrapedurl = host_live + scrapedurl itemlist.append(Item(channel=__channel__, title=scrapedtitle, url=scrapedurl, action="calendario", extra=cat, thumbnail=item.thumbnail, folder=True)) return itemlist
def series(item): logger.info() itemlist = [] if "valores" in item: itemlist.append(item.clone(action="", title=item.valores, text_color=color4)) data = httptools.downloadpage(item.url).data bloque = scrapertools.find_multiple_matches(data, '<div class="media-card "(.*?)<div class="hidden-info">') for match in bloque: patron = '<img class.*?src="([^"]+)".*?href="([^"]+)">([^<]+)</a>' matches = scrapertools.find_multiple_matches(match, patron) for scrapedthumbnail, scrapedurl, scrapedtitle in matches: url = urlparse.urljoin(host, scrapedurl + "/episodios") itemlist.append(Item(channel=item.channel, action="episodios", title=scrapedtitle, url=url, thumbnail=scrapedthumbnail, contentTitle=scrapedtitle, fulltitle=scrapedtitle, show=scrapedtitle, text_color=color2, contentType="tvshow")) try: from core import tmdb tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__) except: pass next_page = scrapertools.find_single_match(data, 'href="([^"]+)"[^>]+>Siguiente') if next_page != "": title = ">> Siguiente - Página " + scrapertools.find_single_match(next_page, 'page=(\d+)') itemlist.append(Item(channel=item.channel, action="series", title=title, url=next_page, thumbnail=item.thumbnail, extra=item.extra, text_color=color3)) return itemlist
def jjdecode(t): x = '0123456789abcdef' j = scrapertools.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 = scrapertools.find_multiple_matches(t, '(j\.[^\+]+\+)') for c in p: t = t.replace(c, c.replace('_', '0').replace('$', '1')) p = scrapertools.find_multiple_matches(t, 'j\.(\d{4})') for c in p: t = re.sub(r'j\.%s' % c, '"' + x[int(c, 2)] + '"', t) p = scrapertools.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 = scrapertools.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 = scrapertools.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
def scraper(item): logger.info("pelisalacarta.torrentlocura scraper") itemlist = [] # Descarga la página data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}| ","",data) bloque_enlaces =scrapertools.find_single_match(data, '<ul class="pelilist">(.*?)end .page-box') if item.contentType !="movie": matches = scrapertools.find_multiple_matches(bloque_enlaces,'<a href="([^"]+)".*?src="([^"]+)".*?28px;">([^<]+)<\/h2><span>([^<]+)<\/span>') else: matches = scrapertools.find_multiple_matches(bloque_enlaces,'<a href="([^"]+)".*?src="([^"]+)".*?Descargar ([^<]+) gratis">.*?<\/h2><span>([^<]+)<\/span>') for url,thumb,title,quality in matches: try: year=scrapertools.find_single_match(title,'(\d\d\d\d)') except: year ="" title= unicode(title, "latin1").encode("utf8") if "�" in title: title=title.replace("�","ñ") title= re.sub(r'\(\d+\)|\d\d\d\d','',title) title_fan=title title_item="[COLOR red][B]"+title+"[/B][/COLOR]" if "HD" in item.title and item.contentType!="movie": title = "[COLOR red][B]"+title+"[/B][/COLOR]" else: title = "[COLOR red][B]"+title+"[/B][/COLOR]"+"[COLOR floralwhite] "+quality+"[/COLOR]" itemlist.append( Item(channel=item.channel, title =title , url=url, action="fanart", thumbnail=thumb, fanart=item.fanart,extra=title_fan+"|"+title_item+"|"+year, contentType=item.contentType , folder=True) ) ## Paginación next=scrapertools.find_single_match(data,'href="([^"]+)">Next<\/a>') if len(next)>0: url =next itemlist.append( Item(channel=item.channel, action="scraper", title="[COLOR darkred][B]siguiente[/B][/COLOR]" , url=url , thumbnail="http://imgur.com/D4ZgFri.png", fanart=item.fanart,extra=item.extra,contentType=item.contentType, folder=True) ) return itemlist
def eroticas(item): logger.info() itemlist = [] # Descarga la página data = httptools.downloadpage(item.url).data # Extrae las entradas entradas = scrapertools.find_multiple_matches(data, '<div class="col-mt-5 postsh">(.*?)</div></div></div>') patron = '<div class="poster-media-card([^"]+)">.*?<a href="([^"]+)" title="([^"]+)">' \ '.*?<div class="idiomes"><div class="(.*?)">.*?' \ '<img.*?src="([^"]+)"' for match in entradas: matches = scrapertools.find_multiple_matches(match, patron) for calidad, url, scrapedtitle, idioma, scrapedthumbnail in matches: title = scrapedtitle + " [" + idioma + "] [" + calidad + "]" thumbnail = scrapedthumbnail.replace("w185", "original") itemlist.append(item.clone(action="findvideos", title=title, url=url, thumbnail=thumbnail, extra="eroticas")) # Extrae la marca de la siguiente página next_page = scrapertools.find_single_match(data, '<span class="current">.*?<\/span><a href="([^"]+)"') if next_page: itemlist.append(item.clone(action="entradas", title="Siguiente", url=next_page)) return itemlist
def findvideostv(item): logger.info("pelisalacarta.channels.allpeliculas findvideostv") itemlist = [] #Rellena diccionarios idioma y calidad idiomas_videos, calidad_videos = dict_videos() data = scrapertools.downloadpage(item.url) data = data.replace("\n", "").replace("\t", "") data = scrapertools.decodeHtmlentities(data) patron = '<span class="movie-online-list" id_movies_types="([^"]+)" id_movies_servers="([^"]+)".*?episode=' \ '"([^"]+)" season="' + \ item.infoLabels['season'] + '" id_lang="([^"]+)".*?online-link="([^"]+)"' matches = scrapertools.find_multiple_matches(data, patron) for quality, servidor_num, episode, language, url in matches: try: server = SERVERS[servidor_num] servers_module = __import__("servers."+server) except: server = servertools.get_server_from_url(url) if server != "directo": idioma = IDIOMAS.get(idiomas_videos.get(language)) titulo = "Episodio "+episode+" [" titulo += server.capitalize()+"] ["+idioma+"] ("+calidad_videos.get(quality)+")" item.infoLabels['episode'] = episode itemlist.append(item.clone(action="play", title=titulo, url=url)) #Enlace Descarga patron = '<span class="movie-downloadlink-list" id_movies_types="([^"]+)" id_movies_servers="([^"]+)".*?episode=' \ '"([^"]+)" season="'+item.infoLabels['season'] + '" id_lang="([^"]+)".*?online-link="([^"]+)"' matches = scrapertools.find_multiple_matches(data, patron) for quality, servidor_num, episode, language, url in matches: mostrar_server = True try: server = SERVERS[servidor_num] servers_module = __import__("servers."+server) except: server = servertools.get_server_from_url(url) if server != "directo": if config.get_setting("hidepremium") == "true": mostrar_server = servertools.is_server_enabled(server) if mostrar_server: idioma = IDIOMAS.get(idiomas_videos.get(language)) titulo = "Episodio "+episode+" " titulo += server.capitalize()+" ["+idioma+"] ("+calidad_videos.get(quality)+")" item.infoLabels['episode'] = episode itemlist.append(item.clone(action="play", title=titulo, url=url)) itemlist.sort(key=lambda item: (int(item.infoLabels['episode']), item.title)) try: from core import tmdb tmdb.set_infoLabels(itemlist, __modo_grafico__) except: pass return itemlist
def ultimos(item): logger.info("pelisalacarta.channels.cinefox ultimos") item.text_color = color2 itemlist = [] data = scrapertools.downloadpage(item.url) bloque = scrapertools.find_multiple_matches(data, ' <div class="media-card "(.*?)<div class="info-availability ' 'one-line">') for match in bloque: patron = '<div class="audio-info">(.*?)<img class.*?src="([^"]+)".*?href="([^"]+)">([^<]+)</a>' matches = scrapertools.find_multiple_matches(match, patron) for idiomas, scrapedthumbnail, scrapedurl, scrapedtitle in matches: show = re.sub(r'(\s*[\d]+x[\d]+\s*)', '', scrapedtitle) audios = [] if "medium-es" in idiomas: audios.append('CAST') if "medium-vs" in idiomas: audios.append('VOSE') if "medium-la" in idiomas: audios.append('LAT') if "medium-en" in idiomas: audios.append('V.O') title = show + " - " + re.sub(show, '', scrapedtitle) + " [" + "/".join(audios) + "]" url = urlparse.urljoin(host, scrapedurl) itemlist.append(item.clone(action="menu_info_episode", title=title, url=url, thumbnail=scrapedthumbnail, contentTitle=show, fulltitle=show, show=show, context="25")) try: from core import tmdb tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__) except: pass next_page = scrapertools.find_single_match(data, 'href="([^"]+)"[^>]+>Siguiente') if next_page != "": itemlist.append(item.clone(action="ultimos", title=">> Siguiente", url=next_page, text_color=color3)) return itemlist
def find_videos(data): encontrados = set() devuelve = [] # divxstage http://www.divxstage.net/video/of7ww1tdv62gf" patronvideos = 'divxstage[^/]+/video/(\w+)$' logger.info("#" + patronvideos + "#") matches = scrapertools.find_multiple_matches(data, patronvideos) for match in matches: titulo = "[Divxstage]" url = host + "/embed/?v=" + match if url not in encontrados: logger.info("url=" + url) devuelve.append([titulo, url, 'divxstage']) encontrados.add(url) else: logger.info("url duplicada=" + url) # divxstage http://www.cloudtime.to/video/of7ww1tdv62gf" patronvideos = 'cloudtime[^/]+/(?:video/|embed/\?v=)([A-z0-9]+)' logger.info("#" + patronvideos + "#") matches = scrapertools.find_multiple_matches(data, patronvideos) for match in matches: titulo = "[Cloudtime]" url = host + "/embed/?v=" + match if url not in encontrados: logger.info("url=" + url) devuelve.append([titulo, url, 'divxstage']) encontrados.add(url) else: logger.info("url duplicada=" + url) return devuelve
def get_video_url( page_url , premium = False , user="" , password="", video_password="" ): logger.info("streamondemand.servers.vidgg get_video_url(page_url='%s')" % page_url) video_urls = [] data = scrapertools.cache_page(page_url) mediaurls = scrapertools.find_multiple_matches(data, '<source src="([^"]+)"') if not mediaurls: id_file = page_url.rsplit("/",1)[1] key = scrapertools.find_single_match(data, 'flashvars\.filekey\s*=\s*"([^"]+)"') if not key: varkey = scrapertools.find_single_match(data, 'flashvars\.filekey\s*=\s*([^;]+);') key = scrapertools.find_single_match(data, varkey+'\s*=\s*"([^"]+)"') # Primera url, se extrae una url erronea necesaria para sacar el enlace url = "http://www.vidgg.to//api/player.api.php?cid2=undefined&cid=undefined&numOfErrors=0&user=undefined&cid3=undefined&key=%s&file=%s&pass=undefined" % (key, id_file) data = scrapertools.cache_page(url) url_error = scrapertools.find_single_match(data, 'url=([^&]+)&') url = "http://www.vidgg.to//api/player.api.php?cid2=undefined&cid=undefined&numOfErrors=1&errorUrl=%s&errorCode=404&user=undefined&cid3=undefined&key=%s&file=%s&pass=undefined" % (url_error, key, id_file) data = scrapertools.cache_page(url) mediaurls = scrapertools.find_multiple_matches(data, 'url=([^&]+)&') for i, mediaurl in enumerate(mediaurls): title = scrapertools.get_filename_from_url(mediaurl)[-4:]+" Mirror %s [vidgg]" % str(i+1) video_urls.append( [title, mediaurl]) for video_url in video_urls: logger.info("[vidgg.py] %s - %s" % (video_url[0],video_url[1])) return video_urls
def tags(item): logger.info() itemlist = [] data = httptools.downloadpage(item.url).data if item.title == "Tags": letras = [] matches = scrapertools.find_multiple_matches(data, '<strong class="title".*?>\s*(.*?)</strong>') for title in matches: title = title.strip() if title not in letras: letras.append(title) itemlist.append(Item(channel=item.channel, action="tags", url=item.url, title=title, extra=title)) else: if not item.length: item.length = 0 bloque = scrapertools.find_single_match(data, '>%s</strong>(.*?)(?:(?!%s)(?!#)[A-Z#]{1}</strong>|<div class="footer-margin">)' % (item.extra, item.extra)) matches = scrapertools.find_multiple_matches(bloque, '<a href="([^"]+)">\s*(.*?)</a>') for url, title in matches[item.length:item.length+100]: itemlist.append(Item(channel=item.channel, action="lista", url=url, title=title)) if len(itemlist) >= 100: itemlist.append(Item(channel=item.channel, action="tags", url=item.url, title=">> Página siguiente", length=item.length+100, extra=item.extra)) return itemlist
def scraper(item): logger.info("pelisalacarta.borrachodetorrent scraper") itemlist=[] data = httptools.downloadpage(item.url).data data = re.sub(r"\n|\r|\t|\s{2}| ","",data) if item.contentType=="movie": patron =scrapertools.find_multiple_matches(data, '<a id="busca_a" class="busca_a" href="([^"]+)">.*?<img src="([^"]+)".*?</b></b>([^"]+)</span>.*?<span class="tt">([^"]+)</span>.*?<span class="year_SKA">([^"]+)</span>.*?<span class="calidad2">([^"]+)</span>') for url,thumb,rating,title,year,calidad in patron: titulo = "[COLOR teal]"+title+"[/COLOR]"+ " " + "[COLOR floralwhite]"+calidad+"[/COLOR]" + " "+ "[COLOR cyan]"+rating+"[/COLOR]" title= re.sub(r"!|¡","",title) title= re.sub(r"’|PRE-Estreno","'",title) new_item= item.clone(action="findvideos", title=titulo, url=url, thumbnail=thumb,fulltitle=title,contentTitle=title, contentType="movie",extra=year,library=True) new_item.infoLabels['year'] = year new_item.infoLabels['rating'] = rating itemlist.append(new_item) else: data= re.sub(r'×','x',data) patron =scrapertools.find_multiple_matches(data, 'id="busca_a" class="busca_a" href="([^"]+)">.*?<img src="([^"]+)".*?<span class="tt">([^"]+)</span>.*?<span class="calidad2">([^"]+)</span>') for url,thumb,title,calidad in patron: titulo = "[COLOR teal]"+title+"[/COLOR]"+ " " + "[COLOR floralwhite]"+calidad+"[/COLOR]" title =re.sub(r'\d+x\d+','',title) title= re.sub(r"’","'",title) filtro_thumb = thumb.replace("https://image.tmdb.org/t/p/w300", "") filtro_list = {"poster_path": filtro_thumb} filtro_list = filtro_list.items() new_item = item.clone(action="findvideos", title=titulo, url=url, thumbnail=thumb, fulltitle=title, infoLabels={'filtro': filtro_list}, contentTitle=title,show=title,contentType="tvshow",library=True) itemlist.append(new_item) ## Paginación next=scrapertools.find_single_match(data,"<div class='paginado'>.*?<a class='current'>.*?href='([^']+)'") if len(next)>0: url =next itemlist.append(item.clone( title="[COLOR dodgerblue][B]Siguiente >>[/B][/COLOR]", url=url)) try: from core import tmdb tmdb.set_infoLabels_itemlist(itemlist, __modo_grafico__) except: pass for item_tmdb in itemlist: logger.info(str(item_tmdb.infoLabels['tmdb_id'])) return itemlist
def peliculas(item): logger.info() itemlist = [] if "valores" in item and item.valores: itemlist.append(item.clone(action="", title=item.valores, text_color=color4)) if __menu_info__: action = "menu_info" else: action = "findvideos" data = httptools.downloadpage(item.url).data bloque = scrapertools.find_multiple_matches(data, '<div class="media-card "(.*?)<div class="hidden-info">') for match in bloque: if item.extra == "mapa": patron = '.*?src="([^"]+)".*?href="([^"]+)">([^<]+)</a>' matches = scrapertools.find_multiple_matches(match, patron) for scrapedthumbnail, scrapedurl, scrapedtitle in matches: url = urlparse.urljoin(host, scrapedurl) itemlist.append(Item(channel=item.channel, action=action, title=scrapedtitle, url=url, extra="media", thumbnail=scrapedthumbnail, contentTitle=scrapedtitle, fulltitle=scrapedtitle, text_color=color2, contentType="movie")) else: patron = '<div class="audio-info">(.*?)</div>(.*?)' \ 'src="([^"]+)".*?href="([^"]+)">([^<]+)</a>' matches = scrapertools.find_multiple_matches(match, patron) for idiomas, calidad, scrapedthumbnail, scrapedurl, scrapedtitle in matches: calidad = scrapertools.find_single_match(calidad, '<div class="quality-info".*?>([^<]+)</div>') if calidad: calidad = calidad.capitalize().replace("Hd", "HD") audios = [] if "medium-es" in idiomas: audios.append('CAST') if "medium-vs" in idiomas: audios.append('VOSE') if "medium-la" in idiomas: audios.append('LAT') if "medium-en" in idiomas or 'medium-"' in idiomas: audios.append('V.O') title = "%s [%s]" % (scrapedtitle, "/".join(audios)) if calidad: title += " (%s)" % calidad url = urlparse.urljoin(host, scrapedurl) itemlist.append(Item(channel=item.channel, action=action, title=title, url=url, extra="media", thumbnail=scrapedthumbnail, contentTitle=scrapedtitle, fulltitle=scrapedtitle, text_color=color2, contentType="movie")) next_page = scrapertools.find_single_match(data, 'href="([^"]+)"[^>]+>Siguiente') if next_page != "" and item.title != "": itemlist.append(Item(channel=item.channel, action="peliculas", title=">> Siguiente", url=next_page, thumbnail=item.thumbnail, extra=item.extra, text_color=color3)) if not config.get_setting("last_page", item.channel) and config.is_xbmc(): itemlist.append(Item(channel=item.channel, action="select_page", title="Ir a página...", url=next_page, thumbnail=item.thumbnail, text_color=color5)) return itemlist
def findvideos(item): logger.info() itemlist = [] data = httptools.downloadpage(item.url).data data = re.sub(r"<!--.*?-->", "", data) data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) bloque_tab = scrapertools.find_single_match( data, '<div id="verpelicula">(.*?)<div class="tab_container">') patron = '<li><a href="#([^<]+)"><span class="re">\d<\/span><span class="([^<]+)"><\/span><span class=.*?>([^<]+)<\/span>' check = re.compile(patron, re.DOTALL).findall(bloque_tab) servers_data_list = [] patron = '<div id="(tab\d+)" class="tab_content"><script type="text/rocketscript">(\w+)\("([^"]+)"\)</script></div>' matches = re.compile(patron, re.DOTALL).findall(data) if len(matches) == 0: patron = '<div id="(tab\d+)" class="tab_content"><script>(\w+)\("([^"]+)"\)</script></div>' matches = re.compile(patron, re.DOTALL).findall(data) for check_tab, server, id in matches: if check_tab in str(check): idioma, calidad = scrapertools.find_single_match( str(check), "" + check_tab + "', '(.*?)', '(.*?)'") servers_data_list.append([server, id, idioma, calidad]) url = host + "/Js/videod.js" data = httptools.downloadpage(url).data data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) data = data.replace( '<iframe width="100%" height="400" scrolling="no" frameborder="0"', '') patron = 'function (\w+)\(id\).*?' patron += 'data-src="([^"]+)"' matches = scrapertools.find_multiple_matches(data, patron) for server, url in matches: for enlace, id, idioma, calidad in servers_data_list: if server == enlace: video_url = re.sub(r"embed\-|\-.*?x.*?\.html|u\'|\'\(", "", str(url)) video_url = re.sub(r"'\+codigo\+'", "", video_url) video_url = video_url.replace('embed//', 'embed/') video_url = video_url + id if "goo.gl" in video_url: try: from unshortenit import unshorten url = unshorten(video_url) video_url = scrapertools.get_match( str(url), "u'([^']+)'") except: continue title = "Ver en: %s [" + idioma + "][" + calidad + "]" itemlist.append( item.clone(title=title, url=video_url, action="play", thumbnail=item.category, language=idioma, quality=calidad)) tmdb.set_infoLabels(itemlist) itemlist = servertools.get_servers_itemlist( itemlist, lambda i: i.title % i.server.capitalize()) if __comprueba_enlaces__: itemlist = servertools.check_list_links(itemlist, __comprueba_enlaces_num__) if item.library and config.get_videolibrary_support( ) and len(itemlist) > 0: infoLabels = { 'tmdb_id': item.infoLabels['tmdb_id'], 'title': item.fulltitle } itemlist.append( Item(channel=item.channel, title="Añadir esta película a la videoteca", action="add_pelicula_to_library", url=item.url, infoLabels=infoLabels, text_color="0xFFff6666", thumbnail='http://imgur.com/0gyYvuC.png')) return itemlist
def peliculas(item): logger.info() itemlist = [] data = do_downloadpage(item.url) # ~ logger.debug(data) patron = '<article id="[^"]*" class="item movies">(.*?)</article>' matches = scrapertools.find_multiple_matches(data, patron) for article in matches: thumb, title = scrapertools.find_single_match( article, ' src="([^"]+)" alt="([^"]+)') url = scrapertools.find_single_match(article, ' href="([^"]+)') year = scrapertools.find_single_match(article, ' href="/ano/(\d{4})/') plot = scrapertools.find_single_match( article, '<div class="texto">(.*?)</div>') langs = [] if 'class="espanol"' in article: langs.append('Esp') if 'class="latino"' in article: langs.append('Lat') if 'class="subtitulado"' in article: langs.append('VOSE') quality = scrapertools.find_single_match(article, '/beta/([^\.]+)\.png') if 'calidad' in quality: # ej: calidad-hd.png, nueva-calidad.png quality = quality.replace('-', ' ').replace('calidad', '').strip().capitalize() else: quality = '' # ej: estreno-sub.png, estreno.png show, showalt = extraer_show_showalt(title) itemlist.append( item.clone(action='findvideos', url=url, title=title, thumbnail=thumb, languages=', '.join(langs), qualities=quality, contentType='movie', contentTitle=show, contentTitleAlt=showalt, infoLabels={ 'year': year, 'plot': plot })) tmdb.set_infoLabels(itemlist) next_page_link = scrapertools.find_single_match( data, '<link rel="next" href="([^"]+)') if next_page_link == '': next_page_link = scrapertools.find_single_match( data, '<div class=\'resppages\'><a href="([^"]+)') if next_page_link != '': itemlist.append( item.clone(title='>> Página siguiente', url=next_page_link)) return itemlist