示例#1
0
 def extractIframeValue(iframe, html, referer):
     file = ""
     if iframe.find("http:") != 0:
         iframe = Decoder.extract("<iframe src='", "' ", html).replace(
             "'",
             "")  #take into account .lower() characters, so is not ' SRC=
         if iframe.find("http:") != 0:
             iframe = Decoder.extract(' src="', '"', html).replace('"', "")
     logger.debug("using iframeUrl: " + iframe)
     if iframe.find(
             "filmon."
     ) > -1:  # i prefer this fix to change all logic, really, I boried about this provider and is a 'silly' provider
         logger.debug("Detected exceptional filmon.com|tv provider: " +
                      iframe)
         file = Filmoncom.launchScriptLogic(iframe, referer)[0]["url"]
     else:
         html2 = Cricfreetv.getContentFromUrl(iframe, "", Cricfreetv.cookie,
                                              referer)
         #print html2
         if html2.find("http://www3.sawlive.tv/embed/") > -1:
             iframe2 = Decoder.extractWithRegex(
                 "http://www3.sawlive.tv/embed/", '"',
                 html2).replace('"', "")
             logger.debug("detected a sawlive: " + iframe2 + ", from: " +
                          iframe)
             #file = Live9net.getChannels(iframe2) #Live9net has the sawlive decoder, so it decodes target link
             file = Decoder.extractSawlive(iframe2, Cricfreetv.cookie,
                                           iframe)
         else:
             file = Cricfreetv.seekIframeScript(html2, referer, iframe)
     return file
示例#2
0
def drawFilmon(page):
    jsonChannels = Filmoncom.getChannelsJSON()
    for itemFirst in jsonChannels:
        if page == "0":
            add_dir(itemFirst["title"],
                    "http://www.filmon.com/tv/" + itemFirst["alias"], 4, icon,
                    "filmoncom", itemFirst["title"])
        elif (page == itemFirst["title"]) and itemFirst.has_key("channels"):
            for item in itemFirst["channels"]:
                add_dir(item["title"],
                        "http://www.filmon.com/tv/" + item["alias"], 5,
                        item["logo"], "filmoncom", item["title"])
        else:
            logger.info("no channel: " + page)
示例#3
0
 def extractIframeValue(iframe,html,referer):
     file = ""
     if iframe.find("http:")!=0:
         iframe = Decoder.extract("<iframe src='","' ",html).replace("'","") #take into account .lower() characters, so is not ' SRC=
         if iframe.find("http:")!=0:
             iframe = Decoder.extract(' src="','"',html).replace('"',"")
     logger.debug("using iframeUrl: "+iframe)
     if iframe.find("filmon.")>-1: # i prefer this fix to change all logic, really, I boried about this provider and is a 'silly' provider
         logger.debug("Detected exceptional filmon.com|tv provider: "+iframe)
         file = Filmoncom.launchScriptLogic(iframe,referer)[0]["url"]
     else:
         html2 = Cricfreetv.getContentFromUrl(iframe,"",Cricfreetv.cookie,referer)
         #print html2
         if html2.find("http://www3.sawlive.tv/embed/")>-1:
             iframe2 = Decoder.extractWithRegex("http://www3.sawlive.tv/embed/",'"',html2).replace('"',"")
             logger.debug("detected a sawlive: "+iframe2+", from: "+iframe)
             #file = Live9net.getChannels(iframe2) #Live9net has the sawlive decoder, so it decodes target link
             file = Decoder.extractSawlive(iframe2,Cricfreetv.cookie,iframe)
         else:
             file = Cricfreetv.seekIframeScript(html2,referer,iframe)
     return file
示例#4
0
def drawFilmon(page):
    jsonChannels = Filmoncom.getChannelsJSON()
    for itemFirst in jsonChannels:
        if page == "0":
            add_dir(
                itemFirst["title"],
                "http://www.filmon.com/tv/" + itemFirst["alias"],
                4,
                icon,
                "filmoncom",
                itemFirst["title"],
            )
        elif (page == itemFirst["title"]) and itemFirst.has_key("channels"):
            for item in itemFirst["channels"]:
                add_dir(
                    item["title"],
                    "http://www.filmon.com/tv/" + item["alias"],
                    5,
                    item["logo"],
                    "filmoncom",
                    item["title"],
                )
        else:
            logger.info("no channel: " + page)
