Beispiel #1
0
 def extractAllVideosFromHtml(html):
     x = []
     tableHtml = Decoder.extract('class="item-section">','<div class="branded-page-box search-pager',html)
     i=0
     for rowHtml in tableHtml.split('<div class="yt-lockup-dismissable yt-uix-tile">'):
         if i>0:
             logger.debug("row html is: "+rowHtml)
             element = {}
             link = "/watch?"+Decoder.extract('href="/watch?', '"', rowHtml)
             title = Decoder.extract('  title="','"', rowHtml)
             if 'youtube.com' not in link:
                 link = Youtube.MAIN_URL+link
             logger.debug("link: " + link + ", title is: " + title)
             image = Decoder.extractWithRegex('https://i.ytimg.com/','"',rowHtml).replace('"','')
             element["title"] = title
             element["page"] = link
             if '&amp;list=' not in link:
                 element["finalLink"] = True
             element["thumbnail"] = image
             x.append(element)
         i+=1
     #add next if pagination exists
     if '<div class="branded-page-box search-pager  spf-link ">' in html:
         bruteHtmlPaginate = Decoder.rExtract('<div class="branded-page-box search-pager  spf-link ">','<div class="branded-page-v2-secondary-col">',html)
         title = Decoder.rExtract(">","</span></a>",bruteHtmlPaginate)
         title = title[:len(title)-2]
         link = Decoder.rExtract('href="','" class="yt-uix-button', bruteHtmlPaginate)
         if 'youtube.com' not in link:
             link = Youtube.MAIN_URL + link
         element = {}
         element["title"] = title
         element["page"] = link
         logger.debug("link: " + link + ", title is: " + title)
         x.append(element)
     return x
Beispiel #2
0
 def extractElements(table):
     x = []
     i = 0
     for value in table.split('<a '):
         logger.debug("loop: "+str(i))
         if i>0:
             element = {}
             logger.debug("processing html: "+value)
             if value.find('<img ')==-1:
                 title = Decoder.rExtract(">",'</a></li>',value)
                 link = Decoder.extract("href=\"/",'"',value)
                 if title == '</a':
                     title = Decoder.extract('class="menu-item">','<',value).replace("&nbsp;","")
                 element["title"] = title
                 element["link"] = Skylinewebcamscom.MAIN_URL+link
                 if len(title)>0 and link.find("#")==-1 and len(element["link"])>len(Skylinewebcamscom.MAIN_URL) and (title.find("<")==-1 and title.find(">")==-1):
                     logger.debug("append: "+title+", link: "+element["link"])
                     x.append(element)
                 else:
                     logger.debug("discarted: "+title+", link: "+element["link"])
             else:
                 img = "http://"+Decoder.extract("data-original=\"//",'" ',value)
                 title = Decoder.extract("class=\"title\">",'</span>',value)
                 link = Decoder.extract("href=\"/",'"',value)
                 element["title"] = title
                 element["link"] = Skylinewebcamscom.MAIN_URL+link
                 element["thumbnail"] = img
                 element["permaLink"] = True
                 if link.find(".html")>-1 and (title.find("<")==-1 and title.find(">")==-1):
                     logger.debug("append: "+title+", link: "+element["link"]+", img: "+element["thumbnail"])
                     x.append(element)
                 else:
                     logger.debug("discarted: "+title+", link: "+element["link"]+", img: "+element["thumbnail"])
         i+=1
     return x
