forked from STI/Astroport.ONE
521 lines
20 KiB
Python
521 lines
20 KiB
Python
|
# -*- coding: utf-8 -*-
|
||
|
# vStream https://github.com/Kodi-vStream/venom-xbmc-addons
|
||
|
|
||
|
import re
|
||
|
from resources.lib.comaddon import siteManager
|
||
|
from resources.lib.gui.gui import cGui
|
||
|
from resources.lib.gui.hoster import cHosterGui
|
||
|
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.util import cUtil
|
||
|
|
||
|
SITE_IDENTIFIER = 'cinemay_cc'
|
||
|
SITE_NAME = 'Cinemay_cc'
|
||
|
SITE_DESC = 'Films VF & VOSTFR en streaming.'
|
||
|
|
||
|
URL_MAIN = siteManager().getUrlMain(SITE_IDENTIFIER)
|
||
|
URL_SEARCH = ('', 'showMovies')
|
||
|
URL_SEARCH_MOVIES = (URL_SEARCH[0], 'showMovies')
|
||
|
URL_SEARCH_SERIES = (URL_SEARCH[0], 'showMovies')
|
||
|
FUNCTION_SEARCH = 'showMovies'
|
||
|
|
||
|
MOVIE_NEWS = (URL_MAIN + 'film-streaming', 'showMovies')
|
||
|
MOVIE_VIEWS = (URL_MAIN + 'films-box-office', 'showMovies')
|
||
|
MOVIE_GENRES = (True, 'showGenres')
|
||
|
MOVIE_ANNEES = (True, 'showMovieYears')
|
||
|
MOVIE_LIST = ('', 'showAlpha')
|
||
|
|
||
|
SERIE_NEWS = (URL_MAIN + 'serie-streaming', 'showMovies')
|
||
|
SERIE_GENRES = (True, 'showGenresTVShow')
|
||
|
SERIE_ANNEES = (True, 'showMovieYearsTVShow')
|
||
|
SERIE_LIST = ('', 'showAlphaTVShow')
|
||
|
|
||
|
MOVIE_MOVIE = (True, 'showMenuMovies')
|
||
|
SERIE_SERIES = (True, 'showMenuSeries')
|
||
|
|
||
|
|
||
|
def load():
|
||
|
oGui = cGui()
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', 'http://venom/')
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'search.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_NEWS[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_NEWS[1], 'Films (Derniers ajouts)', 'news.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_VIEWS[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_VIEWS[1], 'Films (Les plus vus)', 'annees.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_GENRES[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_GENRES[1], 'Films (Genres)', 'genres.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_ANNEES[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_ANNEES[1], 'Films (Par années)', 'annees.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_LIST[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_LIST[1], 'Films (Liste alphabétique)', 'az.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_NEWS[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, SERIE_NEWS[1], 'Séries (Derniers ajouts)', 'news.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_GENRES[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, SERIE_GENRES[1], 'Séries (Genres)', 'genres.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_ANNEES[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, SERIE_ANNEES[1], 'Séries (Par années)', 'annees.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_LIST[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, SERIE_LIST[1], 'Séries (Liste alphabétique)', 'az.png', oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showMenuMovies():
|
||
|
oGui = cGui()
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', 'http://venom/')
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'search.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_NEWS[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_NEWS[1], 'Films (Derniers ajouts)', 'news.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_VIEWS[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_VIEWS[1], 'Films (les plus vus)', 'annees.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_GENRES[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_GENRES[1], 'Films (Genres)', 'genres.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', MOVIE_ANNEES[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, MOVIE_ANNEES[1], 'Films (Par années)', 'annees.png', oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showMenuSeries():
|
||
|
oGui = cGui()
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_NEWS[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, SERIE_NEWS[1], 'Séries (Derniers ajouts)', 'news.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_GENRES[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, SERIE_GENRES[1], 'Séries (Genres)', 'genres.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_ANNEES[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, SERIE_ANNEES[1], 'Séries (Par années)', 'annees.png', oOutputParameterHandler)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_LIST[0])
|
||
|
oGui.addDir(SITE_IDENTIFIER, SERIE_LIST[1], 'Séries (Par ordre alphabétique)', 'az.png', oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showSearch():
|
||
|
oGui = cGui()
|
||
|
sSearchText = oGui.showKeyBoard()
|
||
|
if sSearchText != False:
|
||
|
showMovies(sSearchText)
|
||
|
oGui.setEndOfDirectory()
|
||
|
return
|
||
|
|
||
|
|
||
|
def showGenresTVShow():
|
||
|
showGenres(sTypeSerie='/series')
|
||
|
|
||
|
|
||
|
def showGenres(sTypeSerie=''):
|
||
|
oGui = cGui()
|
||
|
|
||
|
listegenre = ['action', 'action-adventure', 'animation', 'aventure', 'comedie', 'crime', 'documentaire', 'drame',
|
||
|
'familial', 'fantastique', 'guerre', 'histoire', 'horreur', 'kids', 'musique', 'musical', 'mystere',
|
||
|
'news', 'science-fiction', 'science-fiction-fantastique', 'reality', 'romance', 'soap',
|
||
|
'talk', 'telefilm', 'thriller', 'war-politics', 'western']
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
for igenre in listegenre:
|
||
|
|
||
|
sUrl = URL_MAIN + 'categories/' + igenre + sTypeSerie
|
||
|
sTitle = igenre.capitalize()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showMovies', sTitle, 'genres.png', oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showAlphaTVShow():
|
||
|
showAlpha(sTypeSerie='/series')
|
||
|
|
||
|
|
||
|
def showAlpha(sTypeSerie=''):
|
||
|
oGui = cGui()
|
||
|
oInputParameterHandler = cInputParameterHandler()
|
||
|
sType = oInputParameterHandler.getValue('siteUrl')
|
||
|
|
||
|
liste = [['A', 'a'], ['B', 'b'], ['C', 'c'], ['D', 'd'], ['E', 'e'], ['F', 'f'], ['G', 'g'], ['H', 'h'],
|
||
|
['J', 'j'], ['K', 'k'], ['L', 'l'], ['M', 'm'], ['N', 'n'], ['O', 'o'], ['P', 'p'], ['Q', 'q'],
|
||
|
['R', 'r'], ['S', 's'], ['T', 't'], ['U', 'u'], ['V', 'v'], ['W', 'w'], ['X', 'x'], ['Y', 'y'],
|
||
|
['Z', 'z']]
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
for sTitle, sUrl in liste:
|
||
|
oOutputParameterHandler.addParameter('siteUrl', URL_MAIN + 'letter/' + sUrl + str(sType) + sTypeSerie)
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showMovies', 'Lettre [COLOR coral]' + sTitle + '[/COLOR]', 'listes.png', oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showMovieYearsTVShow():
|
||
|
showMovieYears(sTypeSerie='/series')
|
||
|
|
||
|
|
||
|
def showMovieYears(sTypeSerie=''):
|
||
|
oGui = cGui()
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
for i in reversed(range(2001, 2022)): # pas grand chose 32 - 90
|
||
|
Year = str(i)
|
||
|
oOutputParameterHandler.addParameter('siteUrl', URL_MAIN + 'annee/' + Year + sTypeSerie)
|
||
|
oGui.addDir(SITE_IDENTIFIER, 'showMovies', Year, 'annees.png', oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showMovies(sSearch=''):
|
||
|
oGui = cGui()
|
||
|
oParser = cParser()
|
||
|
|
||
|
if sSearch:
|
||
|
bvalid, stoken, scookie = getTokens()
|
||
|
if bvalid:
|
||
|
oUtil = cUtil()
|
||
|
sSearchText = oUtil.CleanName(sSearch)
|
||
|
sSearch = sSearch.replace(' ', '+').replace('%20', '+')
|
||
|
pdata = '_token=' + stoken + '&search=' + sSearch
|
||
|
sUrl = URL_MAIN + 'search'
|
||
|
UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:70.0) Gecko/20100101 Firefox/70.0'
|
||
|
|
||
|
oRequestHandler = cRequestHandler(sUrl)
|
||
|
oRequestHandler.setRequestType(1)
|
||
|
oRequestHandler.addHeaderEntry('User-Agent', UA)
|
||
|
oRequestHandler.addHeaderEntry('Referer', URL_MAIN)
|
||
|
oRequestHandler.addHeaderEntry('Content-Type', 'application/x-www-form-urlencoded')
|
||
|
oRequestHandler.addHeaderEntry('Cookie', scookie)
|
||
|
oRequestHandler.addParametersLine(pdata)
|
||
|
# oRequestHandler.request()
|
||
|
sHtmlContent = oRequestHandler.request()
|
||
|
else:
|
||
|
oGui.addText(SITE_IDENTIFIER)
|
||
|
return
|
||
|
|
||
|
else:
|
||
|
oInputParameterHandler = cInputParameterHandler()
|
||
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
||
|
oRequestHandler = cRequestHandler(sUrl)
|
||
|
sHtmlContent = oRequestHandler.request()
|
||
|
|
||
|
# title img year surl
|
||
|
sPattern = '<figure>.+?data-src="([^"]+.jpg)" (?:alt|title)="([^"]+).+?year">([^<]*).+?href="([^"]+)'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
|
||
|
if aResult[0] is False:
|
||
|
oGui.addText(SITE_IDENTIFIER)
|
||
|
else:
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
for aEntry in aResult[1]:
|
||
|
sDesc = ''
|
||
|
sThumb = re.sub('/w\d+/', '/w342/', aEntry[0])
|
||
|
sTitle = aEntry[1].replace('film en streaming', '').replace('série en streaming', '')
|
||
|
|
||
|
# Titre recherché
|
||
|
if sSearch:
|
||
|
if not oUtil.CheckOccurence(sSearchText, sTitle):
|
||
|
continue
|
||
|
|
||
|
sYear = aEntry[2]
|
||
|
sUrl2 = aEntry[3]
|
||
|
sDisplayTitle = sTitle + '(' + sYear + ')'
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sUrl2)
|
||
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
||
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
||
|
oOutputParameterHandler.addParameter('sDesc', sDesc)
|
||
|
oOutputParameterHandler.addParameter('sYear', sYear)
|
||
|
|
||
|
if sSearch:
|
||
|
oGui.addLink(SITE_IDENTIFIER, 'showSelectType', sDisplayTitle, sThumb, sDesc, oOutputParameterHandler)
|
||
|
elif '/serie' in sUrl or 'série en streaming' in aEntry[1]:
|
||
|
sDisplayTitle = sTitle
|
||
|
oGui.addTV(SITE_IDENTIFIER, 'showSaison', sDisplayTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
||
|
else:
|
||
|
oGui.addMovie(SITE_IDENTIFIER, 'showLink', sDisplayTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
||
|
|
||
|
if not sSearch:
|
||
|
sNextPage, sPaging = __checkForNextPage(sHtmlContent)
|
||
|
if sNextPage != False:
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sNextPage)
|
||
|
oGui.addNext(SITE_IDENTIFIER, 'showMovies', 'Page ' + sPaging, oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def __checkForNextPage(sHtmlContent):
|
||
|
oParser = cParser()
|
||
|
sPattern = '>([^<]+?)</a><a href="([^"]+?)" class="next page-numbers'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
if aResult[0] is True:
|
||
|
sNumberMax = aResult[1][0][0]
|
||
|
sNextPage = aResult[1][0][1]
|
||
|
sNumberNext = re.search('page.([0-9]+)', sNextPage).group(1)
|
||
|
sPaging = sNumberNext + '/' + sNumberMax
|
||
|
return sNextPage, sPaging
|
||
|
|
||
|
return False, 'none'
|
||
|
|
||
|
|
||
|
def showSelectType():
|
||
|
oGui = cGui()
|
||
|
|
||
|
oInputParameterHandler = cInputParameterHandler()
|
||
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
||
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
||
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
||
|
sYear = oInputParameterHandler.getValue('sYear')
|
||
|
|
||
|
oRequest = cRequestHandler(sUrl)
|
||
|
sHtmlContent = oRequest.request()
|
||
|
|
||
|
sDesc = ''
|
||
|
oParser = cParser()
|
||
|
sPattern = 'class="description">.*?<br>([^<]+)'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
if aResult[0] is True:
|
||
|
sDesc = ('[I][COLOR grey]%s[/COLOR][/I] %s') % ('Synopsis :', aResult[1][0])
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
||
|
oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle)
|
||
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
||
|
oOutputParameterHandler.addParameter('sDesc', sDesc)
|
||
|
oOutputParameterHandler.addParameter('sYear', sYear)
|
||
|
|
||
|
if 'class="num-epi">' in sHtmlContent:
|
||
|
|
||
|
oGui.addTV(SITE_IDENTIFIER, 'showSaison', sMovieTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
||
|
else:
|
||
|
oGui.addMovie(SITE_IDENTIFIER, 'showLink', sMovieTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showSaison():
|
||
|
oGui = cGui()
|
||
|
|
||
|
oInputParameterHandler = cInputParameterHandler()
|
||
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
||
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
||
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
||
|
sDesc = oInputParameterHandler.getValue('sDesc')
|
||
|
|
||
|
oRequestHandler = cRequestHandler(sUrl)
|
||
|
sHtmlContent = oRequestHandler.request()
|
||
|
oParser = cParser()
|
||
|
sPattern = '<a href="#season.+?class.+?saison (\d+)'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
|
||
|
if aResult[0] is True:
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
for aEntry in aResult[1]:
|
||
|
|
||
|
sNumSaison = aEntry[0]
|
||
|
sSaison = 'Saison ' + aEntry[0]
|
||
|
sUrlSaison = sUrl + "?sNumSaison=" + sNumSaison
|
||
|
sDisplayTitle = sMovieTitle + ' ' + sSaison
|
||
|
sTitle = sMovieTitle
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sUrlSaison)
|
||
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
||
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
||
|
oOutputParameterHandler.addParameter('sDesc', sDesc)
|
||
|
|
||
|
oGui.addSeason(SITE_IDENTIFIER, 'showSXE', sDisplayTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showSXE():
|
||
|
oGui = cGui()
|
||
|
|
||
|
oInputParameterHandler = cInputParameterHandler()
|
||
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
||
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
||
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
||
|
sDesc = oInputParameterHandler.getValue('sDesc')
|
||
|
|
||
|
sUrl, sNumSaison = sUrl.split('?sNumSaison=')
|
||
|
|
||
|
oRequestHandler = cRequestHandler(sUrl)
|
||
|
sHtmlContent = oRequestHandler.request()
|
||
|
|
||
|
oParser = cParser()
|
||
|
sStart = 'class="num-epi">' + sNumSaison
|
||
|
sEnd = 'id="season-'
|
||
|
sHtmlContent = oParser.abParse(sHtmlContent, sStart, sEnd)
|
||
|
sPattern = 'class="description">.*?<br>([^<]+)'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
if aResult[0] is True:
|
||
|
sDesc = ('[I][COLOR grey]%s[/COLOR][/I] %s') % ('Synopsis :', aResult[1][0])
|
||
|
|
||
|
sPattern = 'class="num-epi">\d+x([^<]+).+?href="([^"]+)'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
|
||
|
if aResult[0] is True:
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
for aEntry in aResult[1]:
|
||
|
|
||
|
Ep = aEntry[0]
|
||
|
sUrl2 = aEntry[1]
|
||
|
Saison = 'Saison' + ' ' + sNumSaison
|
||
|
sTitle = sMovieTitle + ' ' + Saison + ' Episode' + Ep
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sUrl2)
|
||
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
||
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
||
|
oOutputParameterHandler.addParameter('sDesc', sDesc)
|
||
|
|
||
|
oGui.addEpisode(SITE_IDENTIFIER, 'showLink', sTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showLink():
|
||
|
oGui = cGui()
|
||
|
|
||
|
oInputParameterHandler = cInputParameterHandler()
|
||
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
||
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
||
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
||
|
sDesc = oInputParameterHandler.getValue('sDesc')
|
||
|
sYear = oInputParameterHandler.getValue('sYear')
|
||
|
|
||
|
oRequest = cRequestHandler(sUrl)
|
||
|
sHtmlContent = oRequest.request()
|
||
|
|
||
|
oParser = cParser()
|
||
|
sPattern = 'class="description">.*?<br>([^<]+)'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
if aResult[0] is True:
|
||
|
sDesc = ('[I][COLOR grey]%s[/COLOR][/I] %s') % ('Synopsis :', aResult[1][0])
|
||
|
|
||
|
# dans le cas d'une erreur si serie (pas de controle année et genre)
|
||
|
if False and 'class="num-epi">' in sHtmlContent and 'episode' not in sUrl:
|
||
|
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
||
|
oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle)
|
||
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
||
|
oOutputParameterHandler.addParameter('sDesc', sDesc)
|
||
|
oGui.addTV(SITE_IDENTIFIER, 'showSXE', sMovieTitle, '', sThumb, sDesc, oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
return
|
||
|
|
||
|
sPattern = 'data-url="([^"]+).+?server.+?alt="([^"]+).+?alt="([^"]+)'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
if aResult[0] is False:
|
||
|
oGui.addText(SITE_IDENTIFIER)
|
||
|
|
||
|
if aResult[0]:
|
||
|
oHosterGui = cHosterGui()
|
||
|
oOutputParameterHandler = cOutputParameterHandler()
|
||
|
for aEntry in aResult[1]:
|
||
|
sKey = aEntry[0]
|
||
|
sHost = aEntry[1].replace('www.', '').replace('embed.mystream.to', 'mystream')
|
||
|
sHost = re.sub('\.\w+', '', sHost).capitalize()
|
||
|
if not oHosterGui.checkHoster(sHost):
|
||
|
continue
|
||
|
|
||
|
sLang = aEntry[2].upper()
|
||
|
sUrl2 = URL_MAIN + 'll/captcha?hash=' + sKey
|
||
|
sTitle = ('%s (%s) [COLOR coral]%s[/COLOR]') % (sMovieTitle, sLang, sHost)
|
||
|
|
||
|
oOutputParameterHandler.addParameter('siteUrl', sUrl2)
|
||
|
oOutputParameterHandler.addParameter('referer', sUrl)
|
||
|
oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle)
|
||
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
||
|
oOutputParameterHandler.addParameter('sYear', sYear)
|
||
|
oOutputParameterHandler.addParameter('sHost', sHost)
|
||
|
oOutputParameterHandler.addParameter('sLang', sLang)
|
||
|
oGui.addLink(SITE_IDENTIFIER, 'showHosters', sTitle, sThumb, sDesc, oOutputParameterHandler)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def showHosters():
|
||
|
oGui = cGui()
|
||
|
|
||
|
oInputParameterHandler = cInputParameterHandler()
|
||
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
||
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
||
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
||
|
|
||
|
oRequestHandler = cRequestHandler(sUrl)
|
||
|
sHtmlContent = oRequestHandler.request()
|
||
|
|
||
|
sPattern = '<iframe.*?src=([^\s]+)'
|
||
|
aResult = re.findall(sPattern, sHtmlContent)
|
||
|
if aResult:
|
||
|
sHosterUrl = aResult[0]
|
||
|
|
||
|
oHoster = cHosterGui().checkHoster(sHosterUrl)
|
||
|
if oHoster != False:
|
||
|
oHoster.setDisplayName(sMovieTitle)
|
||
|
oHoster.setFileName(sMovieTitle)
|
||
|
cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumb)
|
||
|
|
||
|
oGui.setEndOfDirectory()
|
||
|
|
||
|
|
||
|
def getTokens():
|
||
|
oParser = cParser()
|
||
|
oRequestHandler = cRequestHandler(URL_MAIN)
|
||
|
sHtmlContent = oRequestHandler.request()
|
||
|
|
||
|
token = ''
|
||
|
XSRF_TOKEN = ''
|
||
|
site_session = ''
|
||
|
|
||
|
sHeader = oRequestHandler.getResponseHeader()
|
||
|
sPattern = 'id="menu.+?name=_token value="([^"]+)'
|
||
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
||
|
|
||
|
if aResult[0] is False:
|
||
|
return False, 'none', 'none'
|
||
|
|
||
|
if aResult[0] is True:
|
||
|
token = aResult[1][0]
|
||
|
|
||
|
sPattern = 'XSRF-TOKEN=([^;]+).+?cinemay_session=([^;]+)'
|
||
|
aResult = oParser.parse(sHeader, sPattern)
|
||
|
|
||
|
if aResult[0] is False:
|
||
|
return False, 'none', 'none'
|
||
|
|
||
|
if aResult[0] is True:
|
||
|
XSRF_TOKEN = aResult[1][0][0]
|
||
|
site_session = aResult[1][0][1]
|
||
|
|
||
|
cook = 'XSRF-TOKEN=' + XSRF_TOKEN + '; cinemay_session=' + site_session + ';'
|
||
|
return True, token, cook
|
||
|
|
||
|
|
||
|
def cleanDesc(sDesc):
|
||
|
list_comment = ['Voir film ', 'en streaming', 'Voir Serie ']
|
||
|
for s in list_comment:
|
||
|
sDesc = sDesc.replace(s, '')
|
||
|
|
||
|
return sDesc
|