Exemplo n.º 1
0
    def getChannels(page):
        x = []
        start = False
        if str(page) == '0':
            html = ShowsportTvCom.getContentFromUrl(ShowsportTvCom.MAIN_URL)
            element = {}
            element["link"] = '1'
            element["title"] = 'Display by event'
            x.append(element)
            if html.find('<div id="cssmenu">')>-1: #build channels menu from provider
                cssMenu = Decoder.extract('<div id="cssmenu">','</ul>',html)
                for htmlElement in cssMenu.split('<li class="has-sub">'):
                    if htmlElement.find('<a href="')>-1:
                        element = {}
                        link = Decoder.extract('<a href="','"',htmlElement)
                        if htmlElement.find(' title="')>-1:
                            title = Decoder.extract(' title="','"',htmlElement)
                        img = Decoder.extract('img src="/','"',htmlElement)
                        element["title"] = title
                        element["link"] = ShowsportTvCom.MAIN_URL+link
                        element["thumbnail"] = ShowsportTvCom.MAIN_URL+img
                        logger.debug("found element: "+title+", url: "+element["link"])
                        if title != '':
                            x.append(element)
        elif str(page) == '1': #show by events
            html = ShowsportTvCom.getContentFromUrl(ShowsportTvCom.MAIN_URL)
            html = Decoder.extract('<div class="listmatch">','<div id="right_content">',html)
            for htmlElement in html.split('<div class="leaguelogo column">'):
                if htmlElement.find(' href="')>-1:
                    href = Decoder.extract(' href="','">',htmlElement)
                    timeHtml = Decoder.extract('<div class="date_time column"><span class="','</span></div>',htmlElement)
                    time = ""
                    if timeHtml.find('</span><span')>-1:
                        time = Decoder.extract('>','</span><span',timeHtml)
                        time+= " - "+timeHtml[timeHtml.rfind(">")+1:]
                    name = Decoder.extract('png"><span>','</span></div>',htmlElement)
                    logger.debug("first name is: "+name)
                    if htmlElement.find('px;">')>-1 and htmlElement.find('</span><img')>-1:
                        name += " vs "+Decoder.extract('px;">','</span><img',htmlElement)
                    logger.debug("final name is: "+name)
                    element = {}
                    if time=='':
                        element["title"] = name
                    else:
                        element["title"] = time+" - "+name
                    element["link"] = ShowsportTvCom.MAIN_URL+href
                    logger.debug("appending event: "+element["title"])
                    if element["title"].find(" vs ")>-1:
                        x.append(element)
        else: #open link
            html = ShowsportTvCom.getContentFromUrl(page)
            iframeUrl = ShowsportTvCom.MAIN_URL+Decoder.extract('<iframe frameborder="0" marginheight="0" marginwidth="0" height="450" src="/','"',html)
            logger.debug("iframeUrl is: "+iframeUrl)
            html2 = ShowsportTvCom.getContentFromUrl(iframeUrl,"",ShowsportTvCom.cookie,page)
            if html2.find("http://www.caston.tv/player.php?")>-1:
                id = Decoder.extract("var id = "," ;",html2)
                url2 = "http://www.caston.tv/player.php?id="+id
                html3 = ShowsportTvCom.getContentFromUrl(url2,"id="+id,ShowsportTvCom.cookie,iframeUrl)
                script = Decoder.extract('<script type="text/javascript">\n','</script>',html3)
                if script.find("document.write(unescape('")>-1: #patch
                    scriptContent = Decoder.extract("document.write(unescape('","'));",script)
                    scriptContent = urllib.unquote(scriptContent)
                    script=re.compile('eval\(function\(w,i,s,e\).*}\((.*?)\)').findall(scriptContent)[0]
                finalScriptContent = Decoder.preWise(script)
                logger.debug(finalScriptContent)
                token = Decoder.extract("token:\"","\"",finalScriptContent)
                logger.debug("pre-token is: "+token)
                ajaxContent = dict(token=token, is_ajax=1)
                #logger.debug(html3)
                tokenResponse = ShowsportTvCom.getContentFromUrl("http://www.caston.tv/sssss.php",urllib.urlencode(ajaxContent),ShowsportTvCom.cookie,url2,True)
                logger.debug("token response: "+tokenResponse)
                file = Decoder.extract("file:\"","\"",finalScriptContent)+Decoder.extract('","','",',tokenResponse)+"&e="+Decoder.rExtract(',',']',tokenResponse)+"|Referer=http://p.jwpcdn.com/6/12/jwplayer.flash.swf"
            elif html2.find("http://www.sostart.pw/js/embed.js")>-1:
                fid = Decoder.extract('<script type="text/javascript"> fid="','"',html2)
                url3 = "http://www.sostart.pw/jwplayer6.php?channel="+fid
                html3 = ShowsportTvCom.getContentFromUrl(url3,"",ShowsportTvCom.cookie,iframeUrl)
                if html3.find("http://static.bro.adca.st/broadcast/player.js")>-1:
                    id2 = Decoder.extract("<script type='text/javascript'>id='","';",html3)
                    logger.debug("using id = "+id2)
                    url4 = "http://bro.adcast.site/stream.php?id="+id2+"&width=700&height=450&stretching=uniform"
                    html4 = ShowsportTvCom.getContentFromUrl(url4,"",ShowsportTvCom.cookie,url3)
                    logger.debug("html4: "+html4)
                    curl = Decoder.extract('curl = "','"',html4)
                    token = ShowsportTvCom.getContentFromUrl('http://bro.adcast.site/getToken.php',"",ShowsportTvCom.cookie,url4,True)
                    logger.debug("token: "+token)
                    token = Decoder.extract('":"','"',token)
                    file = base64.decodestring(curl)+token+"|"+Downloader.getHeaders('http://cdn.bro.adcast.site/jwplayer.flash.swf')
                    logger.debug("final url is: "+file)
            elif html2.find("http://www.iguide.to/embed")>-1:
                nextIframeUrl = Decoder.extractWithRegex('http://www.iguide.to/embed','"',html2).replace('"',"")
                file = Decoder.decodeIguide(nextIframeUrl,iframeUrl)
            elif "/embedplayer.php" in html2:
                nextIframeUrl = ShowsportTvCom.MAIN_URL+Decoder.extractWithRegex('/embedplayer.php', "'", html2).replace("'", "")
                logger.debug("next loop will use: "+nextIframeUrl)
                file = ShowsportTvCom.getChannels(nextIframeUrl)
            elif html2.find("adca.st/stream.php")>-1:
                token = False
                if "http://bro.adca.st/stream.php" not in html2:
                    token = True
                    id2 = Decoder.extract("<script type='text/javascript'>id='","';",html2)
                    logger.debug("using id = "+id2)
                    url4 = "http://bro.adcast.site/stream.php?id="+id2+"&width=700&height=450&stretching=uniform"
                else: #it's built, not needed extract id
                    url4 = Decoder.extractWithRegex("http://bro.adca.st/stream.php",'"',html2)
                html4 = ShowsportTvCom.getContentFromUrl(url4,"",ShowsportTvCom.cookie,iframeUrl)
                logger.debug("html4: "+html4)
                curl = Decoder.extract('curl = "','"',html4)

                tokenUrl = "http://bro.adca.st/getToken.php"
                swfUrl = "http://cdn.allofme.site/jw/jwplayer.flash.swf"
                if token:
                    tokenUrl = 'http://bro.adcast.site/getToken.php'
                    swfUrl = 'http://cdn.bro.adcast.site/jwplayer.flash.swf'

                token = ShowsportTvCom.getContentFromUrl(tokenUrl,"",ShowsportTvCom.cookie,url4,True)
                logger.debug("token: "+token)
                token = Decoder.extract('":"','"',token)


                file = base64.decodestring(curl)+token+"|"+Downloader.getHeaders(swfUrl)
                logger.debug("final url is: "+file)
            else:
                logger.debug("trying crickfreetv way...: "+html2)
                file = Cricfreetv.seekIframeScript(html2, page, page)
            logger.debug("final remote url: "+file)
            element = {}
            element["link"] = file
            element["permaLink"] = True
            element["title"] = "Watch streaming"
            x.append(element)
        return x
