Exemple #1
0
    def __getMediaLinkForGuest(self):
        Token_Alldebrid = cPremiumHandler(
            self.getPluginIdentifier()).getToken()
        if Token_Alldebrid:
            sUrl_Bypass = "******" + Token_Alldebrid + "&link=" + self.__sUrl
        else:
            return False, False

        oRequest = cRequestHandler(sUrl_Bypass)
        sHtmlContent = json.loads(oRequest.request())

        if 'error' in sHtmlContent:
            if sHtmlContent['error']['code'] == 'LINK_HOST_NOT_SUPPORTED':
                return False, self.__sUrl  # si alldebrid ne prend pas en charge ce type de lien, on retourne le lien pour utiliser un autre hoster
            else:
                VSlog('Hoster Alldebrid - Error: ' +
                      sHtmlContent["error"]['code'])
                return False, False

        api_call = HostURL = sHtmlContent["data"]["link"]
        try:
            mediaDisplay = HostURL.split('/')
            VSlog('Hoster Alldebrid - play : %s/ ... /%s' %
                  ('/'.join(mediaDisplay[0:3]), mediaDisplay[-1]))
        except:
            VSlog('Hoster Alldebrid - play : ' + HostURL)

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

        return False, False
Exemple #2
0
    def getMediaLink(self):
        self.oPremiumHandler = cPremiumHandler(self.getPluginIdentifier())
        if (self.oPremiumHandler.isPremiumModeAvailable()):
            ADDON = addon()

            try:
                mDefault = int(ADDON.getSetting("hoster_uptobox_mode_default"))
            except AttributeError:
                mDefault = 0

            if mDefault == 0:
                ret = dialog().VSselect([
                    'Passer en Streaming (via Uptostream)',
                    'Rester en direct (via Uptobox)'
                ], 'Choissisez votre mode de fonctionnement')
            else:
                # 0 is ask me, so 1 is uptostream and so on...
                ret = mDefault - 1

            # mode stream
            if ret == 0:
                return self.__getMediaLinkForGuest()
            # mode DL
            if ret == 1:
                return self.__getMediaLinkByPremiumUser()

            return False

        else:
            VSlog('UPTOBOX - no premium')
            return self.__getMediaLinkForGuest()
Exemple #3
0
    def getMediaLink(self):

        self.oPremiumHandler = cPremiumHandler(self.getPluginIdentifier())
        print(self.oPremiumHandler.isPremiumModeAvailable())

        if (not self.oPremiumHandler.isPremiumModeAvailable()):
            oDialog = dialog().VSok('ATTENTION, Pas de streaming sans premium.')
            return False, False

        return self.__getMediaLinkByPremiumUser()
Exemple #4
0
    def getMediaLink(self):

        self.oPremiumHandler = cPremiumHandler(self.getPluginIdentifier())
        print(self.oPremiumHandler.isPremiumModeAvailable())

        import sys
        if ('site=cDownload&function' not in sys.argv[2]
            ) and not (self.oPremiumHandler.isPremiumModeAvailable()):
            oDialog = dialog().VSok(
                "Pas de streaming sans premium.\nPour voir le film passer par l'option 'Télécharger et Lire' du menu contextuel."
            )
            return False, False

        if (self.oPremiumHandler.isPremiumModeAvailable()):
            return self.__getMediaLinkByPremiumUser()

        return self.__getMediaLinkForGuest()
