def __getMediaLinkForGuest(self): oParser = cParser() sUrl = util.QuotePlus(self.__sUrl) oRequest = cRequestHandler('%s%s' % (URL_MAIN, sUrl)) sHtmlContent = oRequest.request() sHtmlContent1 = oParser.abParse(sHtmlContent, '<div class="download-box">', '<div class="delimiter"></div>') if not sHtmlContent1: return False, False sPattern = '<div class="button-text"><p>(.+?)</p>.+?<a href="([^"]+)"' aResult = oParser.parse(sHtmlContent1, sPattern) if (aResult[0] == True): #initialisation des tableaux url = [] qua = [] #Remplissage des tableaux for i in aResult[1]: b = re.sub('&title=.+', '', i[1]) #testé xx fois ok url.append(str(b)) qua.append(str(i[0])) #dialogue qualité api_call = dialog().VSselectqual(qua, url) if (api_call): return True, api_call return False, False
def __getMediaLinkForGuest(self): oParser = cParser() sUrl = util.QuotePlus(self.__sUrl) oRequest = cRequestHandler(URL_MAIN + sUrl) sHtmlContent = oRequest.request() sPattern = 'class="al">([^<]+)</td>.+?href="([^"]+)"' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): #initialisation des tableaux url = [] qua = [] #Remplissage des tableaux for i in aResult[1]: url.append(str(i[1])) qua.append(str(i[0])) #dialogue qualité api_call = dialog().VSselectqual(qua, url) if (api_call): return True, api_call return False, False
def __getMediaLinkForGuest(self): oParser = cParser() sUrl = util.QuotePlus(self.__sUrl) oRequest = cRequestHandler('%s%s' % (URL_MAIN,sUrl)) sHtmlContent = oRequest.request() sHtmlContent1 = oParser.abParse(sHtmlContent,'>Download Pro</a></td>','<table class="result-table video-only"') if not sHtmlContent1: return False,False sPattern = '<td class="al".+?">(.+?)</td>.+?<a href="([^"]+)"' aResult = oParser.parse(sHtmlContent1,sPattern) if (aResult[0] == True): # initialisation des tableaux url=[] qua=[] # Replissage des tableaux for i in aResult[1]: b = re.sub('&title=.+','',i[1]) #testé xx fois ok url.append(str(b)) qua.append(str(i[0])) #dialog qualiter api_call = dialog().VSselectqual(qua,url) if (api_call): return True, api_call return False, False
def __getMediaLinkForGuest(self): oParser = cParser() sUrl = util.QuotePlus(self.__sUrl) oRequest = cRequestHandler('%s%s' % (URL_MAIN, sUrl)) sHtmlContent = oRequest.request() sHtmlContent1 = oParser.abParse( sHtmlContent, '>Download Pro</a></td>', '<table class="result-table video-only"') if not sHtmlContent1: return False, False sPattern = '<td class="al".+?">(.+?)</td>.+?<a href="([^"]+)"' aResult = oParser.parse(sHtmlContent1, sPattern) if (aResult[0] == True): # initialisation des tableaux url = [] qua = [] # Replissage des tableaux for i in aResult[1]: b = re.sub('&title=.+', '', i[1]) #testé xx fois ok url.append(str(b)) qua.append(str(i[0])) # Si une seule url if len(url) == 1: api_call = url[0] # si plus de une elif len(url) > 1: # Afichage du tableau ret = util.VScreateDialogSelect(qua) if (ret > -1): api_call = url[ret] if (api_call): return True, api_call return False, False
def __getMediaLinkForGuest(self): oParser = cParser() sUrl = util.QuotePlus(self.__sUrl) oRequest = cRequestHandler('%s%s' % (URL_MAIN, sUrl)) sHtmlContent = oRequest.request() sPattern = 'Full Video<\/dt>(.+?)Video Only<\/dt><dd>' sHtmlContent2 = re.search(sPattern, sHtmlContent, re.DOTALL) if not sHtmlContent2: return False, False sPattern = '<a href="([^"]+)".+?alt=""/>([^<]+)<\/span>' aResult = oParser.parse(sHtmlContent2.group(1), sPattern) if (aResult[0] == True): # initialisation des tableaux url = [] qua = [] # Replissage des tableaux for i in aResult[1]: b = re.sub('&title=.+', '', i[0]) #testé xx fois ok url.append(str(b)) qua.append(str(i[1])) # Si une seule url if len(url) == 1: api_call = url[0] # si plus de une elif len(url) > 1: # Afichage du tableau ret = util.VScreateDialogSelect(qua) if (ret > -1): api_call = url[ret] if (api_call): return True, api_call return False, False