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
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