Example #1
0
    def __getMediaLinkForGuest(self):

        oRequest = cRequestHandler(self.__sUrl)
        oRequest.addHeaderEntry('User-Agent', UA)
        sHtmlContent = oRequest.request()

        oParser = cParser()

        api_call = ''

        aResult = re.search('>(゚ω゚.+?\(\'_\'\);)', sHtmlContent,
                            re.DOTALL | re.UNICODE)
        if (aResult):
            JP = JsParser()
            Liste_var = []

            JScode = aResult.group(1)
            JScode = unicode(JScode, "utf-8")

            sHtmlContent = JP.ProcessJS(JScode, Liste_var)
            sHtmlContent = JP.LastEval.decode('string-escape').decode(
                'string-escape')

            Url = re.findall("href = '(.+?)'", sHtmlContent)[0]

            if not 'speedvid' in Url:
                Url = 'http://www.speedvid.net/' + Url
            if not 'http' in Url:
                if Url.startswith('//'):
                    Url = 'http:' + Url
                else:
                    Url = 'http://' + Url

            oRequest = cRequestHandler(Url)
            oRequest.addHeaderEntry('Referer', self.__sUrl)
            oRequest.addHeaderEntry('User-Agent', UA)
            sHtmlContent = oRequest.request()

        sPattern = '(eval\(function\(p,a,c,k,e(?:.|\s)+?\)\))<'
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            for packed in aResult[1]:
                if 'vplayer' in packed:
                    sHtmlContent = cPacker().unpack(packed)
                    sHtmlContent = sHtmlContent.replace('\\', '')

                    sPattern2 = "{file:.([^']+.mp4)"
                    aResult2 = oParser.parse(sHtmlContent, sPattern2)
                    if (aResult2[0] == True):
                        api_call = aResult2[1][0]

        if (api_call):
            api_call = api_call + '|User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0'
            return True, api_call

        return False, False
Example #2
0
def CheckAADecoder(data):
    aResult = re.search('(゚ω゚.+?\(\'_\'\);)', data, re.DOTALL | re.UNICODE)
    if (aResult):
        VSlog('AA encryption')

        JP = JsParser()
        data = JP.ProcessJS(aResult.group(1))
        data = literal_eval("b'{}'".format(data)).decode('unicode_escape')
        return data

    return data
Example #3
0
def CheckAADecoder(str):
    aResult = re.search('([>;]\s*)(゚ω゚.+?\(\'_\'\);)', str, re.DOTALL | re.UNICODE)
    if (aResult):
        VSlog('AA encryption')

        #tmp = aResult.group(1) + AADecoder(aResult.group(2)).decode()

        JP = JsParser()
        Liste_var = []

        try:
            JScode = aResult.group(2)
            JScode = unicode(JScode, "utf-8")

            tmp = JP.ProcessJS(JScode, Liste_var)
            tmp = JP.LastEval.decode('string-escape').decode('string-escape')

            return str[:aResult.start()] + tmp + str[aResult.end():]
        except:
            return ''
    return str
    def __getMediaLinkForGuest(self):

        oParser = cParser()

        #recuperation de la page
        #xbmc.log('url teste : ' + self.__sUrl)
        oRequest = cRequestHandler(self.__sUrl)
        oRequest.addHeaderEntry('referer', self.__sUrl)
        oRequest.addHeaderEntry('User-Agent', UA)
        sHtmlContent1 = oRequest.request()

        #fh = open('c:\\test.txt', "w")
        #fh.write(sHtmlContent1)
        #fh.close()

        #Recuperation url cachee
        TabUrl = []
        #sPattern = '<span style="".+?id="([^"]+)">([^<]+)<\/span>'
        sPattern = '<p id="([^"]+)" *style=\"\">([^<]+)<\/p>'
        aResult = re.findall(sPattern, sHtmlContent1)
        if not aResult:
            sPattern = '<p style="" *id="([^"]+)" *>([^<]+)<\/p>'
            aResult = re.findall(sPattern, sHtmlContent1)
        if (aResult):
            TabUrl = aResult
        else:
            VSlog('OPL er 1')
            return False, False

        #xbmc.log("Nbre d'url : " + str(len(TabUrl)))

        #on essait de situer le code
        sPattern = '<script src="\/assets\/js\/video-js\/video\.js.+?.js"(.+)*'

        aResult = re.findall(sPattern, sHtmlContent1, re.DOTALL)
        if (aResult):
            sHtmlContent3 = aResult[0]
        else:
            VSlog('OPL er 2')
            return False, False

        #Deobfuscation, a optimiser pour accelerer le traitement
        code = ''
        maxboucle = 4
        while (maxboucle > 0):
            sHtmlContent3 = CheckCpacker(sHtmlContent3)
            sHtmlContent3 = CheckJJDecoder(sHtmlContent3)
            sHtmlContent3 = CheckAADecoder(sHtmlContent3)

            maxboucle = maxboucle - 1

        code = sHtmlContent3

        #fh = open('c:\\html.txt', "w")
        #fh.write(code)
        #fh.close()

        id_final = ""
        sPattern = 'var srclink.*?\/stream\/.*?(#[^\'"]+).*?mime=true'
        aResult = re.findall(sPattern, code)
        if (aResult):
            id_final = aResult[0]
        else:
            VSlog('OPL er 9')
            return False, False

        if not (code):
            VSlog('OPL er 3')
            return False, False

        #Search the coded url
        Coded_url = ''
        for i in TabUrl:
            if len(i[1]) > 30:
                Coded_url = i[1]
                Item_url = '#' + i[0]
                VSlog( Item_url + ' : ' + Coded_url )

        if not(Coded_url):
            VSlog('Url codée non trouvée')
            return False, False

        #Nettoyage du code pr traitement
        code = CleanCode(code, Coded_url)

        #fh = open('c:\\JS.txt', "w")
        #fh.write(code)
        #fh.close()

        VSlog('Code JS extrait')

        dialog().VSinfo('Décodage: Peut durer plus d\'une minute.', self.__sDisplayName, 15)

        #interpreteur JS
        JP = JsParser()
        Liste_var = []
        JP.AddHackVar(Item_url, Coded_url)

        JP.ProcessJS(code, Liste_var)

        url = None
        #for name in [ '#streamurl', '#streamuri', '#streamurj']:
        #    if JP.IsVar( JP.HackVars, name ):
        #        url = JP.GetVarHack( name )
        #        VSlog( 'Decoded url ' + name + ' : ' + url )
        #        break
        url = JP.GetVarHack(id_final)

        if not(url):
            VSlog('Rate, debug: ' + str(Liste_var))
            return False, False

        dialog().VSinfo('Ok, lien décodé.', self.__sDisplayName, 15)

        api_call = self.__getHost() + "/stream/" + url + "?mime=true"

        if '::' in api_call:
            dialog().VSinfo('Possible problème d\'ip V6', self.__sDisplayName, 5)
            xbmc.sleep(5*1000)

        VSlog(api_call)

        if (api_call):
            return True, api_call

        return False, False