Beispiel #3
0
    def getChannels(page):
        start = False
        #logger.debug("Current page is: "+page)
        if str(page) == '0' or str(page)=='1':
            if str(page)=='0':
                start = True
            page=Vigoal.MAIN_URL

        page = urllib.unquote_plus(page)
        html = Vigoal.getContentFromUrl(page,"",Vigoal.cookie,"")
        x = []
        if page.find(".html")==-1:
            if start:
                element = {}
                element["link"] = '1'
                element["title"] = 'Display by event'
                x.append(element)
                table = Decoder.extract("<center><table><tr><td>","</tr></table></center>",html)
                for fieldHtml in table.split('<a href="'):
                    element = {}
                    element["link"] = urllib.quote_plus(str(fieldHtml[0:fieldHtml.find('"')]))
                    element["title"] = fieldHtml[fieldHtml.find('title="')+len('title="'):]
                    element["title"] = element["title"][0:element["title"].find('"')].replace("-"," ").replace("en directo","").replace("Live Stream","").replace("\n","").replace("\t","").replace("  ","").strip() #cleaned
                    while element["title"].find("<")>-1: #clean tags
                        tag = Decoder.extract("<",">",element["title"])
                        element["title"] = element["title"].replace("<"+tag+">","")
                    element["thumbnail"] = fieldHtml[fieldHtml.find('<img src="')+len('<img src="'):]
                    element["thumbnail"] = element["thumbnail"][0:element["thumbnail"].find('"')]
                    logger.debug("found title: "+element["title"]+", link: "+element["link"]+", thumb: "+element["thumbnail"])
                    if element["link"].find("http")==0:
                        x.append(element)
            else: #display program content
                table = Decoder.extract("<h2>Events Today:</h2>","</ul>",html) #instead could be used <div class="ppal"> but... fate I suppose
                i = 0
                for fieldHtml in table.split('<li class="">'):
                    if i>0:
                        element = {}
                        element["link"] = Decoder.extract('<a href="','">',fieldHtml)
                        element["title"] = Decoder.extract(' - ','</div>',fieldHtml)
                        if fieldHtml.find('"><h2>')>-1:
                            titleLine = Decoder.extract('"><h2>',"</h2>",fieldHtml)
                        else:
                            titleLine = Decoder.rExtract('html">',"</a></div>",fieldHtml)
                        timeLine = (element["title"].replace("</b>","").replace(" - ","")).replace("-"," ").replace("en directo","").replace("Live Stream","").replace("\n","").replace("\t","").replace("  ","").strip() #cleaned
                        element["title"] = timeLine+" - "+titleLine
                        while element["title"].find("<")>-1: #clean tags
                            tag = Decoder.extract("<",">",element["title"])
                            element["title"] = element["title"].replace("<"+tag+">","")
                        element["thumbnail"] = fieldHtml[fieldHtml.find('<img src="')+len('<img src="'):]
                        element["thumbnail"] = Vigoal.MAIN_URL+element["thumbnail"][0:element["thumbnail"].find('"')]
                        logger.debug("found title: "+element["title"]+", link: "+element["link"]+", thumb: "+element["thumbnail"])
                        element["link"] = urllib.quote_plus(str(Vigoal.MAIN_URL+element["link"]))
                        x.append(element)
                    i+=1
        else:
            x.append(Vigoal.extractChannel(html,page))
        return x
Beispiel #4
0
 def getChannels(page,cookie='',referer=''):
     x = []
     html = ""
     if str(page) == '0':
         x = Redmp3cc.getMainSections()
     elif str(page) == 'songs.html':
         page=Redmp3cc.MAIN_URL+"/"
         html = Downloader.getContentFromUrl(page,"",cookie,"")
         x = Redmp3cc.extractElementsPlayer(html)
     elif str(page).find('search.html')!=-1:
         if str(page).find('search.html/')==-1:
             keyboard = xbmc.Keyboard("")
             keyboard.doModal()
             text = ""
             if (keyboard.isConfirmed()):
                 text = keyboard.getText()
                 x = Redmp3cc.search(text)
         else:
             text = Decoder.rExtract('search.html/','/',page)
             page = int(page[page.rfind('/')+1:])
             x = Redmp3cc.search(text,page)
     elif str(page).find(".html")!=-1:
         if str(page) == 'albums.html'!=-1:
             page = Redmp3cc.MAIN_URL
             html = Downloader.getContentFromUrl(page,"",cookie,"")
             x = Redmp3cc.extractElementsAlbum(html)
         else:
             html = Downloader.getContentFromUrl(page,"",cookie,"")
             x = Redmp3cc.extractElementsPlayer(html)
     else:
         logger.info("page is: "+page)
         response = Redmp3cc.getContentFromUrl(page,"",cookie,Redmp3cc.MAIN_URL,True)
         #logger.info("will be used a mp3 url: "+Decoder.extract('<a href="','">here',response))
         host = response[response.find("://")+len("://"):]
         if host.find("/")>-1:
             host = host[0:host.find("/")]
         cookie = Redmp3cc.cookie
         referer = page
         logger.info("cookie is: "+cookie+", referer is: "+referer)
         headers = downloadtools.buildMusicDownloadHeaders(host,cookie,referer)
         filename= Decoder.extract('filename=','&',response)
         #ROOT_DIR = xbmcaddon.Addon(id='org.harddevelop.kodi.juke').getAddonInfo('path')
         ROOT_DIR = xbmc.translatePath('special://temp/')
         logger.info("using special root folder: "+ROOT_DIR)
         downloadtools.downloadfile(response,ROOT_DIR+"/"+filename,headers,False,True)
         x.append(Redmp3cc.buildDownloadedFile(xbmc.makeLegalFilename(ROOT_DIR+"/"+filename)))
     return x
