Esempio n. 1
0
    def __getMediaLinkForGuest(self):
        api_call = ''

        oParser = cParser()
        oRequestHandler = cRequestHandler(URL_MAIN + self.__sUrl)
        sHtml = Unquote(oRequestHandler.request())
        sHtmlContent = sHtml[7 + sHtml.find('formats'):sHtml.
                             rfind('adaptiveFormats')]
        sPattern = '"url":"([^"]+)".+?"qualityLabel":"([^"]+)"'
        aResult = oParser.parse(sHtmlContent, sPattern)

        if (aResult[0] == True):
            url = []
            qua = []
            for aEntry in aResult[1]:
                #Py3 a besoin de la deuxieme version, je laisse le 1er replace au cas où pour Py2
                url.append(aEntry[0].replace("\u0026",
                                             "&").replace("\\u0026", "&"))
                qua.append(aEntry[1])

            if url:
                if self.__res:
                    for i in range(len(qua)):
                        if qua[i] == self.__res:
                            api_call = url[i]
                if not api_call:
                    api_call = dialog().VSselectqual(qua, url)

        if api_call:
            return True, api_call
        else:
            return False
Esempio n. 2
0
    def __handle_unescape(self, key):
        start = 0
        while True:
            start_js = self.js
            offset = self.js.find(key, start)
            if offset == -1:
                break

            offset += len(key)
            expr = ''
            extra = ''
            last_c = self.js[offset - 1]
            abort = False
            for i, c in enumerate(self.js[offset:]):
                extra += c
                if c == ')':
                    break
                elif (i > 0 and c == '(') or (c == '[' and last_c != '+'):
                    abort = True
                    break
                elif c == '%' or c in string.hexdigits:
                    expr += c
                last_c = c

            if not abort:
                self.js = self.js.replace(key + extra, Unquote(expr))

                if start_js == self.js:
                    break
            else:
                start = offset
 def getValue(self, sParamName):
     if self.exist(sParamName):
         sParamValue = self.__aParams[sParamName]
         if not sParamValue.startswith('http'):
             return UnquotePlus(sParamValue)
         else:
             return Unquote(sParamValue)
     return False
Esempio n. 4
0
def ICDecode(html):

    # if 'HTML/JavaScript Encoder' not in html:
    #     return html

    import math

    sPattern = 'language=javascript>c="([^"]+)";eval\(unescape\("([^"]+)"\)\);x\("([^"]+)"\);'
    aResult = re.findall(sPattern, html)

    if not aResult:
        return html

    c = aResult[0][0]
    # a = aResult[0][1]
    x = aResult[0][2]

    # premier decodage
    d = ''
    i = 0
    while i < len(c):
        if (i % 3 == 0):
            d = d + '%'
        else:
            d = d + c[i]
        i = i + 1

    # Recuperation du tableau
    aResult = re.findall('t=Array\(([0-9,]+)\);', Unquote(d))
    if not aResult:
        return ''

    t = aResult[0].split(',')
    l = len(x)
    b = 1024
    i = p = s = w = 0
    j = math.ceil(float(l) / b)
    r = ''

    while j > 0:

        i = min(l, b)
        while i > 0:
            w |= int(t[ord(x[p]) - 48]) << s
            p = p + 1
            if s:
                r = r + chr(165 ^ w & 255)
                w >>= 8
                s = s - 2
            else:
                s = 6

            i = i - 1
            l = l - 1

        j = j - 1

    return str(r)