示例#5
0
def drawFilmonLinks(url, page, provider=""):
    finalUrls = Filmoncom.getChannelUrl(url)
    for finalUrl in finalUrls:
        add_dir(page + ", " + finalUrl["name"], finalUrl["url"], 2, provider,
                page)
示例#6
0
    def seekIframeScript(html,referer, iframeUrl):
        lastIframeHtml = html
        file = ""
        logger.debug("seek iframe logic... ")
        if html.find("http://theactionlive.com/live")>-1:
            file = Cricfreetv.launchScriptLogic("http://theactionlive.com/live",html,referer,iframeUrl)
        elif html.find('http://biggestplayer.me/play')>-1:
            file = Cricfreetv.launchScriptLogic("http://biggestplayer.me/play",html,referer,iframeUrl)
        elif html.find("http://www.yotv.co/play")>-1:
            file = Cricfreetv.launchScriptLogic("http://www.yotv.co/play",html,referer,iframeUrl)
        elif html.find("http://www.yocast.tv/embed")>-1:
            file = Cricfreetv.launchScriptLogic("http://www.yocast.tv/embed",html,referer,iframeUrl)
        elif html.find("http://www.rocktv.co/play")>-1:
            file = Cricfreetv.launchScriptLogic("http://www.rocktv.co/play",html,referer,iframeUrl)
        elif html.find("http://miplayer.net/embed")>-1:
            file = Cricfreetv.launchScriptLogic("http://miplayer.net/embed",html,referer,iframeUrl)
        elif html.find("http://www.cast4u.tv/embed")>-1:
            file = Cricfreetv.launchScriptLogic("http://www.cast4u.tv/embed",html,referer,iframeUrl)
        elif html.find("http://www.cast4u.tv/Player")>-1:
            file = Cricfreetv.launchScriptLogic("http://www.cast4u.tv/Playercr", html, referer, iframeUrl)
        elif html.find("http://www.topcast.live/embed")>-1:
            file = Cricfreetv.launchScriptLogic("http://www.topcast.live/embed", html, referer, iframeUrl)
        elif 'http://www.webtv.ws/player' in html:
            file = Cricfreetv.launchScriptLogic("http://www.webtv.ws/player", html, referer, iframeUrl)
        elif "http://www.hdcast.info/embed.js" in html:
            id = Decoder.extract('fid="','"',html)
            scriptUrl = "http://www.hdcast.info/embed.php?live="+id+"&vw=620&vh=490"
            logger.debug("using script url: "+scriptUrl)
            lastIframeHtml = Cricfreetv.getContentFromUrl(scriptUrl, "", Cricfreetv.cookie, iframeUrl)
            logger.debug("html is: "+lastIframeHtml)
            lastIframeHtml = Decoder.rExtract("<body","</body>",lastIframeHtml)
            file = Cricfreetv.seekIframeScript(lastIframeHtml, iframeUrl, scriptUrl)
        elif html.find("http://violadito.biggestplayer.me/playercr.js")>-1:
            id = Decoder.extract("<script type='text/javascript'>id='","'",html)
            logger.debug("violadito id="+id)
            #newUrl = "http://lqgq.biggestplayer.me/streamcr.php?id="+id+"&width=620&height=460"
            jsLogic = Cricfreetv.getContentFromUrl('http://violadito.biggestplayer.me/playercr.js',"",Cricfreetv.cookie,iframeUrl)
            try:
                jsLogic = jsunpack.unpack(jsLogic)
                logger.debug("jsLogic: "+jsLogic)
                newUrl = Decoder.extractWithRegex('http://','"',jsLogic).replace("\\'+id+\\'",str(id))
            except:
                logger.debug("could not use unpack from jsunpack, using new method...")
                logger.debug("jsLogic is: " + jsLogic)
                newUrl = Decoder.extract(' src="', '"', jsLogic).replace("'+id+'", id)
                pass
            logger.debug("using referer: "+iframeUrl)
            html2 = Cricfreetv.getContentFromUrl(newUrl,"",Cricfreetv.cookie,iframeUrl)
            logger.debug("extracting file from "+newUrl)
            if html2.find('file: "')>-1:
                file = Decoder.extract('file: "','"',html2)
            logger.debug("obtained file: "+file)
        elif html.find("http://www.filmon.com/tv/")>-1:
            url = Decoder.extractWithRegex("http://www.filmon.com/tv/",'"',html).replace('"',"")
            logger.debug("using first filmon.com url from provider, url: "+url+", r: "+referer)
            file = Filmoncom.launchScriptLogic(url,referer)[0]["url"]
        elif html.find('file: "http')>-1: #found final link
            file = Decoder.extract('file: "','"',html)
            logger.debug("found final link: "+file)
        elif html.find('return(["r","t","m","p"')>-1: #changed order to build final url first

            swfUrl = "http://cdn.ibrod.tv/player/jwplayer.flash.swf"
            if 'cast4u.tv' in html:
                swfUrl = "http://cast4u.tv/jwplayer/jwplayer.flash.swf"
            elif 'http://www.hdcast.info/video-js/video-js.swf' in html:
                swfUrl = "http://www.hdcast.info/video-js/video-js.swf"

            if '<script type="text/javascript">\nvar' in html:
                scriptSplit = '<script type="text/javascript">\nvar'
            elif '<script type="text/javascript">\n\nvar' in html:
                scriptSplit = '<script type="text/javascript">\n\nvar'

            bruteData = Decoder.extract(scriptSplit,"</script>",html)

            rtmp = ""
            file = Decoder.extract('file: ','}],',bruteData).replace(' ','')
            logger.debug("file form is: "+file)
            playpath = ""
            for functionName in file.split('+'):
                if functionName.find("/")==-1:
                    logger.debug("using function: "+functionName)
                    bruteData2 = Decoder.extract('function '+functionName+' {',"}",bruteData)
                    line = Decoder.extract('return([',');',bruteData2)
                    #now begin the fix
                    for linePart in line.split("+"):
                        if '].join' in linePart:
                            linePart = linePart[:linePart.find('].join')]
                            linePart2 = linePart.replace('","',"").replace('"','').replace('\\',"").replace(",","")
                            logger.debug("at this moment linePart1 is: "+linePart2)
                            rtmp+=linePart2
                            if '/' not in linePart2:
                                playpath = linePart2
                        elif 'document.getElementById' in linePart:
                            #extract id and get content
                            idSpan = Decoder.extract('(',')',linePart).replace("\"","").replace("'","")
                            content = Decoder.extract(' id='+idSpan+'>','</span>',html)
                            logger.debug("at this moment linePart2 is: " + content)
                            rtmp+=content
                        elif 'join("")' in linePart:
                            #array to join with a replace like first condition
                            idArrayVar = linePart.replace('.join("")','').replace(' ','')
                            content = Decoder.extract('var '+idArrayVar+" = [","];",bruteData).replace(",","").replace('"','')
                            logger.debug("at this moment linePart3 is: " + content)
                            rtmp+=content
                else:
                    rtmp+="/"
                logger.debug("at this moment final rtmp is: " + rtmp)
            '''
            token = ""

            if bruteData.find('securetoken: ')>-1:
                token = Decoder.extract('securetoken: ','\n',bruteData)
                swfUrlJS = 'http://cast4u.tv/jwplayer/jwplayer.js?v=3.3'
                htmlToken = Cricfreetv.getContentFromUrl(url=swfUrlJS)
                token = Decoder.extract('var '+token+' = "','"',htmlToken)

            logger.debug("Fresh token is: "+token)
            '''
            if "/live" in rtmp:
                app = 'live'+Decoder.extract('/live','==/',rtmp)+"==/"
            else: #/hd
                app = 'hd' + Decoder.extract('/hd', '==/', rtmp) + "==/"

            file = rtmp+" app="+app+" playpath="+playpath+r" token=%XB00(nKH@#. flashver=WIN\2021,0,0,182 timeout=30 live=1 swfUrl="+swfUrl+" pageUrl="+iframeUrl+""

            logger.debug("Built a rtmp with data: "+file)
        elif html.find('securetoken:')>-1:
            logger.debug("building final link from html: "+html)
            file = Decoder.extract('file: "','"',html)
            securetoken = Decoder.extract('securetoken: "','"',html)
            #logger.debug(html)
            flashPlayer = 'http://p.jwpcdn.com/6/12/jwplayer.flash.swf'
            tokenString = ""
            if "html>" not in securetoken:
                tokenString = " token="+securetoken
            else:
                jsUrl = Decoder.rExtract('<script type="text/javascript" src="','" ></script>',html)
                jsContent = Cricfreetv.getContentFromUrl(url=jsUrl)
                var = Decoder.extract('securetoken: ',"\n",html)
                logger.debug("seeking var: "+var)
                tokenString = Decoder.extract('var '+var+" = \"",'";',jsContent)
                logger.debug("new token string is: "+tokenString)
                tokenString = " token="+tokenString
            rtmpUrl = file[0:file.rfind('/')+1]+" playpath="+file[file.rfind('/')+1:]+tokenString+" swfUrl="+flashPlayer+" live=1 timeout=13 pageUrl="+iframeUrl
            logger.debug("found final link: "+rtmpUrl)
            file = rtmpUrl
        elif html.find("eval(unescape('")>-1:
            html = Cricfreetv.decodeContent(html).lower()
        elif html.find('<a href="http://sports4u.tv/channel')>-1 or html.find('http://sports4u.tv/embed/')>-1:
            if html.find('http://sports4u.tv/embed/')>-1:
                urlLink = Decoder.extractWithRegex('http://sports4u.tv/embed/','"',html).replace('"',"")
                logger.debug("seek new iframe url with: "+urlLink)
                html2 = Cricfreetv.getContentFromUrl(urlLink,"",Cricfreetv.cookie,iframeUrl)
                file = Cricfreetv.seekIframeScript(html2,iframeUrl,urlLink)
            elif html.find('<a href="http://sports4u.tv/channel')>-1:
                logger.debug("urlLink...")
                urlLink = Decoder.extractWithRegex('<a href="http://sports4u.tv/channel','/"',html)
                logger.debug("urlLink2..."+urlLink)
                urlLink = urlLink[urlLink.find('"')+1:urlLink.rfind('"')]
                logger.debug("urlLinkFinal..."+urlLink)
                if urlLink != iframeUrl:
                    urlLink = urlLink.replace(".tv/",".pw/")
                    html2 = Cricfreetv.getContentFromUrl(url=urlLink,cookie=Cricfreetv.cookie,referer=iframeUrl)
                    logger.debug("html2 is: "+html2)
                    file = Cricfreetv.seekIframeScript(html2,iframeUrl,urlLink)
                    if file=='':
                        #extract iframe value
                        iframe = Decoder.extract('<iframe frameborder="0" marginheight="0" marginWidth="0" height="490" id="iframe" src="','" id="',html).replace('"',"")
                        file = Cricfreetv.extractIframeValue(iframe,html,referer)
        elif ' src="http://cricfree.sx/' in html:
            #it's a cricfree.sx native page, so launch this logic
            urlLink = Decoder.extractWithRegex('http://cricfree.sx/', '"', html).replace('"', "")
            logger.debug("seek new http://cricfree.sx/ iframe url with: " + urlLink)
            html2 = Cricfreetv.getContentFromUrl(urlLink, "", Cricfreetv.cookie, iframeUrl)
            file = Cricfreetv.seekIframeScript(html2, iframeUrl, urlLink)
        elif 'http://sports4u.pw/embed/' in html:
            logger.debug("repeating proccess...")
            newOldUrl = Decoder.extractWithRegex('http://sports4u.pw/embed/','"',html).replace('"','')
            logger.debug("new old url is: "+newOldUrl)
            html2 = Cricfreetv.getContentFromUrl(url=newOldUrl, referer=iframeUrl)
            logger.debug("html is: " + html2)
            file = Cricfreetv.seekIframeScript(html2, iframeUrl, newOldUrl)
        else:

            if html.find('<iframe id="player" scrolling="no" width="620" height="490" allowtransparency="no" frameborder="0" src="')>-1:
                iframe = Decoder.extract('<iframe id="player" scrolling="no" width="620" height="490" allowtransparency="no" frameborder="0" src="','"',html)
                file = Cricfreetv.extractIframeValue(iframe,html,referer)
            elif html.find('<iframe ')>-1: #brute method forced
                logger.debug("brute method launched...")
                iframe = Decoder.rExtract('<iframe ','</iframe>',html)
                iframe = Decoder.extract('src="','"',iframe)
                file = Cricfreetv.extractIframeValue(iframe,html,referer)
            else:
                logger.debug(html)

        return file