Beispiel #5
0
    def extractElements(table,html=""):
        x = []
        splitter = 'data-playlist-id="'
        splitter2 = 'Flash Player">'
        splitter3 = "new_player_block.nss_load_playlist('"
        for fieldHtml in table.split('<li '):
            if fieldHtml.find(splitter)>-1:
                element = {}
                playlistId = Decoder.extract(splitter,'" >',fieldHtml)
                title = Decoder.extract(splitter2,'</a>',fieldHtml).strip()
                url = Decoder.extract(splitter3,"' + jQuery(",fieldHtml).replace("&amp;","&")
                rel = Decoder.rExtract('" rel="','">'+title+"</a>",html)
                url = R977Musiccom.MAIN_URL+url+rel+"&userId=0"
                element["title"] = title
                element["link"] = base64.standard_b64encode(url)
                logger.info("found title: "+element["title"]+", link: "+element["link"])
                if len(element["title"])>0:
                    #TODO: now we tries to extract the content from json 'html'
                    x.append(element)

        return x
Beispiel #6
0
 def getChannels(page,decode=False):
     x = []
     if str(page) == '0':
         page=Skylinewebcamscom.MAIN_URL
     html = Skylinewebcamscom.getContentFromUrl(page,"",Skylinewebcamscom.cookie,"")
     if page.find(".html")==-1 and not decode:
         logger.debug("browsing main menu...")
         menu = Decoder.extract('<ul class="nav" id="main-menu">',"</li></ul></li></ul>",html)
         x = Skylinewebcamscom.extractElements(menu)
     else:
         logger.debug("browsing page...")
         if html.find('<ul class="hidden-xs nav nav-tabs')>-1 and not decode:
             logger.debug("browsing submenu")
             menu = Decoder.extract('<ul class="hidden-xs nav nav-tabs','</li></ul>',html) #first tries to extract submenu
             x = Skylinewebcamscom.extractElements(menu)
             if len(x)==0: #no submenu, so final channels have to been extracted
                 logger.debug("browsing webcams")
                 content = Decoder.extract('<ul class="row list-unstyled block webcams">','</li></ul>',html)
                 x = Skylinewebcamscom.extractElements(content)
         else:
             logger.debug("building url for webcam...")
             if html.find(",url:'")==-1 and not decode: #needs subchannels
                 logger.debug("browsing webcams")
                 content = Decoder.extract('<ul class="row list-unstyled block webcams">','</li></ul>',html)
                 x = Skylinewebcamscom.extractElements(content)
             else: #final channel
                 logger.debug("html is: "+html)
                 if html.find("\" type='application/x-mpegURL'")>-1:
                     url = Decoder.rExtract('"',"\" type='application/x-mpegURL'",html)
                 else:
                     url = Decoder.extract(",url:'","'",html)
                 logger.debug("url is: "+url)
                 logger.debug("building final link: "+url)
                 element = {}
                 element["title"] = "Webcam"
                 element["link"] = url
                 element["permaLink"] = True
                 x.append(element)
     return x
Beispiel #7
0
 def extractElementsPlayer(html):
     x = []
     i = 0
     for value in html.split('<div class="player"'):
         if i>0:
             element = {}
             title = Decoder.extract('data-title="','">',value)
             link = Decoder.extract('data-mp3url="','" ',value)
             element["title"] = title
             element["link"] = Redmp3cc.MAIN_URL+link
             if value.find('<img src="')!=-1:
                 element["thumbnail"] = Redmp3cc.MAIN_URL+Decoder.extract('<img src="','" ',value)
             logger.info("append: "+title+", link: "+element["link"])
             x.append(element)
         i+=1
     if len(x)>0 and html.find(' class="button">Next page')!=-1:
         nextLink = "search.html/"+Decoder.rExtract('/mp3-','" class="button">Next page',html)
         nextText = "Next page"
         element = {}
         element["link"] = nextLink
         element["title"] = nextText
         logger.info("append next search with link: "+nextLink)
         x.append(element)
     return x