Esempio n. 5
0
    def _cleanstr(self, str):
        str = str.strip()
        if str.find("function") == 0:
            pattern = (r"=\"([^\"]+).*}\s*\((\d+)\)")
            args = re.search(pattern, str, re.DOTALL)
            if args:
                a = args.groups()

                def openload_re(match):
                    c = match.group(0)
                    b = ord(c) + int(a[1])
                    return chr(b if (90 if c <= "Z" else 122) >= b else b - 26)

                str = re.sub(r"[a-zA-Z]", openload_re, a[0])
                str = Unquote(str)

        elif str.find("decodeURIComponent") == 0:
            str = re.sub(r"(^decodeURIComponent\s*\(\s*('|\"))|(('|\")\s*\)$)",
                         "", str)
            str = Unquote(str)
        elif str.find("\"") == 0:
            str = re.sub(r"(^\")|(\"$)|(\".*?\")", "", str)
        elif str.find("'") == 0:
            str = re.sub(r"(^')|('$)|('.*?')", "", str)

        return str
Esempio n. 6
0
    def __getMediaLinkForGuest(self):
        api_call = ''

        oParser = cParser()

        oRequestHandler = cRequestHandler(self.__sUrl)
        oRequestHandler.addHeaderEntry(
            'User-Agent',
            'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
        )
        oRequestHandler.addHeaderEntry('Cookie',
                                       GestionCookie().Readcookie("youtube"))
        sHtml = Unquote(str(oRequestHandler.request()))

        sHtmlContent = sHtml[7 + sHtml.find('formats'):sHtml.
                             rfind('adaptiveFormats')]

        sPattern = '"url":"([^"]+)".+?"qualityLabel":"([^"]+)"'
        aResult = oParser.parse(sHtmlContent, sPattern)

        if (aResult[0] == True):
            url = []
            qua = []
            for aEntry in aResult[1]:
                #Py3 a besoin de la deuxieme version, je laisse le 1er replace au cas où pour Py2
                url.append(aEntry[0].replace('/&', '&').replace(
                    "\u0026", "&").replace("\\\\u0026", "&"))
                qua.append(aEntry[1])

            if url:
                if self.__res:
                    for i in range(len(qua)):
                        if qua[i] == self.__res:
                            api_call = url[i]
                if not api_call:
                    api_call = dialog().VSselectqual(qua, url)

        if api_call:
            return True, api_call
        else:
            return False
Esempio n. 7
0
    def __getMediaLinkForGuest(self):
        api_call = ''
        UA = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36'

        oParser = cParser()

        headers = {'User-Agent': UA}
        sHtml = Unquote(
            requests.get(self.__sUrl,
                         cookies={
                             'CONSENT': GestionCookie().Readcookie("youtube")
                         },
                         headers=headers).text)

        sHtmlContent = self.deescape(
            sHtml[7 + sHtml.find('formats'):sHtml.rfind('adaptiveFormats')])
        sPattern = '"url":"([^"]+)".+?"qualityLabel":"([^"]+)"'
        aResult = oParser.parse(sHtmlContent, sPattern)

        if (aResult[0] == True):
            url = []
            qua = []
            for aEntry in aResult[1]:
                # Py3 a besoin de la deuxieme version, je laisse le 1er replace au cas où pour Py2
                url.append(aEntry[0].replace('/&', '&').replace(
                    "\\\\u0026", "&").replace("\u0026", "&"))
                qua.append(aEntry[1])

            if url:
                if self.__res:
                    for i in range(len(qua)):
                        if qua[i] == self.__res:
                            api_call = url[i]
                if not api_call:
                    api_call = dialog().VSselectqual(qua, url)

        if api_call:
            return True, api_call
        else:
            return False
Esempio n. 8
0
def enregistrement():  # Code qui gerent l'epg
    # oGuiElement = cGuiElement()
    oInputParameterHandler = cInputParameterHandler()
    sUrl = oInputParameterHandler.getValue('siteUrl').replace('P_L_U_S', '+')

    enregistrementIsActif = ADDON.getSetting('enregistrement_activer')
    if enregistrementIsActif == 'false':
        dialog().VSok('Merci d\'activer l\'enregistrement dans les options')
        return

    if '[' in sUrl and ']' in sUrl:
        sUrl = GetRealUrl(sUrl)

    if 'plugin' in sUrl:
        url = re.findall('url=(.+?)&amp', ''.join(sUrl))
        sUrl = Unquote(url[0])
    cEnregistremement().programmation_enregistrement(sUrl)
