def play(item): logger.info() if item.subtitle: sub = subtitletools.get_from_subdivx(item.subtitle) return [item.clone(subtitle=sub)] else: return [item]
def findvideos(item): logger.info() itemlist = list() urls_list = list() sub_url = '' soup = create_soup(item.url).find( "div", class_="entry-content").find("div").find("p") quality = scrapertools.find_single_match(soup.text, "Calidad: ([^\n]+)\n") video_data = soup.find_all("a") for link in video_data: if link["data-wpel-link"] == "external": sub_url = link["href"] else: urls_list.append(link["href"]) for url in urls_list: if not sub_url: sub = '' lang = 'VO' else: try: sub = subtitletools.get_from_subdivx(sub_url) except: sub = '' lang = 'VOSE' itemlist.append( Item(channel=item.channel, title="%s", url=url, action="play", quality=quality, language=lang, subtitle=sub, server="torrent", infoLabels=item.infoLabels)) if config.get_videolibrary_support( ) and len(itemlist) > 0 and item.extra != 'findvideos': 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=item.contentTitle)) return itemlist
def findvideos(item): logger.info() itemlist = [] full_data = get_source(item.url) data = scrapertools.find_single_match(full_data, '>FICHA TECNICA:<.*?</ul>') #patron = '(?:bold|strong>|<br/>|<em>)([^<]+)(?:</em>|<br/>).*?="(magnet[^"]+)"' patron = '(?:<em>|<br/><em>|/> )(DVD|720|1080)(?:</em>|<br/>|</span>).*?="(magnet[^"]+)"' matches = re.compile(patron, re.DOTALL).findall(data) if len(matches) == 0: patron = '<a href="(magnet[^"]+)"' matches = re.compile(patron, re.DOTALL).findall(full_data) patron_sub = 'href="(http://www.subdivx.com/bajar.php[^"]+)"' sub_url = scrapertools.find_single_match(full_data, patron_sub) #sub_num = scrapertools.find_single_match(sub_url, 'u=(\d+)') if sub_url == '': sub = '' lang = 'VO' else: try: sub = subtitletools.get_from_subdivx(sub_url) except: sub = '' lang = 'VOSE' try: for quality, scrapedurl in matches: if quality.strip() not in ['DVD', '720', '1080']: quality = 'DVD' url = scrapedurl if not config.get_setting('unify'): title = ' [Torrent] [%s] [%s]' % (quality, lang) else: title = 'Torrent' itemlist.append(Item(channel=item.channel, fanart=fanart, title=title, url=url, action='play', server='torrent', quality=quality, language=lang, infoLabels=item.infoLabels, subtitle=sub)) except: for scrapedurl in matches: quality = 'DVD' url = scrapedurl if not config.get_setting('unify'): title = ' [Torrent] [%s] [%s]' % (quality, lang) else: title = 'Torrent' itemlist.append(Item(channel=item.channel, fanart=fanart, title=title, url=url, action='play', server='torrent', quality=quality, language=lang, infoLabels=item.infoLabels, subtitle=sub)) if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra != 'findvideos': 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=item.contentTitle )) return itemlist