Beispiel #8
0
 def getChannels(page):
     x = []
     logger.debug("page is: "+page)
     if str(page) == '0':
         page=Zonasportsme.MAIN_URL
     else:
         logger.debug("decoding page: "+page)
         page = base64.b64decode(page)
         logger.debug("decoded page: "+page)
     logger.debug("launching web petition to page: "+page)
     html = Zonasportsme.getContentFromUrl(page,"",Zonasportsme.cookie,Zonasportsme.MAIN_URL)
     if page==Zonasportsme.MAIN_URL:
         logger.debug("browsing main menu...")
         menu = Decoder.extract('<ul class="nav" id="main-menu">',"</li></ul></li></ul>",html)
         x = Zonasportsme.extractElements(menu)
     else:
         url = ""
         #decoder part
         if 'http://www.ustream.tv/' in html:
             uStreamUrl = Decoder.extractWithRegex('http://www.ustream.','"',html)
             url = Decoder.getUstreamLink(uStreamUrl,page)
         elif 'castamp.com/embed.js' in html:
             channel = Decoder.extract('channel="','"',html)
             url = Decoder.getCastcampLink(channel,page)
         elif 'adca.st/broadcast/player.js' in html:
             if "<script type='text/javascript'>id='" in html:
                 id2 = Decoder.extract("<script type='text/javascript'>id='", "';", html)
             logger.debug("using id = " + id2)
             url4 = "http://bro.adca.st/stream.php?id=" + id2 + "&width=700&height=450&stretching=uniform"
             html4 = Zonasportsme.getContentFromUrl(url4, "", Zonasportsme.cookie, page)
             logger.debug("html4: " + html4)
             curl = Decoder.rExtract('= "', '=";', html4)+'='
             fn = Decoder.rExtract('"','.php";',html4)
             token = Zonasportsme.getContentFromUrl('http://bro.adca.st/'+fn+'.php', "",Zonasportsme.cookie, url4, True)
             logger.debug("token: " + token)
             token = Decoder.extract('":"', '"', token)
             file = base64.decodestring(curl) + token + "|" + Downloader.getHeaders('http://cdn.allofme.site/jw/jwplayer.flash.swf')
             logger.debug("final url is: " + file)
             url = file
         elif 'zony.tv/static/scripts/zony.js' in html:
             channel = Decoder.extract("channel='","'",html)
             url = 'http://www.zony.tv/embedplayer/'+channel+'/1/700/400/'
             html2 = Zonasportsme.getContentFromUrl(url=url,referer=page)
             logger.debug("html2 is: "+html2)
             #newParam = Decoder.extract("so.addParam('FlashVars', '", "'", html2)  # brute params, needs a sort
             newParam = Decoder.extractParams(html2)
             rtmp = "rtmp://146.185.16.62/stream playPath="+newParam+" swfVfy=1 timeout=10 conn=S:OK live=true swfUrl=http://www.zony.tv/static/scripts/fplayer.swf flashver=WIN/2019,0,0,226 pageUrl="+page
             url = rtmp
         elif 'http://www.embeducaster.com/static/' in html:
             channel = Decoder.extract("channel='", "'", html)
             url = 'http://www.embeducaster.com/embedplayer/' + channel + '/1/700/400/'
             html2 = Zonasportsme.getContentFromUrl(url=url, referer=page)
             logger.debug("html2 is: " + html2)
             url = Decoder.decodeUcaster(html2,url)
         elif '247bay.tv/static/' in html:
             channel = Decoder.extract("channel='", "'", html)
             url = 'http://www.247bay.tv/embedplayer/'+channel+'/2/750/420'
             url = Decoder.decode247bay(url,page)
         element = {}
         element["title"] = "Stream"
         element["link"] = url
         element["permaLink"] = True
         x.append(element)
     return x