Esempio n. 9
0
    def __getMediaLinkForGuest(self):

        api_call = ''
        oParser = cParser()

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

        sPattern = 'CreatePlayer.+?v=(.+?)&tp'

        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            api_call = Unquote(aResult[1][0])

        if (api_call):
            return True, api_call + '|User-Agent=' + UA + '&Referer=' + self.__sUrl

        return False, False
Esempio n. 10
0
def Display_protected_link():
    oGui = cGui()
    oInputParameterHandler = cInputParameterHandler()
    sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
    sUrl = oInputParameterHandler.getValue('siteUrl')
    sThumb = oInputParameterHandler.getValue('sThumb')

    # Passage avec requests car la protection a tendance a ne pas fonctionner correctement
    # Solution pas encore touver

    payload = "folder=Continuer"
    headers = {
        'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0',
        'Content-Type': 'application/x-www-form-urlencoded',
        'Content-Length': '16'
    }

    r = requests.post(sUrl.replace('http:', 'https:'),
                      headers=headers,
                      data=payload)
    sHtmlContent = r.content

    oParser = cParser()
    sPattern = '<li style="list-style-type.+?<a href="([^"]+)"'
    aResult = oParser.parse(sHtmlContent, sPattern)

    sHosterUrl = base64.b64decode(Unquote(aResult[1][0].split('?url=')[1]))
    sTitle = sMovieTitle.replace('- Saison ', ' S')

    try:
        sHosterUrl = sHosterUrl.decode('utf-8')
    except:
        pass

    oHoster = cHosterGui().checkHoster(sHosterUrl)
    if (oHoster != False):
        oHoster.setDisplayName(sTitle)
        oHoster.setFileName(sTitle)
        cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumb)

    oGui.setEndOfDirectory()
Esempio n. 11
0
    def __getMediaLinkForGuest(self):

        #api_call = ('http://www.nowvideo.sx/api/player.api.php?key=%s&file=%s') % (self.__getKey(), self.__getIdFromUrl())
        api_call = (
            'http://www.onevideo.to/api/player.api.php?user=undefined&codes=1&file=%s&pass=undefined&key=%s'
        ) % (self.__getIdFromUrl(), self.__getKey())

        oRequest = cRequestHandler(api_call)
        sHtmlContent = oRequest.request()

        sPattern = 'url=(.+?)&title'
        oParser = cParser()
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            stream_url = Unquote(aResult[1][0])
            return True, stream_url
        else:
            return False, False

        return False, False
Esempio n. 12
0
def searchSerie(sSearch):
    oGui = cGui()
    oParser = cParser()
    sSearch = Unquote(sSearch)

    oRequestHandler = cRequestHandler(URL_LAST)
    sHtmlContent = oRequestHandler.request()
    sHtmlContent = oParser.abParse(sHtmlContent, '<h1>Listes des séries:</h1>', '<div class="container"><br>')

    sPattern = '<a title="([^"]*' + sSearch + '.*?)\" href="([^"]+)"'
    aResult = oParser.parse(sHtmlContent, sPattern)

    if (aResult[0] == True):
        oOutputParameterHandler = cOutputParameterHandler()
        for aEntry in aResult[1]:
            sTitle = aEntry[0].replace('en streaming', '')
            sUrl = aEntry[1]

            oOutputParameterHandler.addParameter('siteUrl', sUrl)
            oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
            oGui.addDir(SITE_IDENTIFIER, 'showS_E', sTitle, 'series.png', oOutputParameterHandler)
