def search(self, **kwargs): #debut grab oRequest = cRequestHandler('https://disneyhd.tk/movies_list.php') oRequest.addHeaderEntry('User-Agent', UA) sHtmlContent = oRequest.request() oParser = cParser() sPattern = 'href="([^"]+)" title="([^"]+)"><img src="([^"]+)"' aResult = oParser.parse(sHtmlContent, sPattern) #dest = [] if (aResult[0] == True): for aEntry in aResult[1]: sTitle = aEntry[1] #hum pas convincu #if kwargs['title'].lower() in sTitle.lower(): #calcul de similariter du titre en test if self.similar(kwargs['title'], sTitle): sUrl = URL_MAIN + aEntry[0] sQual, url = getFinalUrl(sUrl) for qual, sUrl1 in zip(sQual, url): #extra = {"source":{'title' : sTitle,"url":sUrl1,"qual":qual}} #dest.append((d1)) #dest.append((extra)) self.setSource(sTitle, sUrl1, qual)
def getFinalUrl(sUrl, qual=''): oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() #Recuperer variable pour url de base aResult1 = re.findall('id=.+?trembed=([^"]+)(?:"|") frameborder', str(sHtmlContent)) url = [] sQual = [] for aEntry in aResult1: site = URL_MAIN + "?trembed=" + aEntry.replace('#038;', '').replace( 'amp;', '') oRequestHandler = cRequestHandler(site) sHtmlContent = oRequestHandler.request() #Recuperation de l'url suivante aResult2 = re.search('<div class="Video"><iframe.+?src="([^"]+)"', str(sHtmlContent)).group(1) Url = ''.join(aResult2) oRequestHandler = cRequestHandler(Url) sHtmlContent = oRequestHandler.request() #Recuperation de l'id aResult3 = re.search("var id.+?'(.+?)'", str(sHtmlContent)).group(1).replace('\\', '') sPost = ''.join(aResult3)[::-1] sUrl1 = URL_MAIN + '?trhidee=1&trfex=' + sPost oRequestHandler = cRequestHandler(sUrl1) oRequestHandler.addHeaderEntry('Referer', Url) sHtmlContent = oRequestHandler.request() sHosterUrl = oRequestHandler.getRealUrl() if 'public/dist' in sHosterUrl: sHosterUrl = 'https://' + sHosterUrl.split( '/')[2] + '/hls/' + sHosterUrl.split('id=')[ 1] + '/' + sHosterUrl.split('id=')[1] + '.playlist.m3u8' url.append(sHosterUrl) sQual.append(qual) return sQual, url
def getJson2(title): oRequest = cRequestHandler(URL_MAIN + 'search/' + title) oRequest.addHeaderEntry('User-Agent', UA) sHtmlContent = oRequest.request() oParser = cParser() sPattern = 'class="TPost C">.+?href="([^"]+)">.+?<img.+?src="([^"]+)".+?<h3 class="Title">([^<]+)</h3> .+?class="Qlty">([^<]+)<' aResult = oParser.parse(sHtmlContent, sPattern) d1 = {"plugin": SITE_NAME} dest = [] if (aResult[0] == True): url = [] qua = [] for aEntry in aResult[1]: sUrl = aEntry[0] qual = aEntry[3] sTitle = aEntry[2] sQual, url = getFinalUrl(sUrl, qual) for qual, sUrl in zip(sQual, url): qua, Url = checkHoster(sUrl) if qua == True: qua = sQual if Url == False: continue else: #Si plus d'un url if type(Url) is list: for qua1, Url1 in zip(qua, Url): extra = ({ "source": { 'title': sTitle, "url": Url1, "qual": qua1 } }) dest.append((d1)) dest.append((extra)) else: extra = ({ "source": { 'title': sTitle, "url": Url, "qual": qua[0] } }) dest.append((d1)) dest.append((extra)) JSON = json.dumps(dest) return JSON
def getMediaLinkForGuest(sUrl): api_call = sUrl #full moviz lien direct final nowvideo if 'zerocdn.to' in api_call: UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0' api_call = api_call + '|User-Agent=' + UA #Special pour mangacity if 'pixsil' in api_call: api_call = api_call.split('|')[0] + '|Referer=http://www.mangacity.org/jwplayer/player.swf' #Modif pr aliez if 'aplayer1.me' in api_call: UA = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0' api_call = api_call + '|User-Agent=' + UA if 'sport7' in api_call: UA= 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0' api_call = api_call + '|User-Agent=' + UA + '&referer=' + sUrl #Special pour hd-stream.in et film-streaming.co if 'playlist.m3u8' in api_call: base = re.sub(r'(playlist.m3u8*.+)', '', api_call) oRequest = cRequestHandler(api_call) sHtmlContent = oRequest.request() sPattern = ',NAME="([^"]+)".+?(chunklist.+?.m3u8)' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): #initialisation des tableaux url=[] qua=[] api_call = '' #Remplissage des tableaux for i in aResult[1]: url.append(str(i[1])) qua.append(str(i[0])) if (api_call): return True, api_call return False, False
def search(self, **kwargs): oRequest = cRequestHandler(URL_MAIN + 'search/' + kwargs['title']) oRequest.addHeaderEntry('User-Agent', UA) sHtmlContent = oRequest.request() oParser = cParser() sPattern = 'class="TPost C">.+?href="([^"]+)">.+?<img.+?src="([^"]+)".+?<h3 class="Title">([^<]+)</h3> .+?class="Qlty">([^<]+)<' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): url = [] qua = [] for aEntry in aResult[1]: sUrl = aEntry[0] qual = aEntry[3] sTitle = aEntry[2] if self.similar(kwargs['title'], sTitle): sQual, url = getFinalUrl(sUrl, qual) for qual, sUrl in zip(sQual, url): qua, Url = checkHoster(sUrl) if qua == True: qua = sQual if Url == False: continue else: #Si plus d'un url if type(Url) is list: for qua1, Url1 in zip(qua, Url): self.setSource(sTitle, Url1, qua1) else: self.setSource(sTitle, Url, qua[0])
def getMediaLinkForGuest(sUrl): oParser = cParser() oRequest = cRequestHandler(sUrl) oRequest.addHeaderEntry( 'User-Agent', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0' ) oRequest.addHeaderEntry('Referer', sUrl) sHtmlContent = oRequest.request() sPattern = '<source src="([^"]+)" type="video/.+?" label="([^"]+)"' aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): url = [] qua = [] for i in aResult[1]: url.append(str(i[0])) qua.append(str(i[1])) return qua, url return False, False
def getFinalUrl(sUrl): oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() if '<ol id="playlist">' in str(sHtmlContent): aResult = re.findall('<li data-trackurl="([^"]+)">(.+?)<\/li>', str(sHtmlContent)) elif 'data-ws=' in str(sHtmlContent): aResult = re.findall('data-ws="([^"]+)">(.+?)</span>', str(sHtmlContent)) else: aResult = re.findall( '<span class="qualiteversion" data-qualurl="([^"]+)">([^"]+)</span>', str(sHtmlContent)) url = [] sQual = [] for aEntry in aResult: url.append(aEntry[0]) sQual.append(aEntry[1]) return sQual, url
def getJson2(title): print(title, 'diney') oRequest = cRequestHandler('https://disneyhd.tk/movies_list.php') oRequest.addHeaderEntry('User-Agent', UA) sHtmlContent = oRequest.request() oParser = cParser() sPattern = 'href="([^"]+)" title="([^"]+)"><img src="([^"]+)"' aResult = oParser.parse(sHtmlContent, sPattern) d1 = {"plugin": SITE_NAME} dest = [] if (aResult[0] == True): for aEntry in aResult[1]: sTitle = aEntry[1] if title.lower() in sTitle.lower(): sUrl = URL_MAIN + aEntry[0] sQual, url = getFinalUrl(sUrl) for qual, sUrl1 in zip(sQual, url): extra = { "source": { 'title': sTitle, "url": sUrl1, "qual": qual } } dest.append((d1)) dest.append((extra)) JSON = json.dumps(dest) return JSON