# -*- coding: utf-8 -*- # -*- Channel Vi2.co -*- # -*- Created for Alfa-addon -*- # -*- By the Alfa Develop Group -*- import re import urllib import base64 from channelselector import get_thumb from core import httptools from core import jsontools from core import scrapertools from core import servertools from core import tmdb from lib import jsunpack from core.item import Item from channels import filtertools from channels import autoplay from platformcode import config, logger IDIOMAS = {'Latino': 'LAT', 'Español':'CAST', 'Subtitulado': 'VOSE', 'VO': 'VO'} list_language = IDIOMAS.values() list_quality = ['Full HD 1080p', 'HDRip', 'DVDScreener', '720p', 'Ts Screener hq', 'HD Real 720p', 'DVDRip', 'BluRay-1080p', 'BDremux-1080p'] list_servers = [ 'directo', 'openload', 'rapidvideo', 'jawcloud', 'cloudvideo', 'upvid', 'vevio', 'gamovideo' ] host = 'http://vi2.co' def mainlist(item): logger.info() autoplay.init(item.channel, list_servers, list_quality) itemlist = [] itemlist.append(Item(channel=item.channel, title='Peliculas', action='select_menu', type='peliculas', thumbnail= get_thumb('movies', auto=True))) # itemlist.append(Item(channel=item.channel, title='Series', url=host+'serie', action='select_menu', type='series', # thumbnail= get_thumb('tvshows', auto=True))) autoplay.show_option(item.channel, itemlist) return itemlist def select_menu(item): logger.info() itemlist=[] url = host + '/%s/es/' % item.type itemlist.append(Item(channel=item.channel, title='Streaming', action='sub_menu', thumbnail=get_thumb('all', auto=True), type=item.type)) itemlist.append(Item(channel=item.channel, title='Torrent', action='sub_menu', thumbnail=get_thumb('all', auto=True), type=item.type)) itemlist.append(Item(channel=item.channel, title='Generos', action='section', url=url, thumbnail=get_thumb('genres', auto=True), type='all')) itemlist.append(Item(channel=item.channel, title='Por Año', action='section', url=url, thumbnail=get_thumb('year', auto=True), type='all')) return itemlist def sub_menu(item): logger.info() itemlist = [] url = host + '/%s/es/ajax/1/' % item.type link_type = item.title.lower() if link_type == 'streaming': link_type = 'flash' movies_options = ['Todas', 'Castellano', 'Latino', 'VOSE'] tv_options = ['Ultimas', 'Ultimas Castellano', 'Ultimas Latino', 'Ultimas VOSE'] if item.type == 'peliculas': title = movies_options thumb_1 = 'all' else: thumb_1 = 'last' title = tv_options itemlist.append(Item(channel=item.channel, title=title[0], url=url+'?q=%s' % link_type, action='list_all', thumbnail=get_thumb(thumb_1, auto=True), type=item.type, link_type=link_type)) itemlist.append(Item(channel=item.channel, title=title[1], url=url + '?q=%s+espanol' % link_type, action='list_all', thumbnail=get_thumb('cast', auto=True), type=item.type, send_lang='Español', link_type=link_type)) itemlist.append(Item(channel=item.channel, title=title[2], url=url + '?q=%s+latino' % link_type, action='list_all', thumbnail=get_thumb('lat', auto=True), type=item.type, send_lang='Latino', link_type=link_type)) itemlist.append(Item(channel=item.channel, title=title[3], url=url + '?q=%s+subtitulado' % link_type, action='list_all', thumbnail=get_thumb('vose', auto=True), type=item.type, send_lang='VOSE', link_type=link_type)) itemlist.append(Item(channel=item.channel, title="Buscar", action="search", url=url + '?q=', thumbnail=get_thumb("search", auto=True), type=item.type, link_type=link_type)) return itemlist def get_source(url, referer=None): logger.info() if referer is None: data = httptools.downloadpage(url).data else: data = httptools.downloadpage(url, headers={'Referer':referer}).data data = re.sub(r'\n|\r|\t| |
|\s{2,}', "", data) return data def section(item): logger.info() itemlist=[] excluded = ['latino', 'español', 'subtitulado', 'v.o.', 'streaming', 'torrent'] full_data = get_source(item.url) data = scrapertools.find_single_match(full_data, 'toptags-container(.*?)
') patron = 'href="([^"]+)">([^<]+)<' matches = re.compile(patron, re.DOTALL).findall(data) for scrapedurl, scrapedtitle in matches: title = scrapedtitle url = host+scrapedurl.replace('/?','/ajax/1/?') if (item.title=='Generos' and title.lower() not in excluded and not title.isdigit()) or (item.title=='Por Año' and title.isdigit()): itemlist.append(Item(channel=item.channel, url=url, title=title, action='list_all', type=item.type)) return itemlist def list_all(item): from core import jsontools logger.info() itemlist = [] listed =[] quality='' infoLabels = {} json_data= jsontools.load(get_source(item.url)) data = json_data['render'] data = re.sub(r'\n|\r|\t| |
|\s{2,}', "", data) #if item.type == 'peliculas': patron = ' 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 search(item, texto): logger.info() texto = texto.replace(" ", "+") item.url = '%spelicula+%s+%s&o=2' % (item.url, texto, item.link_type) if texto != '': return list_all(item) else: return [] def newest(categoria): logger.info() item = Item() try: if categoria in ['peliculas']: item.url = host + 'ver/' elif categoria == 'infantiles': item.url = host + 'genero/animacion/' elif categoria == 'terror': item.url = host + 'genero/terror/' elif categoria == 'documentales': item.url = host + 'genero/terror/' item.type=item.type itemlist = list_all(item) if itemlist[-1].title == 'Siguiente >>': itemlist.pop() except: import sys for line in sys.exc_info(): logger.error("{0}".format(line)) return [] return itemlist