Esempio n. 13
0
    def insert_history(self, meta):

        # title = Unquote(meta['title']).decode('ascii', 'ignore')
        title = self.str_conv(Unquote(meta['title']))
        disp = meta['disp']
        icon = 'icon.png'

        try:
            ex = 'INSERT INTO history (title, disp, icone) VALUES (?, ?, ?)'
            self.dbcur.execute(ex, (title, disp, icon))
            self.db.commit()
            VSlog('SQL INSERT history Successfully')
        except Exception as e:
            if 'UNIQUE constraint failed' in e.message:
                ex = "UPDATE history set title = '%s', disp = '%s', icone= '%s' WHERE title = '%s'" % (
                    title, disp, icon, title)
                self.dbcur.execute(ex)
                self.db.commit()
                VSlog('SQL UPDATE history Successfully')
            VSlog('SQL ERROR INSERT, title = %s, %s' % (title, e))
            pass
Esempio n. 14
0
def showMovies(sSearch=''):
    oGui = cGui()
    oParser = cParser()

    if sSearch:
        typeSearch, sSearch = sSearch.split('=')
        sSearch = Unquote(sSearch)
        sSearch = cUtil().CleanName(sSearch)
        sSearch = QuotePlus(sSearch).upper()  # remplace espace par + et passe en majuscule

        sUrl = URL_SEARCH[0] + sSearch + '.html'

        oRequestHandler = cRequestHandler(sUrl)
        oRequestHandler.addHeaderEntry('User-Agent', UA)
        oRequestHandler.addHeaderEntry('Referer', URL_MAIN)
        sHtmlContent = oRequestHandler.request()
        sHtmlContent = cutSearch(sHtmlContent, typeSearch)

    else:
        oInputParameterHandler = cInputParameterHandler()
        sUrl = oInputParameterHandler.getValue('siteUrl')

        oRequestHandler = cRequestHandler(sUrl)
        oRequestHandler.addHeaderEntry('User-Agent', UA)
        oRequestHandler.addHeaderEntry('Referer', RandomReferer())
        sHtmlContent = oRequestHandler.request()
        # sHtmlContent = DecryptMangacity(sHtmlContent)

    if 'HTML/JavaScript Encoder' in sHtmlContent:
        sHtmlContent = ICDecode(sHtmlContent)

    if sHtmlContent.startswith('<script type="text/javascript">'):
        sHtmlContent = FullUnescape(sHtmlContent)

    if sSearch or 'categorie.php' in sUrl or 'categorie_' in sUrl or 'listing3.php?' in sUrl or 'drama.php' in sUrl:
        sPattern = '<center><div style="background: url\(\'([^\'].+?)\'\); background-size.+?alt="(.+?)" title.+?<a href=["\']*(.+?)[\'"]* class=.button'
    else:
        sPattern = '<center><div style="background: url\(\'([^\'].+?)\'\); background-size.+?<a href="([^"]+)".+?alt="(.+?)"'

    sHtmlContent = re.sub('<a\s*href=\"categorie.php\?watch=\"\s*class="genre\s*\"', '', sHtmlContent, re.DOTALL)

    aResult = oParser.parse(sHtmlContent, sPattern)

    if (aResult[0] == False):
        oGui.addText(SITE_IDENTIFIER)

    if (aResult[0] == True):
        total = len(aResult[1])
        progress_ = progress().VScreate(SITE_NAME)

        isPython3 = isMatrix()

        oOutputParameterHandler = cOutputParameterHandler()
        for aEntry in aResult[1]:
            progress_.VSupdate(progress_, total)
            if progress_.iscanceled():
                break

            sThumb = aEntry[0]
            if not sThumb.startswith('http'):
                sThumb = URL_MAIN + sThumb

            if sSearch or 'categorie.php' in sUrl or 'categorie_' in sUrl or 'listing3.php?' in sUrl or 'drama.php' in sUrl:
                sTitle = aEntry[1]
                sUrl2 = aEntry[2]
            else:
                sTitle = str(aEntry[2])
                sUrl2 = aEntry[1]

            if not sUrl2.startswith('http'):
                sUrl2 = URL_MAIN + sUrl2

            # affichage de la langue
            sLang = ''
            if 'VF' in sTitle:
                sLang = 'VF'
            elif 'VOSTFR' in sTitle:
                sLang = 'VOSTFR'

            # affichage de la qualité -> NON, qualité fausse
            # sQual = ''
            # if 'DVDRIP' in sTitle:
                # sQual = 'DVDRIP'

            # Nettoyer le titre
            sTitle = sTitle.replace(' DVDRIP', '').replace('Visionnez ', '')
            sTitle = sTitle.replace('[Streaming] - ', '').replace('gratuitement maintenant', '')
            if ' - Episode' in sTitle:
                sTitle = sTitle.replace(' -', '')

            if not isPython3:
                sTitle = cUtil().CleanName(sTitle).capitalize()
            else:
                sTitle.capitalize()

            sDisplayTitle = ('%s (%s)') % (sTitle, sLang)

            oOutputParameterHandler.addParameter('siteUrl', sUrl2)
            oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
            oOutputParameterHandler.addParameter('sThumb', sThumb)

            if 'drama.php' in sUrl:
                oGui.addTV(SITE_IDENTIFIER, 'showEpisode', sDisplayTitle, 'animes.png', sThumb, '', oOutputParameterHandler)
            elif '?manga=' in sUrl2:
                oGui.addAnime(SITE_IDENTIFIER, 'showEpisode', sDisplayTitle, 'animes.png', sThumb, '', oOutputParameterHandler)
            elif '?serie=' in sUrl2:
                oGui.addTV(SITE_IDENTIFIER, 'showEpisode', sDisplayTitle, 'series.png', sThumb, '', oOutputParameterHandler)
            elif '?film=' in sUrl2:
                oGui.addMovie(SITE_IDENTIFIER, 'showMovies', sDisplayTitle, 'films.png', sThumb, '', oOutputParameterHandler)
            else:
                oGui.addMovie(SITE_IDENTIFIER, 'showHosters', sDisplayTitle, 'films.png', sThumb, '', oOutputParameterHandler)

        progress_.VSclose(progress_)

    if not sSearch:  # une seule page par recherche
        sNextPage = __checkForNextPage(sHtmlContent)
        if (sNextPage != False):
            oOutputParameterHandler = cOutputParameterHandler()
            oOutputParameterHandler.addParameter('siteUrl', sNextPage)
            oGui.addNext(SITE_IDENTIFIER, 'showMovies', 'Suivant', oOutputParameterHandler)

        oGui.setEndOfDirectory()
    def addParameter(self, sParameterName, mParameterValue):
        if not mParameterValue:
            return

        self.__aParams[sParameterName] = Unquote(str(mParameterValue))
    def getValue(self, sParamName):
        if (self.exist(sParamName)):
            sParamValue = self.__aParams[sParamName]
            return Unquote(sParamValue)

        return False
