def __callRequest(self): sParameters = urllib.parse.urlencode(self.__aParamaters) if (self.__cType == cRequestHandler.REQUEST_TYPE_GET): if (len(sParameters) > 0): if (self.__sUrl.find('?') == -1): self.__sUrl = self.__sUrl + '?' + str(sParameters) sParameters = '' else: self.__sUrl = self.__sUrl + '&' + str(sParameters) sParameters = '' if (len(sParameters) > 0): oRequest = urllib.request.Request(self.__sUrl, sParameters) else: oRequest = urllib.request.Request(self.__sUrl) for aHeader in self.__aHeaderEntries: for sHeaderKey, sHeaderValue in list(aHeader.items()): oRequest.add_header(sHeaderKey, sHeaderValue) sContent = '' try: oResponse = urllib.request.urlopen(oRequest, timeout=30) sContent = oResponse.read() self.__sResponseHeader = oResponse.info() self.__sRealUrl = oResponse.geturl() oResponse.close() except urllib.error.HTTPError as e: if e.code == 503: if cloudflare.CheckIfActive(e.headers): cookies = e.headers['Set-Cookie'] cookies = cookies.split(';')[0] from resources.lib.cloudflare import CloudflareBypass sContent = CloudflareBypass().GetHtml( self.__sUrl, e.read(), cookies) self.__sResponseHeader = '' self.__sRealUrl = '' if not sContent: cConfig().error("%s,%s" % (cConfig().getlanguage(30205), self.__sUrl)) return '' if (self.__bRemoveNewLines == True): sContent = sContent.replace("\n", "") sContent = sContent.replace("\r\t", "") if (self.__bRemoveBreakLines == True): sContent = sContent.replace(" ", "") return sContent
def showEpisode(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sHtmlContent = CloudflareBypass().GetHtml(sUrl) #sHtmlContent = sHtmlContent.replace('\n','') sHtmlContent = sHtmlContent.replace("'",'"') oParser = cParser() #sPattern = "<a class='various' data-fancybox-type='iframe' href='(.+?)' > *(.+?)<\/a>\t*<\/h3>\t*(.+?)<br>" sPattern = ';" src="([^"]+)" class="img-responsive">.+?<a class="various" data-fancybox-type="iframe" href="(.+?)" *> *(.+?)<\/a> *<\/h3>([^<>]+)<' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): SpecHead = CloudflareBypass().GetHeadercookie(sUrl) total = len(aResult[1]) dialog = cConfig().createDialog(SITE_NAME) for aEntry in aResult[1]: cConfig().updateDialog(dialog, total) if dialog.iscanceled(): break sUrl = aEntry[1] if not URL_MAIN in sUrl: sUrl = 'http://www.series-en-streaming.tv' + sUrl sTitle = sMovieTitle + ' ' + aEntry[2] sThumb = aEntry[0] if URL_MAIN in sThumb: sThumb = sThumb + SpecHead sCom = aEntry[3] sDisplayTitle = cUtil().DecoTitle(sTitle) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) oOutputParameterHandler.addParameter('sThumbnail', sThumb) oGui.addTV(SITE_IDENTIFIER, 'showHosters', sDisplayTitle, '', sThumb, sCom, oOutputParameterHandler) cConfig().finishDialog(dialog) else: oGui.addText(SITE_IDENTIFIER, '[COLOR coral]Aucun episode disponible[/COLOR]') oGui.setEndOfDirectory()
def showEpisode(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sHtmlContent = CloudflareBypass().GetHtml(sUrl) sHtmlContent = sHtmlContent.replace('\n', '') #return oParser = cParser() #sPattern = "<a class='various' data-fancybox-type='iframe' href='(.+?)' > *(.+?)<\/a>\t*<\/h3>\t*(.+?)<br>" sPattern = ";\" src=\"(.+?)\" class=\"img-responsive\">.+?<a class='various' data-fancybox-type='iframe' href='(.+?)' *> *(.+?)<\/a>\t*<\/h3>\t*(.+?)<br>" aResult = oParser.parse(sHtmlContent, sPattern) #print aResult if (aResult[0] == True): SpecHead = CloudflareBypass().GetHeadercookie(sUrl) total = len(aResult[1]) dialog = cConfig().createDialog(SITE_NAME) for aEntry in aResult[1]: cConfig().updateDialog(dialog, total) if dialog.iscanceled(): break sTitle = aEntry[2] sThumb = aEntry[0] if URL_MAIN in sThumb: sThumb = sThumb + SpecHead sCom = aEntry[3] #sDisplayTitle = cUtil().DecoTitle(sTitle) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', aEntry[1]) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) oOutputParameterHandler.addParameter('sThumbnail', sThumb) oGui.addTV(SITE_IDENTIFIER, 'showHosters', sTitle, '', sThumb, sCom, oOutputParameterHandler) cConfig().finishDialog(dialog) oGui.setEndOfDirectory()
def showEpisode(): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sHtmlContent = CloudflareBypass().GetHtml(sUrl) sHtmlContent = sHtmlContent.replace('\n','') #return oParser = cParser() #sPattern = "<a class='various' data-fancybox-type='iframe' href='(.+?)' > *(.+?)<\/a>\t*<\/h3>\t*(.+?)<br>" sPattern = ";\" src=\"(.+?)\" class=\"img-responsive\">.+?<a class='various' data-fancybox-type='iframe' href='(.+?)' *> *(.+?)<\/a>\t*<\/h3>\t*(.+?)<br>" aResult = oParser.parse(sHtmlContent, sPattern) #print aResult if (aResult[0] == True): SpecHead = CloudflareBypass().GetHeadercookie(sUrl) total = len(aResult[1]) dialog = cConfig().createDialog(SITE_NAME) for aEntry in aResult[1]: cConfig().updateDialog(dialog, total) if dialog.iscanceled(): break sTitle = aEntry[2] sThumb = aEntry[0] if URL_MAIN in sThumb: sThumb = sThumb + SpecHead sCom = aEntry[3] #sDisplayTitle = cUtil().DecoTitle(sTitle) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', aEntry[1]) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) oOutputParameterHandler.addParameter('sThumbnail', sThumb) oGui.addTV(SITE_IDENTIFIER, 'showHosters', sTitle, '', sThumb, sCom, oOutputParameterHandler) cConfig().finishDialog(dialog) oGui.setEndOfDirectory()