Exemplo n.º 2
0
    def getChannels(page):
        x = []
        element = {}
        if str(page) == '0':
            page=Vipracinginfo.MAIN_URL3
            html = Vipracinginfo.getContentFromUrl(page,"",Vipracinginfo.cookie,"")
            #print html
            if html.find("var channels = JSON.parse('")>-1: #it's a list, needs decode
                table = Decoder.extract("var channels = JSON.parse('","'),",html)
                table = table.replace('\u00f3','ó').replace('\u00f1','ñ').replace('\/',"-")#.replace('"',"'")
                x = Vipracinginfo.extractElements(table,Vipracinginfo.MAIN_URL3)
                logger.debug("Vipracing channels logic done!")
            else:
                #change domain to alternative and repeat the same logic
                html = Vipracinginfo.getContentFromUrl(Vipracinginfo.MAIN_URL3,"",Vipracinginfo.cookie,"")
                #print html
                if html.find("var channels = JSON.parse('")>-1: #it's a list, needs decode
                    table = Decoder.extract("var channels = JSON.parse('","'),",html)
                    table = table.replace('\u00f3','ó').replace('\u00f1','ñ').replace('\/',"-")#.replace('"',"'")
                    x = Vipracinginfo.extractElements(table,Vipracinginfo.MAIN_URL3)
                    logger.debug("done with the second loop, detected channels: "+str(len(x)))
        else:
            html = Vipracinginfo.getContentFromUrl(url=page)
            logger.debug("html: " + html)
            logger.debug("launching Vipracing else logic")
            if html.find('http://www.streamlive.to/embed/')>-1:
                link = Decoder.decodeStreamliveto(html,page)
                element["link"] = link
                element["title"] = Decoder.extract("<title>","</title>",html)
                element["permalink"] = True
                x.append(element)
            elif html.find("http://www.janjua.tv")!=-1:
                channel = Decoder.extract(" width=653, height=410, channel='","'",html)
                url2 = "http://www.janjuaplayer.com/embedplayer/"+channel+"/1/653/410"
                html2 = Vipracinginfo.getContentFromUrl(url2,"",Vipracinginfo.cookie,page)
                bruteContent = Decoder.extract("so.addParam('FlashVars', '","');",html2)
                #extract id and pk
                id = bruteContent[0:bruteContent.find("&")]
                pk = bruteContent[bruteContent.find('pk='):]
                # loadbalancer is http://www.janjuapublisher.com:1935/loadbalancer?53346
                ip = Vipracinginfo.getContentFromUrl("http://www.janjuapublisher.com:1935/loadbalancer?"+(id[id.find("=")+1:]),"","","http://www.janjuaplayer.com/resources/scripts/eplayer.swf").replace('redirect=','')
                link = "rtmp://"+ip+"/live"+" swfUrl=http://www.janjuaplayer.com/resources/scripts/eplayer.swf pageUrl="+url2+" flashver=WIN/2019,0,0,226 live=true timeout=11 playpath="+channel+"?"+id+"&"+pk
                link = "rtmp://"+ip+"/live"+channel+"?"+id+"&"+pk+" app=live pageUrl="+url2+" swfUrl=http://www.janjuaplayer.com/resources/scripts/eplayer.swf tcUrl=rtmp://"+ip+"/live playPath="+channel+"?"+id+"&"+pk+" conn=S:OK live=1 flashver=WIN/2019,0,0,226"
                element["link"] = link
                element["title"] = channel
                element["permalink"] = True
                x.append(element)
            else:
                logger.debug("launching Vipracing else ELSE logic (other provider embed - max-deportv)")
                html2 = ""
                if ' SRC="' in html:
                    iframeUrl = Decoder.extract(' SRC="','"',html)
                    html2 = Vipracinginfo.getContentFromUrl(iframeUrl, "", Vipracinginfo.cookie, page)
                elif '<iframe name="vipracing" src="' in html:
                    iframeUrl = Decoder.extract('<iframe name="vipracing" src="','"',html)
                    html2 = Vipracinginfo.getContentFromUrl(iframeUrl)
                logger.debug("html2 is: "+html2)
                if 'http://max-deportv' in html2:
                    logger.debug("using max-deportv way")
                    iframeUrl2 = Decoder.extractWithRegex("http://max-deportv",'"',html2)
                    iframeUrl2 = iframeUrl2[0:len(iframeUrl2)-1]
                    logger.debug("using iframeUrl: "+iframeUrl2)
                    html3 = Vipracinginfo.getContentFromUrl(iframeUrl2,"",Vipracinginfo.cookie,iframeUrl)
                    iframeUrl3 = Decoder.extractWithRegex('http://www.iguide.to/embed/','">',html3)
                    iframeUrl3 = iframeUrl3[:len(iframeUrl3)-1]
                    #extract channelId
                    channelId = Decoder.extract('embed/','&',iframeUrl3)
                    iframeUrl3 = "http://www.iguide.to/embedplayer_new.php?width=650&height=400&channel="+channelId+"&autoplay=true"
                    link = Decoder.decodeIguide(iframeUrl3,iframeUrl2)
                elif 'http://www.streamlive.to' in html2:
                    streamLiveScript = Decoder.extractWithRegex('http://www.streamlive.to','"',html2).replace('"','')
                    link = Decoder.decodeStreamliveto(streamLiveScript, iframeUrl)
                    logger.debug("using streamlive way...")
                elif '<iframe name="vipracing" src="http://vipracing.' in html:
                    logger.debug("detected vipracing embed iframe, other loop...")
                    iframeUrlLoop = Decoder.extract('<iframe name="vipracing" src="','"',html)
                    element2 = Vipracinginfo.getChannels(iframeUrlLoop)[0]
                    link = element2["link"]
                    page = element2["title"]
                elif '247bay.tv/static/scripts/247bay.js' in html:
                    channel = Decoder.extract(", channel='","'",html)
                    url2 = 'http://www.247bay.tv/embedplayer/'+channel+'/2/653/410'
                    link = Decoder.decode247bay(url2,page)
                elif 'castalba.tv/js/embed.js' in html:
                    cid = Decoder.extract(' id="','"',html)
                    link = 'http://www.castalba.tv/embed.php?cid='+cid+'&wh=653&ht=410&d=vipracing.info'
                    link = Decoder.decodeCastalbatv(link, page)
                elif 'http://cricfree.sc/update/' in html:
                    frameUrl = Decoder.extractWithRegex('http://cricfree.sc/update','.php',html)
                    link = Cricfreetv.getChannels(frameUrl)[0]["link"]
                elif 'http://crichd.tv/update/' in html:
                    frameUrl = Decoder.extractWithRegex('http://crichd.tv/update/',".php",html)
                    link = Cricfreetv.getChannels(frameUrl)[0]["link"]
                    #html2 = Downloader.getContentFromUrl(url=frameUrl)
                    #if 'cast4u' in html2:
                    #    url2 = "http://www.cast4u.tv/embedcr.php?v="+Decoder.extract('fid=\'','\'',html2)+"&vw=620&vh=490"
                    #    link = Cricfreetv.extractIframe(url2,frameUrl)[0]["link"]

                else:
                    logger.debug("Nothing done: "+html+", \nhtml2: "+html2)
                element["link"] = link
                element["title"] = page
                element["permalink"] = True
                x.append(element)
        return x