Esempio n. 1
0
    def GetHeadercookie(self, url):
        Domain = re.sub(r'https*:\/\/([^/]+)(\/*.*)', '\\1', url)
        cook = self.Readcookie(Domain.replace('.', '_'))
        if cook == '':
            return ''

        return '|' + urlEncode({'User-Agent': UA, 'Cookie': cook})
Esempio n. 2
0
def performCaptcha(sitename,
                   cj,
                   returnpage=True,
                   captcharegex='data-sitekey="(.*?)"',
                   lang="fr",
                   headers=None):
    gcookieJar = getg()
    sitepage = getUrl(sitename, cookieJar=cj, headers=headers)
    sitekey = re.findall(captcharegex, sitepage)
    token = ""
    if len(sitekey) >= 1:
        # getUrl('https://www.google.com/', cookieJar=gcookieJar)
        c = UnCaptchaReCaptcha()
        token = c.processCaptcha(sitekey[0], lang, gcookieJar)
        if returnpage:
            # gcookieJar.save('./gsite.jwl');
            headers = [(
                "User-Agent",
                "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0"
            ), ("Referer", sitename)]
            sitepage = getUrl(sitename,
                              cookieJar=cj,
                              post=urlEncode({"g-recaptcha-response": token}),
                              headers=headers)

    if returnpage:
        # fh = open('c:\\reussi.txt', 'w')
        # fh.write(sitepage)
        # fh.close()
        return sitepage
    else:
        return token
Esempio n. 3
0
def seriesHosters():
    oGui = cGui()

    oInputParameterHandler = cInputParameterHandler()
    sUrl = oInputParameterHandler.getValue('siteUrl')
    sThumb = oInputParameterHandler.getValue('sThumb')
    sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
    sReferer = oInputParameterHandler.getValue('sReferer')
    hostClass = oInputParameterHandler.getValue('hostClass')

    Id = sReferer.split('/')[4].split('-')[0]
    query_args = (('newsId', Id), ('preset', ''), ('preset2', Id),
                  ('template', ''), ('d', time.time() * 1000))
    data = urlEncode(query_args)

    oRequestHandler = cRequestHandler(URL_MAIN + "engine/ajax/full-story.php")
    oRequestHandler.addHeaderEntry('User-Agent', UA)
    oRequestHandler.addHeaderEntry('Referer', sReferer)
    oRequestHandler.addHeaderEntry('X-Requested-With', 'XMLHttpRequest')
    oRequestHandler.addParametersLine(data)
    sHtmlContent = oRequestHandler.request()

    sPattern = 'id="content_' + sUrl + '".+?>(.+?)<'

    oParser = cParser()
    aEntry = oParser.parse(sHtmlContent, sPattern)[1][0]

    if "https" in aEntry:
        sHosterUrl = aEntry
    elif hostClass == "toonanimeplayer_cdnt":
        sHosterUrl = "https://lb.toonanime.xyz/playlist/" + aEntry + "/" + str(
            round(time.time() * 1000))
    else:
        oRequestHandler = cRequestHandler(URL_MAIN +
                                          "/templates/toonanime/js/anime.js")
        sHtmlContent = oRequestHandler.request()

        sPattern = 'player_type=="' + hostClass + '".+?src=\\\\"([^\\\\]+)\\\\'
        urlBase = oParser.parse(sHtmlContent, sPattern)[1][0]
        sHosterUrl = urlBase.replace('"+player_content+"', aEntry)

    sMovieTitle = re.sub("\[COLOR coral\](.+?)\[/COLOR\]", "", sMovieTitle)

    if "toonanime" in sHosterUrl:
        oHoster = cHosterGui().checkHoster("mp4")
    else:
        oHoster = cHosterGui().checkHoster(sHosterUrl)

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

    oGui.setEndOfDirectory()