示例#7
0
def drawFilmonLinks(url, page, provider=""):
    finalUrls = Filmoncom.getChannelUrl(url)
    for finalUrl in finalUrls:
        add_dir(page + ", " + finalUrl["name"], finalUrl["url"], 2, provider, page)
示例#8
0
    def seekIframeScript(html, referer, iframeUrl):
        lastIframeHtml = html
        file = ""
        logger.debug("seek iframe logic... ")
        if html.find("http://theactionlive.com/live") > -1:
            file = Cricfreetv.launchScriptLogic(
                "http://theactionlive.com/live", html, referer, iframeUrl)
        elif html.find('http://biggestplayer.me/play') > -1:
            file = Cricfreetv.launchScriptLogic("http://biggestplayer.me/play",
                                                html, referer, iframeUrl)
        elif html.find("http://www.yotv.co/play") > -1:
            file = Cricfreetv.launchScriptLogic("http://www.yotv.co/play",
                                                html, referer, iframeUrl)
        elif html.find("http://www.yocast.tv/embed") > -1:
            file = Cricfreetv.launchScriptLogic("http://www.yocast.tv/embed",
                                                html, referer, iframeUrl)
        elif html.find("http://www.rocktv.co/play") > -1:
            file = Cricfreetv.launchScriptLogic("http://www.rocktv.co/play",
                                                html, referer, iframeUrl)
        elif html.find("http://miplayer.net/embed") > -1:
            file = Cricfreetv.launchScriptLogic("http://miplayer.net/embed",
                                                html, referer, iframeUrl)
        elif html.find("http://www.cast4u.tv/embed") > -1:
            file = Cricfreetv.launchScriptLogic("http://www.cast4u.tv/embed",
                                                html, referer, iframeUrl)
        elif html.find("http://www.cast4u.tv/Player") > -1:
            file = Cricfreetv.launchScriptLogic(
                "http://www.cast4u.tv/Playercr", html, referer, iframeUrl)
        elif html.find("http://www.topcast.live/embed") > -1:
            file = Cricfreetv.launchScriptLogic(
                "http://www.topcast.live/embed", html, referer, iframeUrl)
        elif 'http://www.webtv.ws/player' in html:
            file = Cricfreetv.launchScriptLogic("http://www.webtv.ws/player",
                                                html, referer, iframeUrl)
        elif "http://www.hdcast.info/embed.js" in html:
            id = Decoder.extract('fid="', '"', html)
            scriptUrl = "http://www.hdcast.info/embed.php?live=" + id + "&vw=620&vh=490"
            logger.debug("using script url: " + scriptUrl)
            lastIframeHtml = Cricfreetv.getContentFromUrl(
                scriptUrl, "", Cricfreetv.cookie, iframeUrl)
            logger.debug("html is: " + lastIframeHtml)
            lastIframeHtml = Decoder.rExtract("<body", "</body>",
                                              lastIframeHtml)
            file = Cricfreetv.seekIframeScript(lastIframeHtml, iframeUrl,
                                               scriptUrl)
        elif html.find("http://violadito.biggestplayer.me/playercr.js") > -1:
            id = Decoder.extract("<script type='text/javascript'>id='", "'",
                                 html)
            logger.debug("violadito id=" + id)
            #newUrl = "http://lqgq.biggestplayer.me/streamcr.php?id="+id+"&width=620&height=460"
            jsLogic = Cricfreetv.getContentFromUrl(
                'http://violadito.biggestplayer.me/playercr.js', "",
                Cricfreetv.cookie, iframeUrl)
            try:
                jsLogic = jsunpack.unpack(jsLogic)
                logger.debug("jsLogic: " + jsLogic)
                newUrl = Decoder.extractWithRegex('http://', '"',
                                                  jsLogic).replace(
                                                      "\\'+id+\\'", str(id))
            except:
                logger.debug(
                    "could not use unpack from jsunpack, using new method...")
                logger.debug("jsLogic is: " + jsLogic)
                newUrl = Decoder.extract(' src="', '"',
                                         jsLogic).replace("'+id+'", id)
                pass
            logger.debug("using referer: " + iframeUrl)
            html2 = Cricfreetv.getContentFromUrl(newUrl, "", Cricfreetv.cookie,
                                                 iframeUrl)
            logger.debug("extracting file from " + newUrl)
            if html2.find('file: "') > -1:
                file = Decoder.extract('file: "', '"', html2)
            logger.debug("obtained file: " + file)
        elif 'file: "rtmp:' in html:  # found final link
            logger.debug("detected rtmp link...")
            rtmp = "rtmp:" + Decoder.extract('file: "rtmp:', '"', html)
            swfJS = Decoder.extract('<script src="', '"',
                                    html[html.find('<div id="myElement">'):])
            jsContent = Downloader.getContentFromUrl(url=swfJS,
                                                     referer=referer)
            swfUrl = Decoder.extract('"flashplayer": "', '"', jsContent)
            if "http:" not in swfUrl:
                swfUrl = "http:" + swfUrl
            logger.debug("swfUrl is: " + swfUrl)
            logger.debug("iframeUrl is: " + iframeUrl)
            logger.debug("referer is: " + referer)

            link = rtmp + " swfUrl=" + swfUrl + " pageUrl=" + iframeUrl
            logger.debug("final rtmp link built is: " + link)
            file = link
        elif 'file: "http' in html:  # found final link
            logger.debug("using http file extractor...")
            file = "http" + Decoder.extract('file: "http', '"', html)
            file += "|" + Downloader.getHeaders(
                iframeUrl)  #TODO review this part
            logger.debug("found final link: " + file)
        elif html.find("http://www.filmon.com/tv/") > -1:
            url = Decoder.extractWithRegex("http://www.filmon.com/tv/", '"',
                                           html).replace('"', "")
            logger.debug("using first filmon.com url from provider, url: " +
                         url + ", r: " + referer)
            file = Filmoncom.launchScriptLogic(url, referer)[0]["url"]
        elif html.find('return(["r","t","m","p"'
                       ) > -1:  #changed order to build final url first
            logger.debug("launching array logic for rtmp link...")
            swfUrl = "http://cdn.ibrod.tv/player/jwplayer.flash.swf"
            if 'cast4u.tv' in html:
                swfUrl = "http://cast4u.tv/jwplayer/jwplayer.flash.swf"
            elif 'http://www.hdcast.info/video-js/video-js.swf' in html:
                swfUrl = "http://www.hdcast.info/video-js/video-js.swf"

            if '<script type="text/javascript">\nvar' in html:
                scriptSplit = '<script type="text/javascript">\nvar'
            elif '<script type="text/javascript">\n\nvar' in html:
                scriptSplit = '<script type="text/javascript">\n\nvar'

            bruteData = Decoder.extract(scriptSplit, "</script>", html)

            rtmp = ""
            file = Decoder.extract('file: ', '}],', bruteData).replace(' ', '')
            logger.debug("file form is: " + file)
            playpath = ""
            for functionName in file.split('+'):
                if functionName.find("/") == -1:
                    logger.debug("using function: " + functionName)
                    bruteData2 = Decoder.extract(
                        'function ' + functionName + ' {', "}", bruteData)
                    line = Decoder.extract('return([', ');', bruteData2)
                    #now begin the fix
                    for linePart in line.split("+"):
                        if '].join' in linePart:
                            linePart = linePart[:linePart.find('].join')]
                            linePart2 = linePart.replace('","', "").replace(
                                '"', '').replace('\\', "").replace(",", "")
                            logger.debug("at this moment linePart1 is: " +
                                         linePart2)
                            rtmp += linePart2
                            if '/' not in linePart2:
                                playpath = linePart2
                        elif 'document.getElementById' in linePart:
                            #extract id and get content
                            idSpan = Decoder.extract('(', ')',
                                                     linePart).replace(
                                                         "\"",
                                                         "").replace("'", "")
                            content = Decoder.extract(' id=' + idSpan + '>',
                                                      '</span>', html)
                            logger.debug("at this moment linePart2 is: " +
                                         content)
                            rtmp += content
                        elif 'join("")' in linePart:
                            #array to join with a replace like first condition
                            idArrayVar = linePart.replace('.join("")',
                                                          '').replace(' ', '')
                            content = Decoder.extract(
                                'var ' + idArrayVar + " = [", "];",
                                bruteData).replace(",", "").replace('"', '')
                            logger.debug("at this moment linePart3 is: " +
                                         content)
                            rtmp += content
                else:
                    rtmp += "/"
                logger.debug("at this moment final rtmp is: " + rtmp)
            '''
            token = ""

            if bruteData.find('securetoken: ')>-1:
                token = Decoder.extract('securetoken: ','\n',bruteData)
                swfUrlJS = 'http://cast4u.tv/jwplayer/jwplayer.js?v=3.3'
                htmlToken = Cricfreetv.getContentFromUrl(url=swfUrlJS)
                token = Decoder.extract('var '+token+' = "','"',htmlToken)

            logger.debug("Fresh token is: "+token)
            '''
            if "/live" in rtmp:
                app = 'live' + Decoder.extract('/live', '==/', rtmp) + "==/"
            else:  #/hd
                app = 'hd' + Decoder.extract('/hd', '==/', rtmp) + "==/"

            file = rtmp + " app=" + app + " playpath=" + playpath + r" token=%XB00(nKH@#. flashver=WIN\2021,0,0,182 timeout=30 live=1 swfUrl=" + swfUrl + " pageUrl=" + iframeUrl + ""

            logger.debug("Built a rtmp with data: " + file)
        elif html.find('securetoken:') > -1:
            logger.debug("building final link from html: " + html)
            file = Decoder.extract('file: "', '"', html)
            securetoken = Decoder.extract('securetoken: "', '"', html)
            #logger.debug(html)
            flashPlayer = 'http://p.jwpcdn.com/6/12/jwplayer.flash.swf'
            tokenString = ""
            if "html>" not in securetoken:
                tokenString = " token=" + securetoken
            else:
                jsUrl = Decoder.rExtract(
                    '<script type="text/javascript" src="', '" ></script>',
                    html)
                jsContent = Cricfreetv.getContentFromUrl(url=jsUrl)
                var = Decoder.extract('securetoken: ', "\n", html)
                logger.debug("seeking var: " + var)
                tokenString = Decoder.extract('var ' + var + " = \"", '";',
                                              jsContent)
                logger.debug("new token string is: " + tokenString)
                tokenString = " token=" + tokenString
            rtmpUrl = file[0:file.rfind('/') + 1] + " playpath=" + file[
                file.rfind('/') +
                1:] + tokenString + " swfUrl=" + flashPlayer + " live=1 timeout=13 pageUrl=" + iframeUrl
            logger.debug("found final link: " + rtmpUrl)
            file = rtmpUrl
        elif html.find("eval(unescape('") > -1:
            logger.debug("eval unescape js logic...")
            html = Cricfreetv.decodeContent(html).lower()
        elif html.find('<a href="http://sports4u.tv/channel'
                       ) > -1 or html.find('http://sports4u.tv/embed/') > -1:
            logger.debug("embed link logic...")
            if html.find('http://sports4u.tv/embed/') > -1:
                urlLink = Decoder.extractWithRegex('http://sports4u.tv/embed/',
                                                   '"', html).replace('"', "")
                logger.debug("seek new iframe url with: " + urlLink)
                html2 = Cricfreetv.getContentFromUrl(urlLink, "",
                                                     Cricfreetv.cookie,
                                                     iframeUrl)
                file = Cricfreetv.seekIframeScript(html2, iframeUrl, urlLink)
            elif html.find('<a href="http://sports4u.tv/channel') > -1:
                logger.debug("urlLink...")
                urlLink = Decoder.extractWithRegex(
                    '<a href="http://sports4u.tv/channel', '/"', html)
                logger.debug("urlLink2..." + urlLink)
                urlLink = urlLink[urlLink.find('"') + 1:urlLink.rfind('"')]
                logger.debug("urlLinkFinal..." + urlLink)
                if urlLink != iframeUrl:
                    urlLink = urlLink.replace(".tv/", ".pw/")
                    html2 = Cricfreetv.getContentFromUrl(
                        url=urlLink,
                        cookie=Cricfreetv.cookie,
                        referer=iframeUrl)
                    logger.debug("html2 is: " + html2)
                    file = Cricfreetv.seekIframeScript(html2, iframeUrl,
                                                       urlLink)
                    if file == '':
                        #extract iframe value
                        iframe = Decoder.extract(
                            '<iframe frameborder="0" marginheight="0" marginWidth="0" height="490" id="iframe" src="',
                            '" id="', html).replace('"', "")
                        file = Cricfreetv.extractIframeValue(
                            iframe, html, referer)
        elif ' src="http://cricfree.sx/' in html:
            logger.debug("native cricfree.sx logic")
            #it's a cricfree.sx native page, so launch this logic
            urlLink = Decoder.extractWithRegex('http://cricfree.sx/', '"',
                                               html).replace('"', "")
            logger.debug("seek new http://cricfree.sx/ iframe url with: " +
                         urlLink)
            html2 = Cricfreetv.getContentFromUrl(urlLink, "",
                                                 Cricfreetv.cookie, iframeUrl)
            file = Cricfreetv.seekIframeScript(html2, iframeUrl, urlLink)
        elif 'http://sports4u.pw/embed/' in html:
            logger.debug("repeating proccess...")
            newOldUrl = Decoder.extractWithRegex('http://sports4u.pw/embed/',
                                                 '"', html).replace('"', '')
            logger.debug("new old url is: " + newOldUrl)
            html2 = Cricfreetv.getContentFromUrl(url=newOldUrl,
                                                 referer=iframeUrl)
            logger.debug("html is: " + html2)
            file = Cricfreetv.seekIframeScript(html2, iframeUrl, newOldUrl)
        else:
            logger.debug("enterring to ELSE logic")
            if html.find(
                    '<iframe id="player" scrolling="no" width="620" height="490" allowtransparency="no" frameborder="0" src="'
            ) > -1:
                iframe = Decoder.extract(
                    '<iframe id="player" scrolling="no" width="620" height="490" allowtransparency="no" frameborder="0" src="',
                    '"', html)
                file = Cricfreetv.extractIframeValue(iframe, html, referer)
            elif html.find('<iframe ') > -1:  # brute method forced
                logger.debug("brute method launched...")
                logger.debug("referer is: " + referer)
                logger.debug("iframeUrl is: " + iframeUrl)
                iframe = Decoder.rExtract('<iframe ', '</iframe>', html)
                iframe = Decoder.extract('src="', '"', iframe)
                if iframe == referer or iframe == iframeUrl:
                    logger.debug("is the same page so needs to be changed!")
                    logger.debug("html is: " + html)
                    for content in html.split(".php"):
                        link = content[content.rfind('"') + 1:] + ".php"
                        logger.debug("target ELSE link is: " + link)
                        if "http://" in link and "/update/" not in link and "/update/" in iframeUrl:
                            logger.debug("ELSE link has been updated from: " +
                                         iframeUrl + ", to: " + link)
                            iframe = link
                    if iframe != referer and iframe != iframeUrl:
                        logger.debug("fixed the same url, continue...")
                        file = Cricfreetv.extractIframeValue(
                            iframe, html, referer)
                    else:
                        logger.debug("NOT fixed the same url, stopping...")
                else:
                    file = Cricfreetv.extractIframeValue(iframe, html, referer)
            else:
                logger.debug(html)
        return file