Beispiel #9
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
Beispiel #10
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
Beispiel #11
0
    def getChannels(page):
        logger.debug("starting with page from cineestrenos section: "+page)
        if str(page) == '0':
            tradicionalChannels = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "extended_channels")
            logger.debug("using carrusel: "+str(tradicionalChannels))
            if tradicionalChannels=="false":
                page = Cineestrenostv.MAIN_URL+'/carrusel/tv.html'
            else:
                page = Cineestrenostv.MAIN_URL
        html = Cineestrenostv.getContentFromUrl(page,"","",Cineestrenostv.MAIN_URL)
        x = []
        logger.debug("page is: "+page)
        if page.find("/carrusel/tv.html")>-1:
            table = Decoder.extract('<div class="container">',"</div></div></div></div></div>",html)
            for fieldHtml in table.split('<div class="content">'):
                element = {}
                element["link"] = Cineestrenostv.MAIN_URL+Decoder.extract("<div><a href=\"javascript:popUp('..","')",fieldHtml)
                if element["link"] != Cineestrenostv.MAIN_URL:
                    if element["link"].find('/multi')!=-1:
                        logger.debug("found multi link: "+element["link"])
                        element["title"] = Decoder.extract("/multi","/",element["link"])
                    else:
                        element["title"] = Decoder.rExtract("/",".html",element["link"])
                        if element["title"].find(".")>-1:
                            element["title"] = element["title"][:element["title"].rfind(".")]
                    element["thumbnail"] = Decoder.extract(' src="','"',fieldHtml)
                    if element["thumbnail"].find("://")==-1:
                        element["thumbnail"] = Cineestrenostv.MAIN_URL+element["thumbnail"]
                    element["title"] = element["title"].replace("-"," ")
                    logger.debug("found title: "+element["title"]+", link: "+element["link"]+", thumb: "+element["thumbnail"])
                    if element["thumbnail"].find("http")==0 and not(element["title"]=="1" or element["title"]=="venus"):
                        x.append(element)
        elif page == Cineestrenostv.MAIN_URL:
            table = Decoder.extract('<center><table>','</td></tr></table></center>',html)
            for fieldHtml in table.split('<td>'):
                element = {}
                element["link"] = Cineestrenostv.MAIN_URL+"/"+Decoder.extract("<a href=\"/",'"',fieldHtml)
                if element["link"].find('"')>-1:
                    element["link"] = element["link"][0:element["link"].find('"')]
                if element["link"].find('/multi')!=-1:
                    logger.debug("found multi link: "+element["link"])
                    element["title"] = Decoder.extract("/multi","/",element["link"])
                else:
                    logger.debug("found normal link, continue... "+ element["link"])
                    element["title"] = Decoder.extract('" title="','" target',fieldHtml)
                    if element["title"].find('"')>-1:
                        element["title"] = element["title"][0:element["title"].find('"')]
                    if element["title"].find(" online")>-1:
                        element["title"] = element["title"][0:element["title"].find(" online")]
                    if element["title"].find(" Online")>-1:
                        element["title"] = element["title"][0:element["title"].find(" Online")]
                    if element["title"].find(" en directo")>-1:
                        element["title"] = element["title"][0:element["title"].find(" en directo")]

                    element["title"] = element["title"].replace("ver ","")

                #element["title"] = element["title"].decode('utf-8')
                element["thumbnail"] = Decoder.extract('<img src="','" height',fieldHtml)
                if element["thumbnail"].find('"')>-1:
                    element["thumbnail"] = element["thumbnail"][0:element["thumbnail"].find('"')]
                if element["thumbnail"].find("://")==-1:
                    element["thumbnail"] = Cineestrenostv.MAIN_URL+element["thumbnail"]
                if element["thumbnail"]!=Cineestrenostv.MAIN_URL:
                    logger.debug("found title: "+element["title"]+", link: "+element["link"]+", thumb: "+element["thumbnail"])
                    if element["thumbnail"].find("http")==0 and not(element["title"]=="1" or element["title"]=="gran hermano mexico" or element["title"]=="alx syfy" or element["title"]=="intereconomia punto pelota" or element["title"]=="cine" or element["title"].find("-LATINOAMERICA")>-1):
                        x.append(element)
        else:
            logger.debug('extracting channel from: '+page)
            x.append(Cineestrenostv.extractChannel(html,page))
        return x