# -*- coding: utf-8 -*- # -*- Channel DoramasMP4 -*- # -*- Created for Alfa-addon -*- # -*- By the Alfa Develop Group -*- import re from channels import autoplay from channels import filtertools from core import httptools from core import scrapertools from core import servertools from core import jsontools from core import tmdb from core.item import Item from platformcode import config, logger from channelselector import get_thumb host = 'https://www.doramasmp4.com/' IDIOMAS = {'sub': 'VOSE', 'VO': 'VO'} list_language = IDIOMAS.values() list_quality = [] list_servers = ['openload', 'streamango', 'netutv', 'okru', 'directo', 'mp4upload'] def get_source(url): logger.info() data = httptools.downloadpage(url).data data = re.sub(r'"|\n|\r|\t| |
|\s{2,}', "", data) return data def mainlist(item): logger.info() autoplay.init(item.channel, list_servers, list_quality) itemlist = [] itemlist.append(Item(channel= item.channel, title="Doramas", action="doramas_menu", thumbnail=get_thumb('doramas', auto=True), type='dorama')) itemlist.append(Item(channel=item.channel, title="Películas", action="list_all", url=host + 'catalogue?format=pelicula', thumbnail=get_thumb('movies', auto=True), type='movie')) itemlist.append(Item(channel=item.channel, title = 'Buscar', action="search", url= host+'ajax/search.php', thumbnail=get_thumb('search', auto=True))) autoplay.show_option(item.channel, itemlist) return itemlist def doramas_menu(item): logger.info() itemlist =[] itemlist.append(Item(channel=item.channel, title="Todas", action="list_all", url=host + 'catalogue', thumbnail=get_thumb('all', auto=True), type='dorama')) itemlist.append(Item(channel=item.channel, title="Nuevos capitulos", action="latest_episodes", url=host + 'latest-episodes', thumbnail=get_thumb('new episodes', auto=True), type='dorama')) return itemlist def list_all(item): logger.info() itemlist = [] data = get_source(item.url) patron = '
') if next_page != '': itemlist.append(Item(channel=item.channel, action="list_all", title='Siguiente >>>', url=page_base+next_page, thumbnail='https://s16.postimg.cc/9okdu7hhx/siguiente.png', type=item.type)) return itemlist def search_results(item): logger.info() itemlist=[] data = httptools.downloadpage(item.url, post=item.post).data data = re.sub(r'"|\n|\r|\t| |
|\s{2,}', "", data) patron = '
.*?500>(.*?)
' patron += '
(.*?)
.*?200>(.*?)' matches = re.compile(patron, re.DOTALL).findall(data) for scrapedurl, scrapedthumbnail, scrapedtitle, year, scrapedtype in matches: new_item = Item(channel=item.channel, url=scrapedurl, thumbnail=scrapedthumbnail, title=scrapedtitle) if scrapedtype != 'dorama': new_item.action = 'findvideos' new_item.contentTitle = scrapedtitle else: new_item.contentSerieName=scrapedtitle new_item.action = 'episodios' itemlist.append(new_item) tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) return itemlist def latest_episodes(item): logger.info() itemlist = [] infoLabels = dict() data = get_source(item.url) patron = '
0: itemlist.append( item.clone(title="Añadir esta serie a la videoteca", action="add_serie_to_library", extra="episodios", text_color='yellow')) return itemlist def findvideos(item): logger.info() itemlist = [] duplicated = [] headers={'referer':item.url} data = get_source(item.url) patron = 'animated pulse data-url=(.*?)>' matches = re.compile(patron, re.DOTALL).findall(data) if ' ¡Este capítulo no tiene subtítulos, solo audio original!
' in data: language = IDIOMAS['vo'] else: language = IDIOMAS['sub'] if item.type !='episode' and '' not in data: item.type = 'dorama' item.contentSerieName = item.contentTitle item.contentTitle = '' return episodios(item) else: for video_url in matches: video_data = httptools.downloadpage(video_url, headers=headers).data server = '' if 'Media player DMP4' in video_data: url = scrapertools.find_single_match(video_data, "sources: \[\{'file':'(.*?)'") server = 'Directo' else: url = scrapertools.find_single_match(video_data, '