Esempio n. 17
0
def showHosters():
    oGui = cGui()
    oParser = cParser()
    oInputParameterHandler = cInputParameterHandler()
    sUrl = oInputParameterHandler.getValue('siteUrl')
    sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
    sThumb = oInputParameterHandler.getValue('sThumb')

    oRequestHandler = cRequestHandler(sUrl)
    oRequestHandler.addHeaderEntry('User-Agent', UA)
    oRequestHandler.addHeaderEntry('Referer', RandomReferer())
    sHtmlContent = oRequestHandler.request()

    if 'HTML/JavaScript Encoder' in sHtmlContent:
        sHtmlContent = ICDecode(sHtmlContent)

    sHtmlContent = sHtmlContent.replace('<iframe src="http://www.promoliens.net', '')
    sHtmlContent = sHtmlContent.replace("<iframe src='cache_vote.php", '')

    sPattern = '<iframe.+?src=\'([^<>"]+?)\''
    aResult = oParser.parse(sHtmlContent, sPattern)

    sText = 'Animés dispo gratuitement et légalement sur :'
    if 'animedigitalnetwork.fr' in str(aResult[1]):
        oGui.addText(SITE_IDENTIFIER, "[COLOR red]" + sText + "[/COLOR][COLOR coral] anime digital network[/COLOR]")
    elif 'crunchyroll.com' in str(aResult[1]):
        oGui.addText(SITE_IDENTIFIER, "[COLOR red]" + sText + "[/COLOR][COLOR coral] crunchyroll[/COLOR]")
    elif 'wakanim.tv' in str(aResult[1]):
        oGui.addText(SITE_IDENTIFIER, "[COLOR red]" + sText + "[/COLOR][COLOR coral] wakanim[/COLOR]")
    else:
        list_url = []

        # 1 er methode
        sPattern = '<div class="box"><iframe.+?src=[\'|"](.+?)[\'|"]'
        aResult = oParser.parse(sHtmlContent, sPattern)

        if (aResult[0] == True):
            for aEntry in aResult[1]:
                if re.match(".+?&#[0-9]+;", aEntry):  # directe mais codé html
                    sHosterUrl = cUtil().unescape(aEntry)

                else:  # directe en clair
                    sHosterUrl = str(aEntry)

                # Ces liens sont toujours des liens
                if (not sHosterUrl.startswith('http')) and (len(sHosterUrl) > 2):
                    sHosterUrl = URL_MAIN + sHosterUrl

                list_url.append(sHosterUrl)

        # 2 eme methode
        sPattern = '<script>eval\(unescape\((.+?)\); eval\(unescape\((.+?)\);</script>'
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            for aEntry in aResult[1]:
                # si url cryptee mangacity algo
                sHosterUrl = DecryptMangacity(aEntry[1])
                sHosterUrl = sHosterUrl.replace('\\', '')
                list_url.append(sHosterUrl)

        # 3 eme methode
        sPattern = 'document\.write\(unescape\("(%3c%.+?)"\)\);'
        aResult = oParser.parse(sHtmlContent, sPattern)
        if (aResult[0] == True):
            for aEntry in aResult[1]:
                tmp = Unquote(aEntry)

                sPattern2 = 'src=["\']([^"\']+)["\']'
                aResult = re.findall(sPattern2, tmp)
                if aResult:
                    list_url.append(aResult[0])

        if len(list_url) > 0:
            for aEntry in list_url:

                sHosterUrl = aEntry

                # Dans le cas ou l'adresse n'est pas directe,on cherche a l'extraire
                if not sHosterUrl[:4] == 'http':
                    sHosterUrl = extractLink(sHosterUrl)

                # Si aucun lien on arrete ici
                if not sHosterUrl:
                    continue

                # si openload code
                if 'openload2.php' in sHosterUrl:
                    # on telecharge la page

                    oRequestHandler = cRequestHandler(sHosterUrl)
                    oRequestHandler.addHeaderEntry('User-Agent', UA)
                    sHtmlContent = oRequestHandler.request()
                    # Et on remplace le code
                    sHtmlContent = ICDecode(sHtmlContent)
                    sHosterUrl = extractLink(sHtmlContent)

                # Passe par lien .asx ??
                sPattern = '(https*:\/\/www.ianime[^\/\\]+\/[0-9a-zA-Z_-]+\.asx)'
                aResult = oParser.parse(sHosterUrl, sPattern)
                if aResult[0]:
                    # on telecharge la page
                    oRequestHandler = cRequestHandler(sHosterUrl)
                    oRequestHandler.addHeaderEntry('Referer', sUrl)
                    oRequestHandler.addHeaderEntry('User-Agent', UA)
                    sHtmlContent = oRequestHandler.request()

                    # Si c'est une redirection, on passe juste le vrai lien
                    if 'ianime' not in oRequestHandler.getRealUrl().split('/')[2]:
                        sHosterUrl = oRequestHandler.getRealUrl()
                    else:
                        # Sinon on remplace le code
                        html = ICDecode(sHtmlContent)
                        sHosterUrl = extractLink(html)

                # Passe par lien .vxm ??
                # sPattern = 'http:\/\/www.ianime[^\/\\]+\/([0-9a-zA-Z_-]+)\.vxm'
                # aResult = oParser.parse(sHosterUrl, sPattern)
                # if aResult[0] :
                # sHosterUrl = 'http://embed.nowvideo.sx/embed.php?v=' + aResult[1][0]

                # redirection tinyurl
                if 'tinyurl' in sHosterUrl:
                    sHosterUrl = GetTinyUrl(sHosterUrl)

                # test pr liens raccourcis
                if 'http://goo.gl' in sHosterUrl:
                    try:
                        oRequestHandler = cRequestHandler(sHosterUrl)
                        oRequestHandler.addHeaderEntry('User-Agent', "Mozilla 5.10")
                        oRequestHandler.addHeaderEntry('Host', "goo.gl")
                        oRequestHandler.addHeaderEntry('Connection', 'keep-alive')
                        sHtmlContent = oRequestHandler.request()
                        sHosterUrl = oRequestHandler.getRealUrl()

                    except:
                        pass

                # Potection visio.php
                if '/visio.php?' in sHosterUrl:
                    oRequestHandler = cRequestHandler(sHosterUrl)
                    oRequestHandler.addHeaderEntry('Referer', sUrl)
                    oRequestHandler.addHeaderEntry('User-Agent', UA)
                    sHtmlContent = oRequestHandler.request()

                    sHtmlContent = ICDecode(sHtmlContent)

                    sPattern = 'src=[\'"]([^\'"]+)[\'"]'
                    aResult = oParser.parse(sHtmlContent, sPattern)
                    if aResult[0]:
                        sHosterUrl = aResult[1][0]

                # Derniere en date
                sPattern = "(https*:\/\/www.ianime[^\/\\]+\/[^']+)"
                aResult = oParser.parse(sHosterUrl, sPattern)
                if aResult[0]:
                    oRequestHandler = cRequestHandler(sHosterUrl)
                    oRequestHandler.addHeaderEntry('Referer', sUrl)
                    oRequestHandler.addHeaderEntry('User-Agent', UA)

                    sHtmlContent = oRequestHandler.request()

                    sHtmlContent = ICDecode(sHtmlContent)

                    sHosterUrl2 = extractLink(sHtmlContent)

                    if 'intern_player.png' in sHosterUrl2 or 'intern_player2.png' in sHosterUrl2:
                        xx = str(random.randint(300, 350))  # 347
                        yy = str(random.randint(200, 255))  # 216

                        oRequestHandler = cRequestHandler(sHosterUrl)
                        oRequestHandler.setRequestType(cRequestHandler.REQUEST_TYPE_POST)
                        # Add params
                        oRequestHandler.addParameters('submit.x', xx)
                        oRequestHandler.addParameters('submit.y', yy)

                        # look for hidden params
                        p1 = re.search(r'name="valeur" value="([^"]+)"', sHtmlContent)
                        if p1:
                            oRequestHandler.addParameters('valeur', p1.group(1))

                        # Set headers
                        oRequestHandler.addHeaderEntry('Referer', sUrl)
                        oRequestHandler.addHeaderEntry('User-Agent', UA)
                        sHtmlContent = oRequestHandler.request()

                        sHosterUrl2 = extractLink(sHtmlContent)

                    sHosterUrl = sHosterUrl2

                if 'tinyurl' in sHosterUrl:
                    sHosterUrl = GetTinyUrl(sHosterUrl)

                if '///' in sHosterUrl:
                    sHosterUrl = 'https://' + '/'.join(sHosterUrl.split('/')[5:])

                VSlog(sHosterUrl)

                oHoster = cHosterGui().checkHoster(sHosterUrl)
                if (oHoster != False):
                    oHoster.setDisplayName(sMovieTitle)
                    oHoster.setFileName(sMovieTitle)
                    cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumb)

    oGui.setEndOfDirectory()
