def getChannels(page): x = [] if str(page) == '0': page = Live9net.MAIN_URL html = Live9net.getContentFromUrl(page, "", Live9net.cookie, "") #print html if html.find('ESPN</') > -1: #it's a list, needs decode table = Decoder.extract('ESPN</', '<div>', html) x = Live9net.extractElements(table) logger.debug("live9 channels logic done!") else: iframeUrl = Decoder.extract('src="', '"', html) logger.debug("iframe url is: " + iframeUrl) html2 = Live9net.getContentFromUrl(iframeUrl, "", Live9net.cookie, page) logger.debug("detecting sawlive links...") if html2.find('src="http://sawlive.tv/') > -1 or html2.find( 'src="http://www3.sawlive') > -1: logger.debug("Detected sawlive link!") if html2.find('src="http://sawlive.tv/') > -1: scriptSrc = Decoder.extractWithRegex( 'http://sawlive', '"></script>', html2).replace('"></script>', "") else: scriptSrc = Decoder.extractWithRegex( 'http://www3.sawlive', '"></script>', html2).replace('"></script>', "") finalRtmpUrl = Decoder.extractSawlive(scriptSrc, iframeUrl) element = {} element["link"] = finalRtmpUrl element["title"] = "Watch channel" element["permalink"] = True logger.debug("finished append element!") x.append(element) return x
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