Example #5
0
    def __getMediaLinkForGuest(self):
        oRequest = cRequestHandler(self.__sUrl)
        oRequest.addHeaderEntry('User-Agent', UA)
        sHtmlContent = oRequest.request()
        sHtmlContent = re.sub(r'<!--.*?-->', '', sHtmlContent)

        oParser = cParser()

        api_call = ''

        aResult = re.search('>\s*(゚ω゚.+?\(\'_\'\);)', sHtmlContent,
                            re.DOTALL | re.UNICODE)

        if (aResult):
            JP = JsParser()
            Liste_var = []

            JScode = aResult.group(1)
            JScode = unicode(JScode, "utf-8")

            sHtmlContent = JP.ProcessJS(JScode, Liste_var)
            sHtmlContent = JP.LastEval.decode('string-escape').decode(
                'string-escape')

            Url = re.findall("href = '(.+?)'", sHtmlContent)[0]

            if not 'speedvid' in Url:
                Url = 'http://www.speedvid.net/' + Url
            if not 'http' in Url:
                if Url.startswith('//'):
                    Url = 'http:' + Url
                else:
                    Url = 'http://' + Url

            oRequest = cRequestHandler(Url)
            oRequest.addHeaderEntry('Referer', self.__sUrl)
            oRequest.addHeaderEntry('User-Agent', UA)
            sHtmlContent = oRequest.request()
        """
        --> Le lien de la vidéo est maintenant ecrit directement dans le source.
        --> Alors je ne me permet pas de supprimer ce code, et pourrait-être
        --> utile dans le cas d'un future changement du site.

        sPattern = '(eval\(function\(p,a,c,k,e(?:.|\s)+?\)\))<'
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            for packed in aResult[1]:
                if 'vplayer' in packed:
                    sHtmlContent = cPacker().unpack(packed)
                    sHtmlContent = sHtmlContent.replace('\\','')
 
                    sPattern2 = "{file:.([^']+.mp4)"
                    aResult2 = oParser.parse(sHtmlContent, sPattern2)
                    if (aResult2[0] == True):
                        api_call = aResult2[1][0]
        """
        #cConfig().log( sHtmlContent )
        sPattern = "file\s*:\s*\'([^\']+.mp4)"
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            api_call = aResult[1][0]

        cConfig().log('API_CALL: ' + api_call)

        if (api_call):
            #api_call = api_call + '|User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0'
            api_call = api_call + '|User-Agent=' + UA
            return True, api_call

        return False, False