Esempio n. 18
0
def FullUnescape(code):
    sPattern = '<script type="text/javascript">document\.write\(unescape\(".+?"\)\);</script>'
    aResult = re.findall(sPattern, code)
    if aResult:
        return Unquote(aResult[0])
    return code
Esempio n. 19
0
def showMovies(sSearch=''):
    oGui = cGui()

    if sSearch:
        sUrl = URL_MAIN + 'search.php'
        oRequestHandler = cRequestHandler(sUrl)
        oRequestHandler.setRequestType(cRequestHandler.REQUEST_TYPE_POST)
        oRequestHandler.addParameters('q', Unquote(sSearch))
    else:
        oInputParameterHandler = cInputParameterHandler()
        sUrl = oInputParameterHandler.getValue('siteUrl')
        oRequestHandler = cRequestHandler(sUrl)

    oRequestHandler.addHeaderEntry('Referer', URL_MAIN)
    sHtmlContent = oRequestHandler.request()

    if sSearch:
        sPattern = '<a href="([^"]+).+?url\((.+?)\).+?<div class="title"> (.+?) </div>'
    elif 'Annee/' in sUrl or '/ABC' in sUrl:
        sPattern = '<div class="table-movies-content.+?href="([^"]+).+?url\((.+?)\).+?<.i>.([^<]+)'
    elif 'genre/' in sUrl:
        sPattern = 'film-uno.+?href="([^"]+).+?data-src="([^"]+).+?alt="([^"]+)'
    else:
        sPattern = 'class="film-uno".+?href="([^"]+).+?data-src="([^"]+).+?alt="([^"]+).+?min.+?·([^<]+).+?short-story">([^<]*)'

    oParser = cParser()
    aResult = oParser.parse(sHtmlContent, sPattern)

    if (aResult[0] == False):
        oGui.addText(SITE_IDENTIFIER)

    if (aResult[0] == True):
        total = len(aResult[1])
        progress_ = progress().VScreate(SITE_NAME)
        oOutputParameterHandler = cOutputParameterHandler()
        for aEntry in aResult[1]:
            progress_.VSupdate(progress_, total)
            if progress_.iscanceled():
                break

            sUrl = aEntry[0]
            sThumb = aEntry[1]
            sTitle = aEntry[2]
            sDesc = ''
            if len(aEntry) > 3:
                if xbmc.getInfoLabel('system.buildversion')[0:2] >= '19':
                    sQual = aEntry[3].split('·')[1].replace('Â', '').strip()
                    sLang = aEntry[3].split('·')[2].strip()
                else:
                    sQual = aEntry[3].split('·')[1].strip()
                    sLang = aEntry[3].split('·')[2].strip()

                sDesc = aEntry[4]

                sDisplayTitle = ('%s [%s] (%s)') % (sTitle, sQual, sLang)

            else:
                sDisplayTitle = sTitle

            oOutputParameterHandler.addParameter('siteUrl', sUrl)
            oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
            oOutputParameterHandler.addParameter('sThumb', sThumb)
            oOutputParameterHandler.addParameter('sDesc', sDesc)
            oGui.addMovie(SITE_IDENTIFIER, 'showHoster', sDisplayTitle, '',
                          sThumb, sDesc, oOutputParameterHandler)
        progress_.VSclose(progress_)

    if not sSearch:
        sNextPage, sPaging = __checkForNextPage(sHtmlContent)
        if (sNextPage != False):
            oOutputParameterHandler = cOutputParameterHandler()
            oOutputParameterHandler.addParameter('siteUrl', sNextPage)
            # sNumPage = re.search('(page|genre).*?[-=\/]([0-9]+)', sNextPage).group(2)  # ou replace'.html',''; '([0-9]+)$'
            oGui.addNext(SITE_IDENTIFIER, 'showMovies', 'Page ' + sPaging,
                         oOutputParameterHandler)

        oGui.setEndOfDirectory()