Esempio n. 1
0
    def __getMediaLinkForGuest(self):

        oParser = cParser()
        oRequest = cRequestHandler(self.__sUrl)
        sHtmlContent = oRequest.request()

        sPattern = '([^"]+\.mp4)'
        oParser = cParser()
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            #initialisation des tableaux
            url = []
            qua = ["HD", "SD"]  #bidouille evite m3u8
            api_call = ''

            #Replissage des tableaux
            for i in aResult[1]:
                url.append(str(i))

            #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
Esempio n. 2
0
    def __getMediaLinkForGuest(self):

        qua = []
        url = []
        api_call = ''

        oRequest = cRequestHandler(self.__sUrl)
        sHtmlContent = oRequest.request()
        sPattern = '((?:h|s)d)_src:"([^"]+)"'
        oParser = cParser()
        aResult = oParser.parse(sHtmlContent, sPattern)

        if (aResult[0] == True):
            for aEntry in aResult[1]:
                qua.append(str(aEntry[0]))
                url.append(str(aEntry[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
Esempio n. 3
0
    def __getMediaLinkForGuest2(self):

        oRequestHandler = cRequestHandler(self.__sUrl)
        sHtml = oRequestHandler.request()

        try:
            #note doit etre '{'sHtmlcontent'}'  | 18 premier '{'
            player_conf = sHtml[18 + sHtml.find("ytplayer.config = "):sHtml.
                                find(";ytplayer.load =")]
            bracket_count = 0
            for i, char in enumerate(player_conf):
                if char == "{":
                    bracket_count += 1
                elif char == "}":
                    bracket_count -= 1
                    if bracket_count == 0:
                        break
            else:
                util.VSlog("Cannot get JSON from HTML")

            index = i + 1
            data = json.loads(player_conf[:index])

        except Exception as e:
            util.VSlog("Cannot decode JSON: {0}" + str(e))

        stream_map = parse_stream_map(
            data["args"]["url_encoded_fmt_stream_map"])

        if not (stream_map == False):
            video_urls = zip(stream_map["url"], stream_map["quality"])
            # initialisation des tableaux
            url = []
            qua = []
            # Replissage des tableaux
            for i in video_urls:
                url.append(str(i[0]))
                qua.append(str(i[1]))
            # Si une seule url
            if len(url) == 1:
                return True, url[0]
            # si plus de une
            elif len(url) > 1:
                # Afichage du tableau
                ret = util.VScreateDialogSelect(qua)
                if (ret > -1):
                    return True, url[ret]
        else:
            return False
Esempio n. 4
0
    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
Esempio n. 5
0
    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