# -*- coding: utf-8 -*- # vStream https://github.com/Kodi-vStream/venom-xbmc-addons # 07/05/20 mise en place recaptcha # return False import re import xbmc import xbmcgui from resources.lib.gui.hoster import cHosterGui from resources.lib.gui.gui import cGui from resources.lib.handler.inputParameterHandler import cInputParameterHandler from resources.lib.handler.outputParameterHandler import cOutputParameterHandler from resources.lib.handler.requestHandler import cRequestHandler from resources.lib.parser import cParser from resources.lib.config import GestionCookie from resources.lib.recaptcha import ResolveCaptcha from resources.lib.comaddon import progress, dialog, VSlog UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0' SITE_IDENTIFIER = 'cinemegatoil_org' SITE_NAME = 'CineMegaToil' SITE_DESC = 'Films - Films HD' URL_MAIN = 'https://www.cinemegatoil.org/' MOVIE_MOVIE = ('http://', 'load') MOVIE_NEWS = (URL_MAIN + 'film', 'showMovies') MOVIE_GENRES = (True, 'showGenres') MOVIE_ANNEES = (True, 'showYears') URL_SEARCH = (URL_MAIN + '?do=search&mode=advanced&subaction=search&titleonly=3&story=', 'showMovies') URL_SEARCH_MOVIES = (URL_MAIN + '?do=search&mode=advanced&subaction=search&titleonly=3&story=', 'showMovies') def load(): oGui = cGui() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'search.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', MOVIE_NEWS[0]) oGui.addDir(SITE_IDENTIFIER, MOVIE_NEWS[1], 'Films (Derniers ajouts)', 'news.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', MOVIE_GENRES[0]) oGui.addDir(SITE_IDENTIFIER, MOVIE_GENRES[1], 'Films (Genres)', 'genres.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', MOVIE_ANNEES[0]) oGui.addDir(SITE_IDENTIFIER, MOVIE_ANNEES[1], 'Films (Par années)', 'annees.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showSearch(): oGui = cGui() sSearchText = oGui.showKeyBoard() if (sSearchText != False): sUrl = sSearchText showMovies(sUrl) oGui.setEndOfDirectory() return def showGenres(): oGui = cGui() liste = [] liste.append(['Action', URL_MAIN + 'action']) liste.append(['Animation', URL_MAIN + 'animation']) liste.append(['Arts-martiaux', URL_MAIN + 'arts-martiaux']) liste.append(['Aventure', URL_MAIN + 'aventure']) liste.append(['Biopic', URL_MAIN + 'biopic']) liste.append(['Comédie', URL_MAIN + 'comedie']) liste.append(['Comédie musicale', URL_MAIN + 'comedie-musicale']) # l'url sur le site n'est pas bonne liste.append(['Documentaire', URL_MAIN + 'documentaire']) liste.append(['Drame', URL_MAIN + 'drame']) liste.append(['Epouvante-horreur', URL_MAIN + 'epouvante-horreur']) liste.append(['Espionnage', URL_MAIN + 'espionnage']) liste.append(['Exclu', URL_MAIN + 'exclu']) liste.append(['Famille', URL_MAIN + 'famille']) liste.append(['Fantastique', URL_MAIN + 'fantastique']) liste.append(['Guerre', URL_MAIN + 'guerre']) liste.append(['Historique', URL_MAIN + 'historique']) liste.append(['Musical', URL_MAIN + 'musical']) liste.append(['Policier', URL_MAIN + 'policier']) liste.append(['Romance', URL_MAIN + 'romance']) liste.append(['Science-fiction', URL_MAIN + 'science-fiction']) liste.append(['Thriller', URL_MAIN + 'thriller']) liste.append(['Vieux Film', URL_MAIN + 'vieux-film']) liste.append(['Western', URL_MAIN + 'western']) for sTitle, sUrl in liste: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oGui.addDir(SITE_IDENTIFIER, 'showMovies', sTitle, 'genres.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showYears(): oGui = cGui() for i in reversed(range(2005, 2021)): Year = str(i) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', URL_MAIN + 'index.php?do=xfsearch&xf=' + Year) oGui.addDir(SITE_IDENTIFIER, 'showMovies', Year, 'annees.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showMovies(sSearch=''): oGui = cGui() oParser = cParser() if sSearch: if URL_SEARCH[0] in sSearch: sUrl = sSearch else: sUrl = URL_SEARCH[0] + sSearch sUrl = sUrl.replace(' ', '+') else: oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() sPattern = 'class="poster.+?img src="([^"]+)".+?class="quality">([^<]+)<\/div>.+?class="title">Ann.+?([^<]+).+?class="shortStory">([^<]+)' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == False): oGui.addText(SITE_IDENTIFIER) if (aResult[0] == True): total = len(aResult[1]) progress_ = progress().VScreate(SITE_NAME) for aEntry in aResult[1]: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break sUrl2 = aEntry[2] sThumb = aEntry[0] if sThumb.startswith('//'): sThumb = 'http:' + sThumb sTitle = aEntry[3] sQual = aEntry[1] sYear = aEntry[4] sDesc = aEntry[5] sDisplayTitle = ('%s [%s]') % (sTitle, sQual) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl2) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sDesc', sDesc) oOutputParameterHandler.addParameter('sYear', sYear) oGui.addMovie(SITE_IDENTIFIER, 'showHosters', sDisplayTitle, 'films.png', sThumb, sDesc, oOutputParameterHandler) progress_.VSclose(progress_) sNextPage = __checkForNextPage(sHtmlContent) if (sNextPage != False): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sNextPage) number = re.search('page/([0-9]+)', sNextPage).group(1) oGui.addNext(SITE_IDENTIFIER, 'showMovies', '[COLOR teal]Page ' + number + ' >>>[/COLOR]', oOutputParameterHandler) if not sSearch: oGui.setEndOfDirectory() def __checkForNextPage(sHtmlContent): sPattern = '