Esempio n. 4
0
def DecryptDlProtecte(url):

    if not (url):
        return ''

    oRequestHandler = cRequestHandler(url)
    sHtmlContent = oRequestHandler.request()

    oParser = cParser()
    sPattern = '<form action="(.+?)".+?<input type="hidden" name="_token" value="(.+?)">.+?<input type="hidden" value="(.+?)".+?>'
    result = oParser.parse(sHtmlContent, sPattern)

    if (result[0]):
        RestUrl = str(result[1][0][0])
        token = str(result[1][0][1])
        urlData = str(result[1][0][2])

    else:
        sPattern = ' name="url">---->.+?<form action="(.+?)" method="get">.+?<input type="hidden" name="_token" value="(.+?)">'
        result = oParser.parse(sHtmlContent, sPattern)

        if (result[0]):
            RestUrl = str(result[1][0][0])
            token = str(result[1][0][1])

    f = {'_token': token}
    data = urlEncode(f)

    oRequestHandler = cRequestHandler('http://' + url.split('/')[2] + RestUrl)
    oRequestHandler.setRequestType(1)
    oRequestHandler.addHeaderEntry('User-Agent', UA)
    oRequestHandler.addHeaderEntry('Host', url.split('/')[2])
    oRequestHandler.addHeaderEntry(
        'Accept',
        'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
    oRequestHandler.addHeaderEntry('Accept-Language',
                                   'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3')
    oRequestHandler.addHeaderEntry('Accept-Encoding', 'gzip, deflate')
    oRequestHandler.addHeaderEntry('Referer', url)
    oRequestHandler.addHeaderEntry('Content-Type',
                                   "application/x-www-form-urlencoded")
    oRequestHandler.addHeaderEntry('Content-Length', len(str(data)))
    oRequestHandler.addHeaderEntry('Origin', 'https://' + url.split('/')[2])
    oRequestHandler.addParametersLine(data)
    sHtmlContent = oRequestHandler.request()

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

    return sHtmlContent
Esempio n. 5
0
    def __getMediaLinkForGuest(self):
        import random
        api_call = False
        url = 'https://1fichier.com/?' + self.__getIdFromUrl(self.__sUrl)

        headers = {
            'User-Agent': UA,
            'Host': '1fichier.com',
            'Referer': self.__sUrl,
            'Accept':
            'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
            'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3'
            # 'Content-Type': 'application/x-www-form-urlencoded'
        }

        adcode = random.uniform(000.000000000, 999.999999999)

        Mode = ''
        # Mode = {'dl_no_ssl': 'on', 'dlinline': 'on'}
        Mode = {'dl_no_ssl': 'on', 'adzone': adcode}
        postdata = urlEncode(Mode)

        req = urllib2.Request(url, postdata, headers)

        try:
            # import ssl
            # context = ssl._create_unverified_context()
            # response = urllib2.urlopen(req, context=context)
            response = urllib2.urlopen(req)
        except UrlError as e:
            print(e.read())
            print(e.reason)

        sHtmlContent = response.read()
        response.close()

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

        api_call = self.GetMedialinkDL(sHtmlContent)

        if (api_call):
            return True, api_call

        return False, False
Esempio n. 6
0
    def __getMediaLinkForGuest(self):

        api_call = ''
        url = self.__sUrl

        oRequest = cRequestHandler(url)
        oRequest.addHeaderEntry('User-Agent', UA)
        oRequest.addHeaderEntry(
            'Accept',
            'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
        oRequest.addHeaderEntry('Accept-Language',
                                'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3')
        sHtmlContent = oRequest.request()

        oParser = cParser()
        sPattern = '<script type="text/javascript" src="(.+?)"'
        aResult = oParser.parse(sHtmlContent, sPattern)[1][1]

        oRequest = cRequestHandler(aResult)
        oRequest.addHeaderEntry('User-Agent', UA)
        oRequest.addHeaderEntry(
            'Accept',
            'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
        oRequest.addHeaderEntry('Accept-Language',
                                'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3')
        sHtmlContent = oRequest.request()

        sPattern = '(?:parseJSON|atob).+?ey(.+?)"'
        code = oParser.parse(sHtmlContent, sPattern)

        for i in code[1]:
            try:
                if isMatrix():
                    code = base64.b64decode("ey" + i).decode('ascii')
                else:
                    code = base64.b64decode("ey" + i)
                break
            except:
                pass

        api_call = json.loads(code)['url']

        if (api_call):
            return True, api_call + '|' + urlEncode(headers)

        return False, False
Esempio n. 7
0
    def __init__(self, ctype='videos', params=''):
        self.result = ''
        self.next = ''

        params = urlEncode(params)

        req = urllib2.Request(URL_MAIN + ctype + '?' + params)
        try:
            gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
            response = urllib2.urlopen(req, context=gcontext)
        except:
            response = urllib2.urlopen(req)
        sHtmlContent = response.read()
        sHtmlContent = sHtmlContent.decode('utf-8')
        self.result = json.loads(sHtmlContent)
        response.close()
        if self.result:
            self.load_result()
        return
Esempio n. 8
0
    def __getMediaLinkForGuest(self):
        vUrl = False
        sId = self.__getIdFromUrl(self.__sUrl)

        query_args = {
            'r':
            '["tVL0gjqo5",["preview/flv_image",{"uid":"' + sId +
            '"}],["preview/flv_link",{"uid":"' + sId + '"}]]'
        }

        data = urlEncode(query_args)
        headers = {'User-Agent': 'Mozilla 5.10'}
        url = 'http://api.letitbit.net'
        request = urllib2.Request(url, data, headers)

        try:
            reponse = urllib2.urlopen(request)
        except UrlError as e:
            print(e.read())
            print(e.reason)

        html = reponse.read()

        sHtmlContent = html.replace('\\', '')

        link = re.findall('"link":"(.+?)"', sHtmlContent)
        if link:
            vUrl = link[0]

        # print(vUrl)

        if (vUrl):
            api_call = vUrl
            return True, api_call

        return False, False
Esempio n. 9
0
def showMovies(sSearch=''):
    oGui = cGui()
    oParser = cParser()
    oInputParameterHandler = cInputParameterHandler()
    Nextpagesearch = oInputParameterHandler.getValue('Nextpagesearch')
    sUrl = oInputParameterHandler.getValue('siteUrl')

    bGlobal_Search = False

    if Nextpagesearch:
        sSearch = sUrl

    if sSearch:

        if URL_SEARCH[0] in sSearch:
            bGlobal_Search = True
            sSearch = sSearch.replace(URL_SEARCH[0], '')

        if Nextpagesearch:
            query_args = (('do', 'search'), ('subaction', 'search'),
                          ('search_start', Nextpagesearch), ('story', sSearch),
                          ('titleonly', '3'))
        else:
            query_args = (('do', 'search'), ('subaction', 'search'),
                          ('story', sSearch), ('titleonly', '3'))

        data = urlEncode(query_args)

        oRequestHandler = cRequestHandler(URL_SEARCH[0])
        oRequestHandler.setRequestType(cRequestHandler.REQUEST_TYPE_POST)
        oRequestHandler.addParametersLine(data)
        oRequestHandler.addParameters('User-Agent', UA)
        sHtmlContent = oRequestHandler.request()
        sHtmlContent = oParser.abParse(sHtmlContent, 'de la recherche',
                                       'Nous contacter')
    else:
        oRequestHandler = cRequestHandler(sUrl)
        sHtmlContent = oRequestHandler.request()

    sPattern = '<a class="top-last thumbnails" href="([^"]+)"><img class="img-post" src="([^"]+)" style="" alt="(.+?) - ([^"]+)"'

    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)

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

            sUrl2 = aEntry[0]
            sThumb = aEntry[1]
            sTitle = aEntry[2]
            sDesc = ''

            if sSearch and total > 2:
                if cUtil().CheckOccurence(sSearch, sTitle) == 0:
                    continue

            sDisplayTitle = ('%s [%s]') % (sTitle, aEntry[3])

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

            if 'mangas' in sUrl and not 'manga-films' in sUrl:
                oGui.addMovie(SITE_IDENTIFIER, 'showHosters', sDisplayTitle,
                              '', sThumb, sDesc, oOutputParameterHandler)
            else:
                oGui.addTV(SITE_IDENTIFIER, 'showLinks', sDisplayTitle, '',
                           sThumb, sDesc, oOutputParameterHandler)

        progress_.VSclose(progress_)

        if sSearch:
            sPattern = '<a name="nextlink" id="nextlink" onclick="javascript:list_submit\(([0-9]+)\); return\(false\)" href="#">Suivant'
            aResult = oParser.parse(sHtmlContent, sPattern)
            if (aResult[0] == True):
                oOutputParameterHandler = cOutputParameterHandler()
                oOutputParameterHandler.addParameter('siteUrl', sSearch)
                oOutputParameterHandler.addParameter('Nextpagesearch',
                                                     aResult[1][0])
                oGui.addNext(SITE_IDENTIFIER, 'showMovies',
                             '[COLOR teal]Suivant >>>[/COLOR]',
                             oOutputParameterHandler)

        else:
            sNextPage = __checkForNextPage(sHtmlContent)
            if (sNextPage != False):
                oOutputParameterHandler = cOutputParameterHandler()
                oOutputParameterHandler.addParameter('siteUrl', sNextPage)
                oGui.addNext(SITE_IDENTIFIER, 'showMovies',
                             '[COLOR teal]Suivant >>>[/COLOR]',
                             oOutputParameterHandler)

    if Nextpagesearch:
        oGui.setEndOfDirectory()

    if not sSearch:
        oGui.setEndOfDirectory()
Esempio n. 10
0
def showMovies(sSearch=''):
    oGui = cGui()
    oParser = cParser()
    oInputParameterHandler = cInputParameterHandler()
    nextPageSearch = oInputParameterHandler.getValue('nextPageSearch')
    sUrl = oInputParameterHandler.getValue('siteUrl')

    if nextPageSearch:
        sSearch = sUrl

    if sSearch:
        if URL_SEARCH[0] in sSearch:
            sSearch = sSearch.replace(URL_SEARCH[0], '')

        if nextPageSearch:
            query_args = (('do', 'search'), ('subaction', 'search'),
                          ('search_start', nextPageSearch), ('story', sSearch))
        else:
            query_args = (('do', 'search'), ('subaction', 'search'), ('story',
                                                                      sSearch))

        data = urlEncode(query_args)

        oRequestHandler = cRequestHandler(URL_SEARCH[0])
        oRequestHandler.setRequestType(cRequestHandler.REQUEST_TYPE_POST)
        oRequestHandler.addParametersLine(data)
        oRequestHandler.addParameters('User-Agent', UA)
        sHtmlContent = oRequestHandler.request()

    else:
        sUrl = oInputParameterHandler.getValue('siteUrl')
        oRequestHandler = cRequestHandler(sUrl)
        sHtmlContent = oRequestHandler.request()

    if sSearch:
        sPattern = '<div class="fullstream fullstreaming">.+?<img src="([^"]+)".+?<h3 class="mov-title"><a href="([^"]+)" >([^<]+)</a>.+?<strong>(?:Qualit|Version).+?">(.+?)</a>.+?</*strong>'
    else:
        sPattern = 'class="fullstream fullstreaming".+?src="([^"]+).+?alt="([^"]+).+?<strong>(?:Qualit|Version).+?>(.+?)</a>.+?</*strong>.+?xfsearch.+?>([^<]+).+?itemprop="description".+?;">([^<]+).+?<a href="([^"]+)'

    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

            sYear = ''
            if sSearch:
                sThumb = aEntry[0]
                if sThumb.startswith('/'):
                    sThumb = URL_MAIN[:-1] + sThumb

                siteUrl = re.sub('www\.', '', aEntry[1])
                sTitle = aEntry[2]
                sQual = aEntry[3]
                sQual = sQual.replace(':', '').replace(' ',
                                                       '').replace(',', '/')
                sDesc = ''

            else:
                sThumb = aEntry[0]
                if sThumb.startswith('/'):
                    sThumb = "https:" + sThumb

                sTitle = aEntry[1]
                sQual = aEntry[2]
                sQual = sQual.replace(':', '').replace(' ',
                                                       '').replace(',', '/')

                # Certain film n'ont pas de date.
                try:
                    sYear = re.search('(\d{4})', aEntry[3]).group(1)
                except:
                    pass

                sDesc = aEntry[4]
                siteUrl = re.sub('www\.', '', aEntry[5])

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

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

            oGui.addMovie(SITE_IDENTIFIER, 'showHosters', sDisplayTitle,
                          'films.png', sThumb, sDesc, oOutputParameterHandler)

        progress_.VSclose(progress_)

        if sSearch:
            sPattern = '<a name="nextlink" id="nextlink" onclick="javascript:list_submit\(([0-9]+)\); return\(false\)" href="#">Suivant'
            aResult = oParser.parse(sHtmlContent, sPattern)
            if (aResult[0] == True):
                oOutputParameterHandler = cOutputParameterHandler()
                oOutputParameterHandler.addParameter('siteUrl', sSearch)
                oOutputParameterHandler.addParameter('nextPageSearch',
                                                     aResult[1][0])
                number = re.search('([0-9]+)', aResult[1][0]).group(1)
                oGui.addNext(SITE_IDENTIFIER, 'showMovies', 'Page ' + number,
                             oOutputParameterHandler)

        else:
            sNextPage = __checkForNextPage(sHtmlContent)
            if (sNextPage != False):
                oOutputParameterHandler = cOutputParameterHandler()
                oOutputParameterHandler.addParameter('siteUrl', sNextPage)
                number = re.search('/page/([0-9]+)', sNextPage).group(1)
                oGui.addNext(SITE_IDENTIFIER, 'showMovies', 'Page ' + number,
                             oOutputParameterHandler)

    if nextPageSearch:
        oGui.setEndOfDirectory()

    if not sSearch:
        oGui.setEndOfDirectory()
Esempio n. 11
0
    def Authentificate(self):

        # un seul essais par session, pas besoin de bombarder le serveur
        if self.__LoginTry:
            return False
        self.__LoginTry = True

        if not self.__Ispremium:
            return False

        post_data = {}

        if 'uptobox' in self.__sHosterIdentifier:
            url = 'https://uptobox.com/?op=login&referer=homepage'
            post_data['login'] = self.getUsername()
            post_data['password'] = self.getPassword()

        elif 'onefichier' in self.__sHosterIdentifier:
            url = 'https://1fichier.com/login.pl'
            post_data['mail'] = self.getUsername()
            post_data['pass'] = self.getPassword()
            post_data['lt'] = 'on'
            post_data['purge'] = 'on'
            post_data['valider'] = 'Send'
            self.__ssl = True

        elif 'uploaded' in self.__sHosterIdentifier:
            url = 'http://uploaded.net/io/login'
            post_data['id'] = self.getUsername()
            post_data['pw'] = self.getPassword()

        # si aucun de trouve on retourne
        else:
            return False

        if (self.__ssl):
            try:
                import ssl
                context = ssl._create_unverified_context()
            except:
                self.__ssl = False

        if 'uptobox' in self.__sHosterIdentifier:
            data = urlEncode(post_data)

            opener = urllib2.build_opener(NoRedirection)

            opener.addheaders = [('User-Agent', UA)]
            opener.addheaders.append(('Content-Type', 'application/x-www-form-urlencoded'))
            opener.addheaders.append(('Referer', str(url)))
            opener.addheaders.append(('Content-Length', str(len(data))))

            try:
                response = opener.open(url, data)
                head = response.info()
            except UrlError:
                return ''
        else:
            req = urllib2.Request(url, urlEncode(post_data), headers)

            try:
                if (self.__ssl):
                    response = urllib2.urlopen(req, context=context)
                else:
                    response = urllib2.urlopen(req)
            except UrlError as e:
                if getattr(e, "code", None) == 403:
                    # login denied
                    self.DIALOG.VSinfo('Authentification rate', self.__sDisplayName)
                elif getattr(e, "code", None) == 502:
                    # login denied
                    self.DIALOG.VSinfo('Authentification rate', self.__sDisplayName)
                elif getattr(e, "code", None) == 234:
                    # login denied
                    self.DIALOG.VSinfo('Authentification rate', self.__sDisplayName)
                else:
                    VSlog("debug" + str(getattr(e, "code", None)))
                    VSlog("debug" + str(getattr(e, "reason", None)))

                self.isLogin = False
                return False

            sHtmlContent = response.read()
            head = response.headers
            response.close()

        if 'uptobox' in self.__sHosterIdentifier:
            if 'xfss' in head['Set-Cookie']:
                self.isLogin = True
            else:
                self.DIALOG.VSinfo('Authentification rate', self.__sDisplayName)
                return False
        elif 'onefichier' in self.__sHosterIdentifier:
            if 'You are logged in. This page will redirect you.' in sHtmlContent:
                self.isLogin = True
            else:
                self.DIALOG.VSinfo('Authentification rate', self.__sDisplayName)
                return False
        elif 'uploaded' in self.__sHosterIdentifier:
            if sHtmlContent == '':
                self.isLogin = True
            else:
                self.DIALOG.VSinfo('Authentification rate', self.__sDisplayName)
                return False
        else:
            return False

        # get cookie
        cookies = ''
        if 'Set-Cookie' in head:
            oParser = cParser()
            sPattern = '(?:^|,) *([^;,]+?)=([^;,\/]+?);'
            aResult = oParser.parse(str(head['Set-Cookie']), sPattern)
            # print(aResult)
            if (aResult[0] == True):
                for cook in aResult[1]:
                    if 'deleted' in cook[1]:
                        continue
                    cookies = cookies + cook[0] + '=' + cook[1] + ';'

        # save cookie
        GestionCookie().SaveCookie(self.__sHosterIdentifier, cookies)

        self.DIALOG.VSinfo('Authentification reussie', self.__sDisplayName)
        VSlog('Auhentification reussie')

        return True
Esempio n. 12
0
    def __getMediaLinkForGuest(self):
        api_call = False

        headers = {
            "User-Agent":
            "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0",
            "Accept-Encoding": "gzip, deflate",
            "Origin": "https://geoip.redirect-ads.com"
        }

        req = urllib.Request(self.__sUrl, None, headers)
        with urllib.urlopen(req) as response:
            decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
            sHtmlContent = decomp.decompress(response.read())

        oParser = cParser()
        sPattern = '<script src="(.+?)"'
        aResult = oParser.parse(sHtmlContent, sPattern)

        urlJS = "https://geoip.redirect-ads.com" + aResult[1][-2]

        headers['Referer'] = self.__sUrl
        req = urllib.Request(urlJS, None, headers)
        with urllib.urlopen(req) as response:
            decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
            sHtmlContent = decomp.decompress(response.read()).decode('utf-8')

        #2ème partie des données.
        aResult1 = re.search('([^>]+)', sHtmlContent,
                             re.DOTALL | re.UNICODE).group(1)
        data = CheckAADecoder(aResult1)
        dataPartOne = json.loads(
            re.search('SoTrymConfigDefault = ([^>]+)"', data).group(1))

        urlJS = "https://geoip.redirect-ads.com" + aResult[1][-1]

        req = urllib.Request(urlJS, None, headers)
        with urllib.urlopen(req) as response:
            decomp = zlib.decompressobj(16 + zlib.MAX_WBITS)
            sHtmlContent = decomp.decompress(response.read()).decode('utf-8')

        #1er partie des données
        aResult2 = re.search('\}([^>]+)', sHtmlContent,
                             re.DOTALL | re.UNICODE).group(1)
        data = CheckAADecoder(aResult2)

        dataPartTwo = json.loads(
            base64.b64decode(re.search('atob\("(.+?)"', data).group(1)))

        from resources.lib.comaddon import dialog

        url = [dataPartOne["sd"], dataPartOne['hd']]
        qua = ["SD", "HD"]

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

        pathfile = VSPath(
            'special://userdata/addon_data/plugin.video.vstream/')

        HosterUrl = "https://cdn.heycdn21.xyz/{}/{}/{}/".format(
            dataPartTwo['md5_id'], ID[0], dataPartOne['pieceLength'])

        response = requests.get(HosterUrl + "0/", headers=headers).content
        b64response = base64.b64decode(response)

        with open(pathfile + "video.mp4", "wb") as fh:
            fh.write(b64response)

        duration = get_video_duration(pathfile + "video.mp4")
        splitDuration = str(duration / 79)

        data = '#EXTM3U\n#EXT-X-VERSION:3\n#EXT-X-TARGETDURATION:%s\n#EXT-X-MEDIA-SEQUENCE:0\n' % str(
            duration)

        i = 0
        while i < 80:
            data += '#EXTINF:%s,\n' % splitDuration
            data += "http://127.0.0.1:2424?u=" + HosterUrl + str(
                i) + "@" + urlEncode(headers) + ' \n'
            i = i + 1

        data += '#EXT-X-ENDLIST'

        with open(pathfile + "playlist.m3u8", 'w') as file:
            file.write(data)

        api_call = pathfile + "playlist.m3u8"

        if (api_call):
            return True, api_call

        return False, False
    def __callRequest(self):
        if self.__enableDNS:
            import socket
            self.save_getaddrinfo = socket.getaddrinfo
            socket.getaddrinfo = self.new_getaddrinfo

        if self.__aParamatersLine:
            sParameters = self.__aParamatersLine
        else:
            sParameters = urlEncode(self.__aParamaters)

        if (self.__cType == cRequestHandler.REQUEST_TYPE_GET):
            if (len(sParameters) > 0):
                if (self.__sUrl.find('?') == -1):
                    self.__sUrl = self.__sUrl + '?' + str(sParameters)
                    sParameters = ''
                else:
                    self.__sUrl = self.__sUrl + '&' + str(sParameters)
                    sParameters = ''

        if (len(sParameters) > 0):
            oRequest = urllib2.Request(self.__sUrl, sParameters)
        else:
            oRequest = urllib2.Request(self.__sUrl)

        for aHeader in self.__aHeaderEntries:
            for sHeaderKey, sHeaderValue in aHeader.items():
                oRequest.add_header(sHeaderKey, sHeaderValue)

        sContent = ''
        try:

            if self.BUG_SSL:
                VSlog('Retrying with SSL bug')
                import ssl
                gcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
                oResponse = urllib2.urlopen(oRequest,
                                            timeout=self.__timeout,
                                            context=gcontext)
            else:
                oResponse = urllib2.urlopen(oRequest, timeout=self.__timeout)

            sContent = oResponse.read()

            self.__sResponseHeader = oResponse.info()

            # compressed page ?
            if self.__sResponseHeader.get('Content-Encoding') == 'gzip':
                import zlib
                sContent = zlib.decompress(sContent, zlib.MAX_WBITS | 16)

            # https://bugs.python.org/issue4773
            self.__sRealUrl = oResponse.geturl()
            self.__sResponseHeader = oResponse.info()

            oResponse.close()

        except UrlError.HTTPError as e:
            if e.code == 503:

                # Protected by cloudFlare ?
                from resources.lib import cloudflare
                if cloudflare.CheckIfActive(e.read()):
                    self.__sResponseHeader = e.hdrs
                    cookies = self.GetCookies()
                    VSlog('Page protegee par cloudflare')
                    CF = cloudflare.CloudflareBypass()
                    sContent = CF.GetHtml(self.__sUrl, e.read(), cookies,
                                          sParameters, oRequest.headers)
                    self.__sRealUrl, self.__sResponseHeader = CF.GetReponseInfo(
                    )
                else:
                    sContent = e.read()
                    self.__sRealUrl = e.geturl()
                    self.__sResponseHeader = e.headers()

            else:
                try:
                    VSlog("%s (%d),%s" %
                          (self.ADDON.VSlang(30205), e.code, self.__sUrl))
                    self.__sRealUrl = e.geturl()
                    self.__sResponseHeader = e.headers
                    sContent = e.read()
                except:
                    sContent = ''

            if not sContent:
                self.DIALOG.VSerror(
                    "%s (%d),%s" %
                    (self.ADDON.VSlang(30205), e.code, self.__sUrl))

        except UrlError.URLError as e:
            if 'CERTIFICATE_VERIFY_FAILED' in str(
                    e.reason) and self.BUG_SSL == False:
                self.BUG_SSL = True
                return self.__callRequest()
            elif 'getaddrinfo failed' in str(
                    e.reason) and self.__enableDNS == False:
                # Retry with DNS only if addon is present
                import xbmcvfs
                if xbmcvfs.exists(
                        'special://home/addons/script.module.dnspython/'):
                    self.__enableDNS = True
                    return self.__callRequest()
                else:
                    error_msg = self.ADDON.VSlang(30470)
            else:
                error_msg = "%s (%s),%s" % (self.ADDON.VSlang(30205), e.reason,
                                            self.__sUrl)

            self.DIALOG.VSerror(error_msg)
            sContent = ''

        if sContent:
            if (self.__bRemoveNewLines == True):
                sContent = sContent.replace("\n", "")
                sContent = sContent.replace("\r\t", "")

            if (self.__bRemoveBreakLines == True):
                sContent = sContent.replace("&nbsp;", "")

        if self.__enableDNS:
            socket.getaddrinfo = self.save_getaddrinfo
            self.__enableDNS = False

        return sContent
Esempio n. 14
0
    def __callRequest(self, jsonDecode=False):
        if self.__enableDNS:
            import socket
            self.save_getaddrinfo = socket.getaddrinfo
            socket.getaddrinfo = self.new_getaddrinfo

        if self.__aParamatersLine:
            sParameters = self.__aParamatersLine
        else:
            sParameters = self.__aParamaters

        if (self.__cType == cRequestHandler.REQUEST_TYPE_GET):
            if (len(sParameters) > 0):
                if (self.__sUrl.find('?') == -1):
                    self.__sUrl = self.__sUrl + '?' + str(sParameters)
                    sParameters = ''
                else:
                    self.__sUrl = self.__sUrl + '&' + str(sParameters)
                    sParameters = ''

        sContent = ''

        if self.BUG_SSL == True:
            self.verify = False

        if self.__cType == cRequestHandler.REQUEST_TYPE_GET:
            method = "GET"
        else:
            method = "POST"

        oResponse = None
        try:
            _request = Request(method,
                               self.__sUrl,
                               headers=self.__aHeaderEntries)
            if method in ['POST']:
                _request.data = sParameters

            if self.__Cookie:
                _request.cookies = self.__Cookie

            if self.json:
                _request.json = self.json

            prepped = _request.prepare()
            self.s.headers.update(self.__aHeaderEntries)

            oResponse = self.s.send(prepped,
                                    timeout=self.__timeout,
                                    allow_redirects=self.redirects,
                                    verify=self.verify)
            self.__sResponseHeader = oResponse.headers
            self.__sRealUrl = oResponse.url

            if jsonDecode == False:
                sContent = oResponse.content

                #Necessaire pour Python 3
                if isMatrix() and not 'youtube' in oResponse.url:
                    try:
                        sContent = sContent.decode('unicode-escape')
                    except:
                        try:
                            sContent = sContent.decode()
                        except:
                            pass
            else:
                sContent = oResponse.json()

        except ConnectionError as e:
            # Retry with DNS only if addon is present
            import xbmcvfs
            if self.__enableDNS == False:
                if xbmcvfs.exists(
                        'special://home/addons/script.module.dnspython/'):
                    self.__enableDNS = True
                    return self.__callRequest()
                else:
                    error_msg = addon().VSlang(30470)
                    dialog().VSerror(error_msg)
                    sContent = ''
            else:
                sContent = ''
                return False

        except RequestException as e:
            if 'CERTIFICATE_VERIFY_FAILED' in str(e) and self.BUG_SSL == False:
                self.BUG_SSL = True
                return self.__callRequest()
            elif 'getaddrinfo failed' in str(e) and self.__enableDNS == False:
                # Retry with DNS only if addon is present
                import xbmcvfs
                if xbmcvfs.exists(
                        'special://home/addons/script.module.dnspython/'):
                    self.__enableDNS = True
                    return self.__callRequest()
                else:
                    error_msg = addon().VSlang(30470)
            else:
                error_msg = "%s (%s),%s" % (addon().VSlang(30205), e,
                                            self.__sUrl)

            dialog().VSerror(error_msg)
            sContent = ''

        if oResponse != None:
            if oResponse.status_code in [503, 403]:
                if not "Forbidden" in sContent:
                    #Default
                    CLOUDPROXY_ENDPOINT = 'http://localhost:8191/v1'

                    json_session = False

                    try:
                        json_session = post(CLOUDPROXY_ENDPOINT,
                                            headers=self.__aHeaderEntries,
                                            data=dumps(
                                                {'cmd': 'sessions.list'}))
                    except:
                        dialog().VSerror("%s" % (
                            "Page protege par Cloudflare, veuillez executer  FlareSolverr."
                        ))

                    if json_session:
                        #On regarde si une session existe deja.
                        if json_session.json()['sessions']:
                            cloudproxy_session = json_session.json(
                            )['sessions'][0]
                        else:
                            json_session = post(
                                CLOUDPROXY_ENDPOINT,
                                headers=self.__aHeaderEntries,
                                data=dumps({'cmd': 'sessions.create'}))
                            response_session = loads(json_session.text)
                            cloudproxy_session = response_session['session']

                        self.__aHeaderEntries[
                            'Content-Type'] = 'application/x-www-form-urlencoded' if (
                                method == 'post') else 'application/json'

                        #Ont fait une requete.
                        json_response = post(
                            CLOUDPROXY_ENDPOINT,
                            headers=self.__aHeaderEntries,
                            data=dumps({
                                'cmd':
                                'request.%s' % method.lower(),
                                'url':
                                self.__sUrl,
                                'session':
                                cloudproxy_session,
                                'postData':
                                '%s' % urlEncode(sParameters) if
                                (method.lower() == 'post') else ''
                            }))

                        http_code = json_response.status_code
                        response = loads(json_response.text)
                        if 'solution' in response:
                            if self.__sUrl != response['solution']['url']:
                                self.__sRealUrl = response['solution']['url']

                            sContent = response['solution']['response']

            if oResponse and not sContent:
                #Ignorer ces deux codes erreurs.
                ignoreStatus = [200, 302]
                if oResponse.status_code not in ignoreStatus:
                    dialog().VSerror("%s (%d),%s" %
                                     (addon().VSlang(30205),
                                      oResponse.status_code, self.__sUrl))

        if sContent:
            if (self.__bRemoveNewLines == True):
                sContent = sContent.replace("\n", "")
                sContent = sContent.replace("\r\t", "")

            if (self.__bRemoveBreakLines == True):
                sContent = sContent.replace("&nbsp;", "")

        if self.__enableDNS:
            socket.getaddrinfo = self.save_getaddrinfo
            self.__enableDNS = False

        return sContent
Esempio n. 15
0
def showMovies(sSearch=''):
    oGui = cGui()

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

    bGlobal_Search = False
    if sSearch:
        if URL_SEARCH[0] in sSearch:
            bGlobal_Search = True
            sSearch = sSearch.replace(URL_SEARCH[0], '')

        query_args = (('do', 'search'), ('subaction', 'search'),
                      ('story', sSearch), ('titleonly', '0'), ('full_search',
                                                               '1'))
        data = urlEncode(query_args)

        oRequestHandler = cRequestHandler(URL_SEARCH[0])
        oRequestHandler.setRequestType(1)
        oRequestHandler.addParametersLine(data)
        oRequestHandler.addHeaderEntry('User-Agent', UA)
        oRequestHandler.addHeaderEntry('Referer', URL_SEARCH[0])
        oRequestHandler.addHeaderEntry('Content-Type',
                                       'application/x-www-form-urlencoded')
        oRequestHandler.addHeaderEntry('Content-Length', str(len(data)))
        sHtmlContent = oRequestHandler.request()
    else:
        oRequestHandler = cRequestHandler(sUrl)
        sHtmlContent = oRequestHandler.request()

    if "/films/" in sUrl:
        sPattern = '<article class="short__story.+?href="([^"]+).+?data-src="([^"]+)" alt="([^"]+).+?pg">([^<]+).+?text">([^<]+)'
    else:
        sPattern = '<article class="short__story.+?href="([^"]+).+?data-src="([^"]+)" alt="([^"]+).+?pg">([^<]+).+?cat">([^<]+).+?text">([^<]+)'

    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

            sUrl2 = aEntry[0]
            sThumb = aEntry[1]
            if sThumb.startswith('/'):
                sThumb = URL_MAIN[:-1] + sThumb
            if "/films/" in sUrl:
                sTitle = aEntry[2]
                sQual = aEntry[3]
                sDesc = aEntry[4]
                sLang = ""
            else:
                sLang = aEntry[2].split(" ")[-1]
                sTitle = re.sub(
                    'Saison \d+', '', aEntry[2][:aEntry[2].rfind('')].replace(
                        sLang, "")) + " " + aEntry[4]
                sQual = aEntry[3]
                sDesc = aEntry[5]

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

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

            oGui.addAnime(SITE_IDENTIFIER, 'ShowSxE', sDisplayTitle, '',
                          sThumb, sDesc, oOutputParameterHandler)

        progress_.VSclose(progress_)

    if not sSearch:
        sNextPage = __checkForNextPage(sHtmlContent)
        if (sNextPage != False):
            oOutputParameterHandler = cOutputParameterHandler()
            oOutputParameterHandler.addParameter('siteUrl', sNextPage)
            sNumPage = re.search('/page/([0-9]+)', sNextPage).group(1)
            oGui.addNext(SITE_IDENTIFIER, 'showMovies', 'Page ' + sNumPage,
                         oOutputParameterHandler)

        oGui.setEndOfDirectory()
Esempio n. 16
0
def ResolveCaptcha(key, urlOuo):
    urlBase = 'https://www.google.com/recaptcha/api/fallback?k=' + key
    oRequestHandler = cRequestHandler(urlBase)
    oRequestHandler.addHeaderEntry('User-Agent', UA)
    oRequestHandler.addHeaderEntry('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
    oRequestHandler.addHeaderEntry('Accept-Language', 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3')
    oRequestHandler.addHeaderEntry('Accept-Encoding', 'gzip, deflate')
    oRequestHandler.addHeaderEntry('Referer', urlOuo)
    body = oRequestHandler.request()

    captchaScrap = re.findall('value="8"><img class="fbc-imageselect-payload" src="(.+?)"', str(body))

    text = re.search('<div class="rc-imageselect.+?">.+?<strong>(.+?)</strong>', str(body)).group(1)

    c = re.search('method="POST"><input type="hidden" name="c" value="(.+?)"', str(body)).group(1)
    k = re.search('k=(.+?)" alt=', str(body)).group(1)
    params = {"c": c, "k": k}
    query_string = urlEncode(params)

    url = 'https://www.google.com' + str(captchaScrap[0]) + '?' + query_string

    filePath = 'special://home/userdata/addon_data/plugin.video.vstream/Captcha.raw'

    oRequestHandler = cRequestHandler(url)
    htmlcontent = oRequestHandler.request()

    downloaded_image = xbmcvfs.File(filePath, 'wb')
    downloaded_image.write(htmlcontent)
    downloaded_image.close()

    oSolver = cInputWindow(captcha=filePath, msg=text, roundnum=1)
    retArg = oSolver.get()

    allNumber = [int(s) for s in re.findall('([0-9])', str(retArg))]
    responseFinal = ""
    for rep in allNumber:
        responseFinal = responseFinal + '&response=' + str(rep)

    headers = {'User-Agent': UA,
               'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
               'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
               'Accept-Encoding': 'gzip, deflate',
               'Referer': url,
               'Content-Type': 'application/x-www-form-urlencoded',
               'Content-Length': str(len(params))}

    params = 'c=' + c + responseFinal

    oRequestHandler = cRequestHandler(urlBase)
    oRequestHandler.setRequestType(1)
    oRequestHandler.addHeaderEntry('User-Agent', UA)
    oRequestHandler.addHeaderEntry('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
    oRequestHandler.addHeaderEntry('Accept-Language', 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3')
    oRequestHandler.addHeaderEntry('Accept-Encoding', 'gzip, deflate')
    oRequestHandler.addHeaderEntry('Referer', url)
    oRequestHandler.addHeaderEntry('Content-Type', 'application/x-www-form-urlencoded')
    oRequestHandler.addHeaderEntry('Content-Length', str(len(params)))
    oRequestHandler.addParametersLine(params)

    sHtmlContent = oRequestHandler.request()

    token = re.search('<textarea dir="ltr" readonly>(.+?)<', sHtmlContent).group(1)
    if not token:
        dialogs = dialog()
        dialogs.VSinfo("Captcha non valide")
    return token
Esempio n. 17
0
    def processCaptcha(self, key, lang, gcookieJar):
        headers = [("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0"),
                   # ("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"),
                   ("Referer", "https://www.google.com/recaptcha/api2/demo"),
                   ("Accept-Language", lang)]

        millis, rpc = self._prepare_time_and_rpc()
        co = base64.b64encode('https://www.google.com:443')
        botguardstring = "!A"
        vers, language, jsh, questionfile = self._collect_api_info()

        post_data = None
        token = ''
        iteration = 0
        reCaptchaUrl = 'http://www.google.com/recaptcha/api/fallback?k=%s' % key

        while iteration < 20:

            millis_captcha_loading = int(round(time.time() * 1000))

            # ,'cookiefile':self.COOKIE_FILE, 'use_cookie': True, 'load_cookie': True, 'save_cookie': True
            data = getUrl(reCaptchaUrl, headers=headers, post=post_data, cookieJar=gcookieJar)
            VSlog(reCaptchaUrl)
            imgUrl = re.search(r'"(/recaptcha/api2/payload[^"]+?)"', data).group(1)

            VSlog(imgUrl)
            iteration += 1
            message = self.ExtReg(r'<label[^>]+class="fbc-imageselect-message-text"[^>]*>(.*?)</label>', data)

            if '' == message:
                message = self.ExtReg(r'<div[^>]+class="fbc-imageselect-message-error">(.*?)</div>', data)
            if '' == message:
                token = re.search(r'"this\.select\(\)">(.*?)</textarea>', data).group(1)
                if '' != token:
                    VSlog('>>>>>>>> Captcha token[%s]' % token)
                else:
                    VSlog('>>>>>>>> Captcha Failed')
                break

            cval = re.search(r'name="c"\s+value="([^"]+)', data).group(1)
            imgUrl = 'https://www.google.com%s' % (imgUrl.replace('&amp;', '&'))
            accepLabel = re.search(r'type="submit"\s+value="([^"]+)', data).group(1)

            filePath = 'c://c.jpeg'
            import random
            n = random.randint(1, 1000)
            filePath = 'c://c' + str(n) + '.jpeg'

            VSlog(">>>>>>>> Captcha message[%s]" % message)
            VSlog(">>>>>>>> Captcha accep label[%s]" % accepLabel)
            VSlog(">>>>>>>> Captcha imgUrl[%s] filePath[%s]" % (imgUrl, filePath))

            # params = {'maintype': 'image', 'subtypes':['jpeg'], 'check_first_bytes':['\xFF\xD8', '\xFF\xD9']}
            # ret = self.cm.saveWebFile(filePath, imgUrl, params)
            # retArg = self.sessionEx.waitForFinishOpen(UnCaptchaReCaptchaWidget, imgFilePath=filePath, message=message, title="reCAPTCHA v2", additionalParams={'accep_label':accepLabel})

            ret = ''
            ret = getUrl(imgUrl, headers=headers, cookieJar=gcookieJar)
            downloaded_image = file(filePath, 'wb')
            downloaded_image.write(ret)
            downloaded_image.close()

            oSolver = cInputWindow(captcha=filePath, msg=message, roundnum=iteration)
            retArg = oSolver.get()
            VSlog('>>>>>>>> Captcha response [%s]' % retArg)

            responses = base64.b64encode('{"response":[%s]}' % retArg)
            # VSlog(responses)
            responses=responses.replace('=', '.')

            if retArg is not None and len(retArg) and retArg[0]:
                post_data = urlEncode({'c': cval, 'response': responses}, doseq=True)
            else:
                break

            if False:
                timeToSolve = int(round(time.time() * 1000)) - millis_captcha_loading
                timeToSolveMore = timeToSolve  # timeToSolve + int(float("0." + str(random.randint(1, 99999999))) * 500)

                postdata = urlEncode({'c': cval, 'response': responses, 'v': vers,
                                      't': timeToSolve, 'bg': botguardstring, 'ct': timeToSolveMore})
                html = getUrl('https://www.google.com/recaptcha/api2/userverify?k=' + key, post=postdata, headers=headers)
                # fh = open('c:\\test.txt', 'w')
                # fh.write(html)
                # fh.close()

        return token
Esempio n. 18
0
    def __getMediaLinkByPremiumUser(self):
        api_call = False

        if not self.oPremiumHandler.Authentificate():
            return False, False

        url = 'https://1fichier.com/?' + self.__getIdFromUrl(self.__sUrl)
        '''
        La partie ci-dessous permet d'utiliser l'option "Forcer l'affichage du menu pour les téléchargements" permettant
        notamment de choisir depuis l'interface web de télécharger ou d'ajouter un fichier.
        Pour cela, on va ajouter le paramètre e=1 (cf. https://1fichier.com/hlp.html#dev ) à la requête permettant
        d'obtenir le lien direct
        '''

        sHtmlContent = self.oPremiumHandler.GetHtml('%s' % url + '&e=1')
        if (sHtmlContent):
            # L'option est désactivée : la réponse sera de type "text/plain; charset=utf-8", exemple :
            # https://serveur-2b.1fichier.com/lelienactif;Film.de.Jacquie.et.Michel.a.la.montagne.mkv;1234567890;0
            m = re.search('^(.*);.*;.*;.*$', sHtmlContent)
            if (m):
                url = m.group(1)
            # L'option est activée : pour récupérer le lien direct il faut POSTer le formulaire demandant le download
            else:
                cookie = self.oPremiumHandler.AddCookies().replace(
                    'Cookie=', '', 1)
                data = {'submit': 'download'}
                # Seul le Cookie est nécessaire, néanmoins autant rendre les headers cohérents
                headers = {
                    'User-Agent': UA,
                    'Host': '1fichier.com',
                    'Referer': url,
                    'Accept':
                    'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                    'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
                    'Cookie': cookie,
                    'Content-Length': '15',
                    'Content-Type': 'application/x-www-form-urlencoded'
                }
                request = urllib2.Request(url, urlEncode(data), headers)
                try:
                    response = urllib2.urlopen(request)
                except UrlError as e:
                    print(e.read())
                    print(e.reason)
                # Par défaut on suit la redirection (code: 302 + entête 'Location') dans la réponse
                # on peut ainsi récupérer le lien direct
                url = response.geturl()
                response.close()
        else:
            return False, False

        # Mode = ''
        # Mode = {'dl_no_ssl': 'on' , 'dlinline': 'on'}
        # Mode = {'dl_no_ssl': 'on'}
        # postdata = urlEncode(Mode)

        # Pas de page html mais lien direct
        # sHtmlContent = self.oPremiumHandler.GetHtml(url, postdata)
        # fh = open('c:\\test.txt', "w")
        # fh.write(sHtmlContent)
        # fh.close()

        # mode inline
        # url = url + '&inline'

        api_call = url + '|' + self.oPremiumHandler.AddCookies()

        # VSlog(api_call)

        if (api_call):
            return True, api_call

        return False, False
 def getRequestUri(self):
     return self.__sUrl + '?' + urlEncode(self.__aParamaters)
Esempio n. 20
0
def showMovies(sSearch=''):
    oGui = cGui()
    oParser = cParser()
    oInputParameterHandler = cInputParameterHandler()
    nextPageSearch = oInputParameterHandler.getValue('nextPageSearch')
    sUrl = oInputParameterHandler.getValue('siteUrl')
    sMisc = oInputParameterHandler.getValue('misc') # Autre contenu

    if nextPageSearch:
        sSearch = sUrl

    if sSearch:

        if URL_SEARCH[0] in sSearch:
            sSearch = sSearch.replace(URL_SEARCH[0], '')

        if nextPageSearch:
            query_args = (('do', 'search'), ('subaction', 'search'), ('search_start', nextPageSearch), ('story', sSearch), ('titleonly', '3'))
        else:
            query_args = (('do', 'search'), ('subaction', 'search'), ('story', sSearch), ('titleonly', '3'))

        data = urlEncode(query_args)

        oRequestHandler = cRequestHandler(URL_SEARCH[0])
        oRequestHandler.setRequestType(cRequestHandler.REQUEST_TYPE_POST)
        oRequestHandler.addParametersLine(data)
        oRequestHandler.addParameters('User-Agent', UA)
        sHtmlContent = oRequestHandler.request()
        sHtmlContent = oParser.abParse(sHtmlContent, 'de la recherche', 'Nous contacter')
    else:
        oRequestHandler = cRequestHandler(sUrl)
        sHtmlContent = oRequestHandler.request()

    sPattern = 'class="top-last thumbnails" href="([^"]+)".+?"img-post" src="([^"]+).+?alt="([^"]+)'

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

    titles = set()

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

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

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

            # on enleve les softwares
            if 'PC' in aEntry[2]:  # for the search
                continue

            sUrl2 = aEntry[0]
            sThumb = aEntry[1]
            if ' - ' in aEntry[2]:
                sTitle = aEntry[2].split(' - ')[0]
                sQual = aEntry[2].split(' - ')[1].replace('Avec TRUEFRENCH', '').replace('TRUEFRENCH', '').replace('FRENCH ', '')
                if 'Saison' in sQual:  # Pour les séries et animes
                    # * et non pas + car parfois "Saison integrale" pas de chiffre
                    saison = re.search('(Saison [0-9]*)', sQual).group(1)
                    sTitle = sTitle + ' ' + saison
                    sQual = re.sub('Saison [0-9]+ ', '', sQual)
            else:
                sTitle = aEntry[2]#.replace('Avec TRUEFRENCH', '').replace('TRUEFRENCH', '').replace('FRENCH ', '')
                sQual = ''

            # Enlever les films en doublons (même titre et même pochette)
            # il s'agit du même film dans une autre qualité qu'on retrouvera au moment du choix de la qualité
            key = sTitle + "-" + sThumb
            if key in titles :
                continue
            titles.add(key)

            if sSearch and total > 5:
                if cUtil().CheckOccurence(sSearch, sTitle) == 0:
                    continue

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

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

            if sMisc:
                oGui.addMisc(SITE_IDENTIFIER, 'showMoviesLinks', sDisplayTitle, '', sThumb, '', oOutputParameterHandler)
            elif '/films-' in sUrl or '/manga-films/' in sUrl :
                oGui.addMovie(SITE_IDENTIFIER, 'showMoviesLinks', sDisplayTitle, '', sThumb, '', oOutputParameterHandler)
            elif '/mangas/' in sUrl:
                oGui.addAnime(SITE_IDENTIFIER, 'showSeriesLinks', sDisplayTitle, '', sThumb, '', oOutputParameterHandler)
            else:
                oGui.addTV(SITE_IDENTIFIER, 'showSeriesLinks', sDisplayTitle, '', sThumb, '', oOutputParameterHandler)

        progress_.VSclose(progress_)

        if sSearch:
            sPattern = '<a name="nextlink" id="nextlink" onclick="javascript:list_submit\(([0-9]+)\); return\(false\)" href="#">Suivant'
            aResult = oParser.parse(sHtmlContent, sPattern)
            if (aResult[0] == True):
                oOutputParameterHandler = cOutputParameterHandler()
                oOutputParameterHandler.addParameter('siteUrl', sSearch)
                oOutputParameterHandler.addParameter('misc', sMisc)
                oOutputParameterHandler.addParameter('nextPageSearch', aResult[1][0])
                number = re.search('([0-9]+)', aResult[1][0]).group(1)
                oGui.addNext(SITE_IDENTIFIER, 'showMovies', '[COLOR teal]Page ' + number + ' >>>[/COLOR]', oOutputParameterHandler)

        else:
            sNextPage = __checkForNextPage(sHtmlContent)
            if (sNextPage != False):
                oOutputParameterHandler = cOutputParameterHandler()
                oOutputParameterHandler.addParameter('siteUrl', sNextPage)
                oOutputParameterHandler.addParameter('misc', sMisc)
                number = re.search('/page/([0-9]+)', sNextPage).group(1)
                oGui.addNext(SITE_IDENTIFIER, 'showMovies', '[COLOR teal]Page ' + number + ' >>>[/COLOR]', oOutputParameterHandler)

    if nextPageSearch:
        oGui.setEndOfDirectory()

    if not sSearch:
        oGui.setEndOfDirectory()
Esempio n. 21
0
def showMovies(sSearch=''):
    oGui = cGui()
    oParser = cParser()

    if sSearch:
        sUrl = sSearch.replace(' ', '+')
    else:
        oInputParameterHandler = cInputParameterHandler()
        sUrl = oInputParameterHandler.getValue('siteUrl')

    Cookie = GestionCookie().Readcookie('time2watch')

    oRequestHandler = cRequestHandler(sUrl)
    if Cookie:
        oRequestHandler.addHeaderEntry('Cookie', Cookie)
    sHtmlContent = oRequestHandler.request()

    # Connection pour passer la limite
    if not 'Déconnexion' in sHtmlContent and ADDON.getSetting(
            'hoster_time2watch_premium') == "true":
        VSlog("Connection")

        data = {
            'username': ADDON.getSetting('hoster_time2watch_username'),
            'pwd': ADDON.getSetting('hoster_time2watch_password')
        }

        data = urlEncode(data)

        opener = Noredirection()

        opener.addheaders = [('User-Agent', UA)]
        opener.addheaders.append(
            ('Content-Type', 'application/x-www-form-urlencoded'))
        opener.addheaders.append(('Accept-Encoding', 'gzip, deflate'))
        opener.addheaders.append(('Content-Length', str(len(data))))

        response = opener.open("https://time2watch.io/login/", data)
        head = response.info()

        # get cookie
        Cookie = ''
        if 'Set-Cookie' in head:
            oParser = cParser()
            sPattern = '(?:^|,) *([^;,]+?)=([^;,\/]+?);'
            aResult = oParser.parse(str(head['Set-Cookie']), sPattern)
            # print(aResult)
            if (aResult[0] == True):
                for cook in aResult[1]:
                    if 'deleted' in cook[1]:
                        continue
                    Cookie = Cookie + cook[0] + '=' + cook[1] + ';'

        GestionCookie().SaveCookie('time2watch', Cookie)

        oRequestHandler = cRequestHandler(sUrl)
        oRequestHandler.addHeaderEntry('Cookie', Cookie)
        sHtmlContent = oRequestHandler.request()

    sPattern = '<div class="col-lg-4.+?<a href="([^"]+)">.+?affiche_liste" src="([^"]+)".+?alt="([^"]+)".+?<i class="fa fa-tv"></i>([^<]+)<.+?div class="synopsis_hover".+?>([^<]+)<'
    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)

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

            sUrl2 = URL_MAIN + aEntry[0]
            sThumb = URL_MAIN + aEntry[1]
            sTitle = aEntry[2]
            sQual = aEntry[3].replace(' ', '')
            sDesc = aEntry[4]

            sTitle = sTitle.replace('En streaming', '')

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

            oOutputParameterHandler = cOutputParameterHandler()
            oOutputParameterHandler.addParameter('siteUrl', sUrl2)
            oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
            oOutputParameterHandler.addParameter('sThumb', sThumb)
            oOutputParameterHandler.addParameter('sDesc', sDesc)
            oOutputParameterHandler.addParameter('sCookie', Cookie)

            if '/serie/' in sUrl2 or '/anime/' in sUrl2:
                oGui.addTV(SITE_IDENTIFIER, 'showSaisonEpisodes',
                           sDisplayTitle, '', sThumb, sDesc,
                           oOutputParameterHandler)
            else:
                oGui.addMovie(SITE_IDENTIFIER, 'showMoviesLink', sDisplayTitle,
                              '', sThumb, sDesc, oOutputParameterHandler)

        progress_.VSclose(progress_)

    if not sSearch:
        sNextPage = __checkForNextPage(sHtmlContent)
        if (sNextPage != False):
            oOutputParameterHandler = cOutputParameterHandler()
            oOutputParameterHandler.addParameter('siteUrl', sNextPage)
            number = re.search('/([0-9]+)', sNextPage).group(1)
            oGui.addNext(SITE_IDENTIFIER, 'showMovies',
                         '[COLOR teal]Page ' + number + ' >>>[/COLOR]',
                         oOutputParameterHandler)

        oGui.setEndOfDirectory()
Esempio n. 22
0
    def main(self, env):

        if (env == 'urlresolver'):
            addon('script.module.urlresolver').openSettings()
            return

        elif (env == 'metahandler'):
            addon('script.module.metahandler').openSettings()
            return

        elif (env == 'changelog_old'):
            try:
                sUrl = 'https://raw.githubusercontent.com/Kodi-vStream/venom-xbmc-addons/master/plugin.video.vstream/changelog.txt'
                oRequest = urllib2.Request(sUrl)
                oResponse = urllib2.urlopen(oRequest)
                sContent = oResponse.read()
                self.TextBoxes('vStream Changelog', sContent)
            except:
                self.DIALOG.VSerror("%s, %s" %
                                    (self.ADDON.VSlang(30205), sUrl))
            return

        elif (env == 'changelog'):

            class XMLDialog(xbmcgui.WindowXMLDialog):
                def __init__(self, *args, **kwargs):
                    xbmcgui.WindowXMLDialog.__init__(self)
                    pass

                def onInit(self):

                    self.container = self.getControl(6)
                    self.button = self.getControl(5)
                    self.getControl(3).setVisible(False)
                    self.getControl(1).setLabel('ChangeLog')
                    self.button.setLabel('OK')

                    sUrl = 'https://api.github.com/repos/Kodi-vStream/venom-xbmc-addons/commits'
                    oRequest = urllib2.Request(sUrl)
                    oResponse = urllib2.urlopen(oRequest)
                    sContent = oResponse.read()
                    result = json.loads(sContent)
                    listitems = []

                    for item in result:
                        # autor
                        icon = item['author']['avatar_url']
                        login = item['author']['login']
                        # message
                        try:
                            desc = item['commit']['message'].encode("utf-8")
                        except:
                            desc = 'None'

                        listitem = xbmcgui.ListItem(label=login, label2=desc)
                        listitem.setArt({'icon': icon, 'thumb': icon})

                        listitems.append(listitem)

                    self.container.addItems(listitems)
                    self.setFocus(self.container)

                def onClick(self, controlId):
                    self.close()
                    return

                def onFocus(self, controlId):
                    self.controlId = controlId

                def _close_dialog(self):
                    self.close()

            path = "special://home/addons/plugin.video.vstream"
            wd = XMLDialog('DialogSelect.xml', path, "Default")
            wd.doModal()
            del wd
            return

        elif (env == 'soutient'):
            try:
                sUrl = 'https://raw.githubusercontent.com/Kodi-vStream/venom-xbmc-addons/master/plugin.video.vstream/soutient.txt'
                oRequest = urllib2.Request(sUrl)
                oResponse = urllib2.urlopen(oRequest)
                sContent = oResponse.read()
                self.TextBoxes('vStream Soutient', sContent)
            except:
                self.DIALOG.VSerror("%s, %s" %
                                    (self.ADDON.VSlang(30205), sUrl))
            return

        elif (env == 'addon'):
            if self.DIALOG.VSyesno(self.ADDON.VSlang(30456)):
                cached_Cache = "special://home/userdata/addon_data/plugin.video.vstream/video_cache.db"
                try:
                    xbmcvfs.delete(cached_Cache)
                    self.DIALOG.VSinfo(self.ADDON.VSlang(30089))
                except:
                    self.DIALOG.VSerror(self.ADDON.VSlang(30087))

            return

        elif (env == 'clean'):
            liste = [
                'Historiques', 'Lecture en cours', 'Marqués vues',
                'Marque-Pages', 'Téléchargements'
            ]
            ret = self.DIALOG.select(self.ADDON.VSlang(30110), liste)
            cached_DB = "special://home/userdata/addon_data/plugin.video.vstream/vstream.db"
            # important seul xbmcvfs peux lire le special
            cached_DB = xbmc.translatePath(cached_DB).decode("utf-8")

            sql_drop = ""

            if ret > -1:

                if ret == 0:
                    sql_drop = "DROP TABLE history"
                elif ret == 1:
                    sql_drop = "DROP TABLE resume"
                elif ret == 2:
                    sql_drop = "DROP TABLE watched"
                elif ret == 3:
                    sql_drop = "DROP TABLE favorite"
                elif ret == 4:
                    sql_drop = "DROP TABLE download"

                try:
                    db = sqlite.connect(cached_DB)
                    dbcur = db.cursor()
                    dbcur.execute(sql_drop)
                    db.commit()
                    dbcur.close()
                    db.close()
                    self.DIALOG.VSok(self.ADDON.VSlang(30090))
                except:
                    self.DIALOG.VSerror(self.ADDON.VSlang(30091))

            return

        elif (env == 'xbmc'):
            if self.DIALOG.VSyesno(self.ADDON.VSlang(30456)):
                path = "special://temp/"
                try:
                    xbmcvfs.rmdir(path, True)
                    self.DIALOG.VSok(self.ADDON.VSlang(30092))
                except:
                    self.DIALOG.VSerror(self.ADDON.VSlang(30093))
            return

        elif (env == 'fi'):
            if self.DIALOG.VSyesno(self.ADDON.VSlang(30456)):
                path = "special://temp/archive_cache/"
                try:
                    xbmcvfs.rmdir(path, True)
                    self.DIALOG.VSok(self.ADDON.VSlang(30095))
                except:
                    self.DIALOG.VSerror(self.ADDON.VSlang(30096))
            return

        elif (env == 'uplog'):
            if self.DIALOG.VSyesno(self.ADDON.VSlang(30456)):
                path = "special://logpath/kodi.log"
                UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0'
                headers = {'User-Agent': UA}
                if xbmcvfs.exists(path):
                    post_data = {}
                    cUrl = 'http://slexy.org/index.php/submit'
                    logop = xbmcvfs.File(path, 'rb')
                    result = logop.read()
                    logop.close()
                    post_data['raw_paste'] = result
                    post_data['author'] = 'kodi.log'
                    post_data['language'] = 'text'
                    post_data['permissions'] = 1  # private
                    post_data['expire'] = 259200  # 3j
                    post_data['submit'] = 'Submit+Paste'
                    request = urllib2.Request(cUrl, urlEncode(post_data),
                                              headers)
                    reponse = urllib2.urlopen(request)
                    code = reponse.geturl().replace('http://slexy.org/view/',
                                                    '')
                    reponse.close()
                    self.ADDON.setSetting('service_log', code)
                    self.DIALOG.VSok(self.ADDON.VSlang(30097) + '  ' + code)
            return

        elif (env == 'search'):

            from resources.lib.handler.pluginHandler import cPluginHandler
            valid = '[COLOR green][x][/COLOR]'

            class XMLDialog(xbmcgui.WindowXMLDialog):

                ADDON = addon()

                def __init__(self, *args, **kwargs):
                    xbmcgui.WindowXMLDialog.__init__(self)
                    pass

                def onInit(self):

                    self.container = self.getControl(6)
                    self.button = self.getControl(5)
                    self.getControl(3).setVisible(False)
                    self.getControl(1).setLabel(self.ADDON.VSlang(30094))
                    self.button.setLabel('OK')
                    listitems = []
                    oPluginHandler = cPluginHandler()
                    aPlugins = oPluginHandler.getAllPlugins()

                    for aPlugin in aPlugins:
                        # teste si deja dans le dsip
                        sPluginSettingsName = 'plugin_' + aPlugin[1]
                        bPlugin = self.ADDON.getSetting(sPluginSettingsName)

                        icon = "special://home/addons/plugin.video.vstream/resources/art/sites/%s.png" % aPlugin[
                            1]
                        stitle = aPlugin[0].replace('[COLOR violet]', '').replace('[COLOR orange]', '')\
                                           .replace('[/COLOR]', '').replace('[COLOR dodgerblue]', '')\
                                           .replace('[COLOR coral]', '')
                        if (bPlugin == 'true'):
                            stitle = ('%s %s') % (stitle, valid)
                        listitem = xbmcgui.ListItem(label=stitle,
                                                    label2=aPlugin[2])
                        listitem.setArt({'icon': icon, 'thumb': icon})
                        listitem.setProperty('Addon.Summary', aPlugin[2])
                        listitem.setProperty('sitename', aPlugin[1])
                        if (bPlugin == 'true'):
                            listitem.select(True)

                        listitems.append(listitem)

                    self.container.addItems(listitems)
                    self.setFocus(self.container)

                def onClick(self, controlId):
                    if controlId == 5:
                        self.close()
                        return
                    elif controlId == 99:
                        window = xbmcgui.Window(xbmcgui.getCurrentWindowId())
                        del window
                        self.close()
                        return
                    elif controlId == 7:
                        window = xbmcgui.Window(xbmcgui.getCurrentWindowId())
                        del window
                        self.close()
                        return
                    elif controlId == 6:
                        item = self.container.getSelectedItem()
                        if item.isSelected() == True:
                            label = item.getLabel().replace(valid, '')
                            item.setLabel(label)
                            item.select(False)
                            sPluginSettingsName = ('plugin_%s') % (
                                item.getProperty('sitename'))
                            self.ADDON.setSetting(sPluginSettingsName,
                                                  str('false'))
                        else:
                            label = ('%s %s') % (item.getLabel(), valid)
                            item.setLabel(label)
                            item.select(True)
                            sPluginSettingsName = ('plugin_%s') % (
                                item.getProperty('sitename'))
                            self.ADDON.setSetting(sPluginSettingsName,
                                                  str('true'))
                        return

                def onFocus(self, controlId):
                    self.controlId = controlId

                def _close_dialog(self):
                    self.close()

                # def onAction(self, action):
                # if action.getId() in (9, 10, 92, 216, 247, 257, 275, 61467, 61448):
                # self.close()

            path = "special://home/addons/plugin.video.vstream"
            wd = XMLDialog('DialogSelect.xml', path, "Default")
            wd.doModal()
            del wd
            return

        elif (env == 'thumb'):

            if self.DIALOG.VSyesno(self.ADDON.VSlang(30098)):

                text = False
                path = "special://userdata/Thumbnails/"
                path_DB = "special://userdata/Database"
                try:
                    xbmcvfs.rmdir(path, True)
                    text = 'Clear Thumbnail Folder, Successful[CR]'
                except:
                    text = 'Clear Thumbnail Folder, Error[CR]'

                folder, items = xbmcvfs.listdir(path_DB)
                items.sort()
                for sItemName in items:
                    if "extures" in sItemName:
                        cached_Cache = "/".join([path_DB, sItemName])
                        try:
                            xbmcvfs.delete(cached_Cache)
                            text += 'Clear Thumbnail DB, Successful[CR]'
                        except:
                            text += 'Clear Thumbnail DB, Error[CR]'

                if text:
                    text = "%s (Important relancer Kodi)" % text
                    self.DIALOG.VSok(text)
            return

        elif (env == 'sauv'):
            select = self.DIALOG.VSselect(['Import', 'Export'])
            DB = "special://home/userdata/addon_data/plugin.video.vstream/vstream.db"
            if select >= 0:
                new = self.DIALOG.browse(3, 'vStream', "files")
                if new:
                    try:
                        if select == 0:
                            xbmcvfs.delete(DB)
                            # copy(source, destination)--copy file to destination, returns true/false.
                            xbmcvfs.copy(new + 'vstream.db', DB)
                        elif select == 1:
                            # copy(source, destination)--copy file to destination, returns true/false.
                            xbmcvfs.copy(DB, new + 'vstream.db')
                        self.DIALOG.VSinfo(self.ADDON.VSlang(30099))
                    except:
                        self.DIALOG.VSerror(self.ADDON.VSlang(30100))

                return

        else:
            return

        return
    def getParameterAsUri(self):
        if len(self.__aParams) > 0:
            return urlEncode(self.__aParams)

        return 'params=0'
Esempio n. 24
0
def showMovies(sSearch=''):
    oGui = cGui()
    oParser = cParser()
    oInputParameterHandler = cInputParameterHandler()
    Nextpagesearch = oInputParameterHandler.getValue('Nextpagesearch')
    sUrl = oInputParameterHandler.getValue('siteUrl')

    bGlobal_Search = False

    if Nextpagesearch:
        sSearch = sUrl

    if sSearch:

        if URL_SEARCH[0] in sSearch:
            bGlobal_Search = True
            sSearch = sSearch.replace(URL_SEARCH[0], '')

        # sType = oInputParameterHandler.getValue('type')

        if Nextpagesearch:
            query_args = (('do', 'search'), ('subaction', 'search'), ('search_start', Nextpagesearch), ('story', sSearch))
        else:
            query_args = (('do', 'search'), ('subaction', 'search'), ('story', sSearch), ('titleonly', '3'))

        data = urlEncode(query_args)

        oRequestHandler = cRequestHandler(URL_SEARCH[0])
        oRequestHandler.setRequestType(cRequestHandler.REQUEST_TYPE_POST)
        oRequestHandler.addParametersLine(data)
        oRequestHandler.addParameters('User-Agent', UA)
        sHtmlContent = oRequestHandler.request()

        # if (sType):
           # if sType == 'serie':
               # oRequestHandler.addParameters('catlist[]', '30')
           # elif sType == 'film':
               # oRequestHandler.addParameters('catlist[]', '3')

        sHtmlContent = oRequestHandler.request()

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

        oRequestHandler = cRequestHandler(sUrl)
        sHtmlContent = oRequestHandler.request()

    sPattern = '<div class="fullstream fullstreaming">\s*<img src="([^"]+)"[^<>]+alt="([^"]+)".+?<h3 class="mov-title"><a href="([^"]+)".+?<strong>(?:Qualité|Version)(.+?)<\/*strong>.+?xfsearch.+?">([^<]+)'
    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)
        for aEntry in aResult[1]:
            progress_.VSupdate(progress_, total)
            if progress_.iscanceled():
                break

            sThumb = aEntry[0]
            if sThumb.startswith('/'):
                sThumb = URL_MAIN[:-1] + sThumb

            siteUrl = aEntry[2]
            sTitle = aEntry[1]
            sQual = cUtil().removeHtmlTags(aEntry[3])
            sQual = sQual.replace(':', '').replace(' ', '').replace(',', '/')
            sYear = aEntry[4]

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

            oOutputParameterHandler = cOutputParameterHandler()
            oOutputParameterHandler.addParameter('siteUrl', siteUrl)
            oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
            oOutputParameterHandler.addParameter('sThumb', sThumb)

            oGui.addMovie(SITE_IDENTIFIER, 'showHosters', sDisplayTitle, 'films.png', sThumb, '', oOutputParameterHandler)

        progress_.VSclose(progress_)

        if sSearch:
            sPattern = '<a name="nextlink" id="nextlink" onclick="javascript:list_submit\(([0-9]+)\); return\(false\)" href="#">Suivant'
            aResult = oParser.parse(sHtmlContent, sPattern)
            if (aResult[0] == True):
                oOutputParameterHandler = cOutputParameterHandler()
                oOutputParameterHandler.addParameter('siteUrl', sSearch)
                oOutputParameterHandler.addParameter('Nextpagesearch', aResult[1][0])
                oGui.addNext(SITE_IDENTIFIER, 'showMovies', '[COLOR teal]Suivant >>>[/COLOR]', oOutputParameterHandler)

        else:
            sNextPage = __checkForNextPage(sHtmlContent)
            if (sNextPage != False):
                oOutputParameterHandler = cOutputParameterHandler()
                oOutputParameterHandler.addParameter('siteUrl', sNextPage)
                oGui.addNext(SITE_IDENTIFIER, 'showMovies', '[COLOR teal]Suivant >>>[/COLOR]', oOutputParameterHandler)

    if Nextpagesearch:
        oGui.setEndOfDirectory()

    if not sSearch:
        oGui.setEndOfDirectory()