Exemple #5
0
    def getMediaLink(self):
        self.oPremiumHandler = cPremiumHandler('uptobox')
        premium = self.oPremiumHandler.isPremiumModeAvailable()
        api_call = False
        SubTitle = ""

        if premium:
            self.oPremiumHandler.Authentificate()
        else:
            dialog().VSok('Ce hoster demande un login, meme gratuit.')
            return False, False

        cookies = GestionCookie().Readcookie("uptobox")
        import requests, re

        s = requests.Session()
        s.headers.update({"Cookie": cookies})

        r = s.get('https://uptobox.com/api/streaming?file_code=' +
                  self.__sUrl.split('/')[3]).json()

        r1 = s.get(r["data"]["user_url"]).text
        tok = re.search('token.+?;.+?;(.+?)&', r1).group(1)

        r1 = s.post("https://uptobox.com/api/user/pin/validate?token=" + tok,
                    json={
                        "pin": r["data"]["pin"]
                    }).json()
        s.headers.update(
            {"Referer": "https://uptobox.com/pin?pin=" + r["data"]["pin"]})

        r = s.get(r["data"]["check_url"]).json()["data"]

        sPattern = "'(.+?)': {(.+?)}"

        oParser = cParser()
        aResult = oParser.parse(r["streamLinks"], sPattern)
        from Plugins.Extensions.IPTVPlayer.tsiplayer.addons.resources.lib.comaddon import dialog

        url = []
        qua = []
        api_call = False

        for aEntry in aResult[1]:
            QUAL = aEntry[0]
            d = re.findall("'u*(.+?)': u*'(.+?)'", aEntry[1])
            for aEntry1 in d:
                url.append(aEntry1[1])
                qua.append(QUAL + ' (' + aEntry1[0] + ')')

        # Affichage du tableau
        api_call = dialog().VSselectqual(qua, url)

        SubTitle = self.checkSubtitle(r["subs"])

        if (api_call):
            if SubTitle:
                return True, api_call, SubTitle
            else:
                return True, api_call

        return False, False
Exemple #6
0
    def getMediaLink(self):
        self.oPremiumHandler = cPremiumHandler('uptobox')
        premium = self.oPremiumHandler.isPremiumModeAvailable()
        api_call = False
        SubTitle = ""

        if premium:
            self.oPremiumHandler.Authentificate()
        else:
            dialog().VSok('Ce hoster demande un login, meme gratuit.')
            return False, False

        cookies = GestionCookie().Readcookie("uptobox")

        s = requests.Session()
        s.headers.update({"Cookie": cookies})

        r = s.get('https://uptobox.com/api/streaming?file_code=' +
                  self.__sUrl.split('/')[-1]).json()

        if r["statusCode"] != 0:  # Erreur
            dialog().VSinfo(r["data"])
            return False, False

        r1 = s.get(r["data"]["user_url"]).text
        tok = re.search('token.+?;.+?;(.+?)&', r1).group(1)

        if not xbmc.getCondVisibility('system.platform.android'):
            # Si possible on ouvre la page automatiquement dans un navigateur internet.
            import webbrowser
            webbrowser.open(r['data']['user_url'])
            with CountdownDialog(
                    "Autorisation nécessaire",
                    "Pour voir cette vidéo, veuillez vous connecter",
                    "Allez sur ce lien : " + r['data']['user_url'],
                    "Et valider le pin : " + r['data']['pin'], True,
                    r["data"]['expired_in'], 10) as cd:
                js_result = cd.start(self.__check_auth,
                                     [r["data"]["check_url"]])["data"]
        else:
            from resources.lib import pyqrcode

            qr = pyqrcode.create(r['data']['user_url'])
            qr.png(
                'special://home/userdata/addon_data/plugin.video.vstream/qrcode.png',
                scale=5)
            oSolver = cInputWindowYesNo(
                captcha=
                'special://home/userdata/addon_data/plugin.video.vstream/qrcode.png',
                msg="Scanner le QRCode pour acceder au lien d'autorisation",
                roundnum=1)
            retArg = oSolver.get()
            DIALOG = dialog()
            if retArg == "N":
                return False

            js_result = s.get(r["data"]["check_url"]).json()["data"]

        #Deux modes de fonctionnement different.
        if js_result.get("streamLinks").get('src'):
            api_call = js_result['streamLinks']['src']
        else:
            sPattern = "'(.+?)': {(.+?)}"

            oParser = cParser()
            aResult = oParser.parse(js_result["streamLinks"], sPattern)

            url = []
            qua = []
            api_call = False

            for aEntry in aResult[1]:
                QUAL = aEntry[0]
                d = re.findall("'u*(.+?)': u*'(.+?)'", aEntry[1])
                for aEntry1 in d:
                    url.append(aEntry1[1])
                    qua.append(QUAL + ' (' + aEntry1[0] + ')')

            # Affichage du tableau
            api_call = dialog().VSselectqual(qua, url)

        try:
            SubTitle = self.checkSubtitle(js_result["subs"])
        except:
            VSlog("Pas de sous-titre")

        if (api_call):
            if SubTitle:
                return True, api_call, SubTitle
            else:
                return True, api_call

        return False, False