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 extractSeasons(html, url): items = [] #extract <a href='https://hdfull.me/serie/homeland/temporada-1'>1</a> while html.find("<a href='" + url + "/temporada-") > -1: item = {} aHtml = Decoder.extractWithRegex("<a href='" + url + "/temporada-", "</a>", html) html = html[html.find(aHtml) + len(aHtml):] item["permalink"] = Decoder.extractWithRegex( url + "/temporada-", "'", aHtml) item["permalink"] = item["permalink"][0:item["permalink"].find("'" )] item["title"] = Decoder.extract('>', '</a>', aHtml) logger.debug("found title: " + item["title"] + ", link: " + item["permalink"]) if item["title"].find( '<img class="tooltip" original-title="Temporada ') > -1: title = item["title"] item["title"] = Decoder.extract('original-title="', '"', title) item["thumbnail"] = Decoder.extract('" src="', '" />', title) logger.debug("procesed title: " + item["title"] + ", thumbnail: " + item["permalink"]) items.append(item) return items
def getChannels(page): x = [] if str(page) == '0': try: page=Arenavisionin.MAIN_URL+"guide" html = Arenavisionin.getContentFromUrl(page,"",'beget=begetok; has_js=1',Arenavisionin.MAIN_URL) #guideUrl = Decoder.rExtract('"','">EVENTS GUIDE</a></li>',html) #html = Arenavisionin.getContentFromUrl(page+guideUrl,"",'beget=begetok; has_js=1',Arenavisionin.MAIN_URL) except: page = Arenavisionin.MAIN_URL_RU+"guide" html = Arenavisionin.getContentFromUrl(page, "", 'beget=begetok; has_js=1', Arenavisionin.MAIN_URL_RU) #guideUrl = Decoder.rExtract('"', '">EVENTS GUIDE</a></li>', html) #html = Arenavisionin.getContentFromUrl(page+guideUrl, "", 'beget=begetok; has_js=1', Arenavisionin.MAIN_URL_RU) pass html = Decoder.extract('<table align="center" cellspacing="1" class="auto-style1" style="width: 100%; float: left"><tr><th class="auto-style4" style="width: 190px; height: 39px"><strong>DAY</strong></th>',"</tr></table></div></div></div>",html) x = Arenavisionin.extractElements(html) else: if page.find("-")>-1: #put a context menu and the user should decice, if not use the first one (default action) dialog = XBMCUtils.getDialog() cmenu = [] for contextItem in page.split("-"): #if len(contextItem)>0: cmenu.append(contextItem) result = dialog.select(XBMCUtils.getString(11016), cmenu) #choose logger.debug("result was: "+str(result)) if result == None or result==-1: target = page[:page.find("-")] page = target else: logger.debug("has choosed "+str(result)+": "+cmenu[result]) page = (cmenu[result]) html = Arenavisionin.getContentFromUrl(Arenavisionin.MAIN_URL, "", 'beget=begetok; has_js=1', Arenavisionin.MAIN_URL) link = Decoder.rExtract("<a href=\"","title=\"\">ArenaVision "+page+"</a>",html) logger.debug("html is: "+html) link = link[:link.find('"')] logger.debug("provisional link is: "+link) else: if "av" not in page: page = "av"+page link = "http://www.arenavision.us/"+page try: html = Arenavisionin.getContentFromUrl(link,"",'beget=begetok; has_js=1',Arenavisionin.MAIN_URL) logger.debug("second html is: "+html) except: logger.error("sonething goes wrong with link: "+link) pass if html.find("acestream://")>-1: link2 = Decoder.extractWithRegex("acestream://",'"',html).replace('"',"") else: link2 = Decoder.extractWithRegex("sop://",'"',html).replace('"',"") element = {} element["title"] = page element["link"] = link2 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
def getChannels(page): x = [] if page == '0': page = RedeneobuxCom.LIST_PAGE results = RedeneobuxCom.getContentFromUrl(page) i=0 for result in results.split('<div class="media">'): if i>0: element = {} img = Decoder.extract('<img src=\'',"'",result) link = Decoder.extract('location.href=\'', "'", result) title = Decoder.extract('\' alt=\'', "'", result) if "http" in link: logger.debug("appending result: "+title+", url: "+link) element["title"] = title element["link"] = link element["thumbnail"] = img x.append(element) i+=1 else: content = RedeneobuxCom.getContentFromUrl(url=page,referer=RedeneobuxCom.LIST_PAGE) logger.debug("list content is: " + content) url = Decoder.extractWithRegex('http'," ",content).replace(" ","") logger.debug("url is: " + url) if 'adf' in url: listUrl = Decoder.decodeAdfly(url) logger.debug("list obtained is: "+listUrl) m3uContent = Downloader.getSimpleDownload(listUrl) #simple urllib2 download logger.debug("content: "+m3uContent) i=0 for lineContent in m3uContent.split('#EXTINF:'): if i>0: title = Decoder.extract(',','\n',lineContent) lineContent = lineContent[lineContent.find("\n"):] urlContent = Decoder.extractWithRegex('http://',"\n",lineContent).replace('\n','') element = {} element["title"] = title element["link"] = urlContent#+"|"+Downloader.getHeaders(listUrl) element["thumbnail"] = '' element["finalLink"] = True if "://" in urlContent: logger.debug("added: " + title + ", content: " + urlContent) x.append(element) i+=1 return x
def extractChannel(html, page="http://www.vipgoal.net/"): element = {} if html.find( '<script type="text/javascript" src="http://www.playerapp1.pw/channel.php?file=' ) > -1: #old part scriptUrl = Decoder.extractWithRegex( 'http://www.playerapp1.pw/channel.php?file=', '"', html) html2 = Vigoal.getContentFromUrl(scriptUrl) lastUrl = Decoder.extractWithRegex('http://', '" ', html2) lastUrl = lastUrl.replace('"', "") logger.debug("last url: " + lastUrl + ", cookie=" + Vigoal.cookie) html3 = Vigoal.getContentFromUrl(lastUrl, "", Vigoal.cookie, lastUrl) playerUrl = Decoder.decodeBussinessApp(html3, lastUrl) logger.debug("player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl else: #unified with cinestrenostv, they are the same people, at least the same code works and the changes are at the same time xD logger.debug('Extracting channel from: ' + page) element = Cineestrenostv.extractIframeChannel(html, page) return element
def extractElements(table): x = [] for value in table.split('\n'): if value.find("acestream://") > -1: element = {} element["title"] = unicode(Decoder.extract("// ", '(', value), errors='replace') element["link"] = Decoder.extractWithRegex( "acestream:", '\"', value).replace('"', "") logger.debug("append: " + element["title"] + ", link: " + element["link"]) x.append(element) return x
def extractNewIframeChannel(html3, iframeUrl2): element = {} if html3.find("http://telefivegb.com/") > -1: logger.debug("found telefivegb.com link, using that link to...") newUrl = Decoder.extractWithRegex('http://telefivegb.com/', '"', html3).replace('"', "") elif html3.find("http://verlatelegratis.net") > -1: logger.debug( "found verlatelegratis.net link, using that link to...") newUrl = Decoder.extractWithRegex('http://verlatelegratis.net', '"', html3).replace('"', "") html4 = Cineestrenostv.getContentFromUrl(newUrl, "", Cineestrenostv.cookie, iframeUrl2) if html4.find("http://www.playerhd1.pw/") > -1: logger.debug("found playerhd1.pw, using that link, continue...") element = Cineestrenostv.extractScriptPlayerHd1pw(html4, newUrl) else: logger.debug("possible redirect to his domains: " + html4 + ", try again..." + newUrl) element = Cineestrenostv.extractNewIframeChannel(html4, newUrl) return element
def drawBbcCoUkNew(url): htmlContent = Downloader.getContentFromUrl(url=url) title = Decoder.extract('<p class="story-body__introduction">', '</p><div', htmlContent) if 'property="articleBody"' in htmlContent: body = Decoder.extract( 'property="articleBody"', ' </div>', htmlContent) body = body.replace('<span class="off-screen">Image copyright</span>', '') body = body.replace('<span class="story-image-copyright">AFP</span>', '') body = body.replace( '<span class="story-image-copyright">Reuters</span>', '') body = body.replace('<span class="off-screen">Image caption</span>', '') body = body.replace('<span class="off-screen">Media caption</span>', '') while '<span class="media-caption__text">' in body: line = Decoder.extractWithRegex( '<span class="media-caption__text">', "</span>", body) body = body.replace(line, "") elif 'class="text-wrapper"' in htmlContent: #special content body = Decoder.extract('class="text-wrapper"', '</p>\n', htmlContent) dates = Decoder.extractWithRegex('<div class="date', "</div>", body) lastUpdate = Decoder.extractWithRegex('<p class="date ', "</p>", body) body = body.replace(dates, "") body = body.replace(lastUpdate, "") elif '<figcaption class="sp-media-asset' in htmlContent: body = Decoder.extract('<figcaption class="sp-media-asset', '</p><div ', htmlContent) if '>' in body: body = body[body.find(">") + 1:] body = Decoder.removeHTML(body).replace(".", ".\n").replace(">", "") logger.debug("body is: " + body) drawNew(textContent=(body))
def extractFile(html2): listUrl = Decoder.extract('file: "', '"', html2) if "|" in listUrl: logger.debug("detected external list...") listUrl = listUrl[:listUrl.find("|")] newListContent = Youtvgratis.getContentFromUrl(url=listUrl) if ".m3u8" in newListContent and "http" in newListContent: listUrl = Decoder.extractWithRegex('http:', "=.m3u8", newListContent) logger.debug("new list has been updated to: " + listUrl) else: logger.debug("rejected new list, using last one valid.") logger.debug("extracted m3u8: " + listUrl) return listUrl
def extractTargetVideo(page): url = page.split('|')[0] referer = page[page.rfind("=") + 1:] referer = 'http://ver.movistarplus.es/player/?canal=' + referer + Yomvies.CHANNELS_SUBFIX logger.debug("yomvi url is: " + url + ", with referer: " + referer) html = Yomvies.getContentFromUrl(url=url, referer=referer, launchLocation=True) logger.debug("obtained response for yomvi page: " + html) newUrl = url[:url.rfind("/") + 1] + Decoder.extractWithRegex( "#EXT-", ".m3u8", html).split("\n")[1] html2 = Yomvies.getContentFromUrl(url=newUrl, referer=url, launchLocation=True) logger.debug("obtained second response for yomvi page: " + html2) return "http://127.0.0.1:46720?original-request=" + newUrl #+"&referer="+referer
def extractScriptLevel3(scriptUrl, referer=''): html4 = Cineestrenostv.getContentFromUrl(scriptUrl, "", Cineestrenostv.cookie, referer) finalIframeUrl = Decoder.extractWithRegex('http://', '%3D"', html4) finalIframeUrl = finalIframeUrl[0:len(finalIframeUrl) - 1] logger.debug("proccessing level 4, cookie: " + Cineestrenostv.cookie) finalHtml = Cineestrenostv.getContentFromUrl(finalIframeUrl, "", Cineestrenostv.cookie, referer) # print "final level5 html: "+finalHtml logger.debug("proccessing level 5, cookie: " + Cineestrenostv.cookie) playerUrl = Decoder.decodeBussinessApp(finalHtml, finalIframeUrl) return playerUrl
def extractChannel(html, referer): element = {} logger.debug('processing html...') if html.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="' ) > -1: element = Cineestrenostv.extractIframeChannel(html, referer) elif html.find('.php') > -1 and referer.find(".php") == -1: logger.debug("proccessing level 1, cookie: " + Cineestrenostv.cookie) iframeUrl = Decoder.extractWithRegex('http://', '.php', html) if iframeUrl.find('"') > -1: iframeUrl = iframeUrl[0:iframeUrl.find('"')] html2 = Cineestrenostv.getContentFromUrl(iframeUrl, "", Cineestrenostv.cookie, referer) if html2.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="' ) > -1 or '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" allowfullscreen width="653" height="403" src="' in html2: element = Cineestrenostv.extractIframeChannel(html2, iframeUrl) elif html.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="500" src="' ) > -1: iframeUrl = Decoder.extract( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="500" src="', '"></iframe>', html ) #same case with different width and height: TODO: change to regex!! html2 = Cineestrenostv.getContentFromUrl(iframeUrl, "", "", referer) if html2.find('<th scope="col"><a href="/') > -1: partialLink = Decoder.extract('<th scope="col"><a href="/', '"><font color="ffffff">', html2) completeLink = Cineestrenostv.MAIN_URL + "/" + partialLink html3 = Cineestrenostv.getContentFromUrl( completeLink, "", Cineestrenostv.cookie, iframeUrl) if html3.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="' ) > -1: element = Cineestrenostv.extractIframeChannel( html3, completeLink) elif referer.find("php") != -1: referer = referer.replace("ñ", "%C3%B1") html2 = Cineestrenostv.getContentFromUrl(referer, "", Cineestrenostv.cookie, referer) element = Cineestrenostv.extractIframeChannel(html2, referer) return element
def extractScriptDefaultLogic(htmlContent, referer, regex): element = {} logger.debug("proccessing level 3, cookie: " + Cineestrenostv.cookie) logger.debug("using regex: " + regex) scriptUrl = Decoder.extractWithRegex(regex, '"', htmlContent).replace('"', "") scriptUrl = scriptUrl[0:len(scriptUrl) - 1] playerUrl = Cineestrenostv.extractScriptLevel3(scriptUrl, referer) logger.debug("DONE! player url is: " + str(playerUrl)) #print "player url is: "+playerUrl element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl return element
def launchScriptLogic(scriptRegex, html, referer, iframeUrl): logger.debug("processing pre level 2... url: " + scriptRegex) firstScriptUrl = Decoder.extractWithRegex(scriptRegex, ".js", html) if firstScriptUrl.find('"') > -1: firstScriptUrl = firstScriptUrl[0:firstScriptUrl.find('"')] if "'" in firstScriptUrl: firstScriptUrl = firstScriptUrl[0:firstScriptUrl.find("'")] scriptUrl = Cricfreetv.extractScriptIframeUrl(html, firstScriptUrl, referer) logger.debug("level 2, scriptUrl: " + scriptUrl + ", cookie: " + Cricfreetv.cookie) lastIframeHtml = Cricfreetv.getContentFromUrl(scriptUrl, "", Cricfreetv.cookie, iframeUrl) logger.debug("html in level2 is: " + lastIframeHtml) file = Cricfreetv.seekIframeScript(lastIframeHtml, iframeUrl, scriptUrl) logger.debug("script logic finished!") return file
def open(url, page): if url.find("rtmp://") == -1 and url.find("|Referer=") == -1 and ( url.find("http://privatestream.tv/") > -1 or url.find("http://www.dinostream.pw/") > -1 or url.find("http://www.embeducaster.com/") > -1 or url.find("http://tv.verdirectotv.org/channel.php") > -1 or url.find("http://mamahd.com/") > -1): logger.info("brute url [referer] is: " + url) referer = '' if (url.find("referer: ") > -1): referer = url[url.find("referer: ") + len("referer: "):] url = url[0:url.find(",")] if url.find("http://privatestream.tv/") > -1: html = Downloader.getContentFromUrl(url, "", "", referer) url = Decoder.decodePrivatestream(html, referer) elif url.find("http://www.dinostream.pw/") > -1: url = Decoder.extractDinostreamPart(url, referer)["link"] elif url.find("http://www.embeducaster.com/") > -1: #url = url.replace("/membedplayer/","/embedplayer/") url = Cineestrenostv.getContentFromUrl(url, "", "", referer) elif url.find("http://tv.verdirectotv.org/channel.php") > -1: html4 = Cineestrenostv.getContentFromUrl(url, "", Cineestrenostv.cookie, referer) finalIframeUrl = Decoder.extractWithRegex('http://', '%3D"', html4) if finalIframeUrl.find('"') > -1 or finalIframeUrl.find("'") > -1: finalIframeUrl = finalIframeUrl[0:len(finalIframeUrl) - 1] finalHtml = Cineestrenostv.getContentFromUrl( finalIframeUrl, "", Cineestrenostv.cookie, referer) url = Decoder.decodeBussinessApp(finalHtml, finalIframeUrl) elif url.find("http://mamahd.com/") > -1: url = Mamahdcom.getChannels(url)[0]["link"] elif url.find("http://showsport-tv.com/") > -1: url = ShowsportTvCom.getChannels(url)[0]["link"] elif url.find("rtmp://") == -1: try: if url.find(", referer: ") > -1: page = url[url.find(", referer: ") + len(", referer: "):] url = url[:url.find(", referer: ")] logger.debug("changing page to referer: " + page) logger.debug("trying decoder part for url: " + url) url = Decoder.decodeLink(url, page) except: logger.info( "decoder url launched an exception, probably could not be decoded" ) pass #launch redirects to his better addons if url.find("sop://") > -1 or url.find("acestream://") > -1 or url.find( ".acelive" ) > -1: #required plexus or something similar installed, this dependency is external from this addon so needs to be installed logger.info("trying to send link to plexus: " + url) mode = "1" if url.find("sop://") > -1: mode = "2" url = "plugin://program.plexus/?mode=" + mode + "&url=" + url + "&name=RemoteLink" elif ".torrent" in url or url.find("magnet:") > -1: logger.info("trying to send link to quasar: " + url) url = urllib.quote_plus(url) url = "plugin://plugin.video.quasar/play?uri=" + url elif url.find("youtube.com/") > -1: id = "" if url.find("v=") > -1: id = url[url.find("v=") + len("v="):] elif url.find("/embed/") > -1: id = url[url.find("/embed/") + len("/embed/"):] url = "plugin://plugin.video.youtube/play/?video_id=" + id + "" elif url.find("vimeo.com/") > -1: url = "plugin://plugin.video.vimeo/play/?video_id=" + urllib.quote_plus( url) else: logger.info("nothing done!") logger.debug("launching playable url: " + url) play(url, page)
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
def decodeContent( html ): #This method is used to fix a "probably" encoding/decoding problem from provider #new encoded iframe method logger.debug("trying new method for encrypted javascript code...") html2 = Decoder.extractWithRegex("eval(unescape('", "'));", html) html3 = Decoder.rExtractWithRegex("eval(unescape('", "'));", html) html3 = html3.replace("eval(", "").replace("unescape(", "").replace( " + ", "").replace(")", "").replace("'", "").replace(";", "") logger.debug("extracted code is: " + html3) decodedHtml = urllib.unquote(html2[:html2.find(";") + 1]).decode('utf8') logger.debug("decypter function in javascript is: " + decodedHtml) encryptedCall = urllib.unquote(html3).decode('utf8') #encryptedCall = html3 logger.debug("final html is: " + encryptedCall) #now extract encrypted string encryptedCall = Decoder.extract("('", "'));", encryptedCall) splitter = Decoder.extract('s.split("', '");', decodedHtml) logger.debug("splitter: " + splitter) subfixer = Decoder.extract('tmp[1] + "', '");', decodedHtml) logger.debug("subfixer: " + subfixer) s = encryptedCall.split(splitter)[0] k = encryptedCall.split(splitter)[1] + subfixer xorDiff = int(Decoder.extract("charCodeAt(i))+", ");", decodedHtml)) #logger.debug(xorDiff) r = "" i = 0 logger.debug("starting loop decoder, s: " + s + ", k: " + k) ''' r += String.fromCharCode((parseInt(k.charAt(i%k.length))^s.charCodeAt(i))+-2); ''' CORRECTION = 16 #I don't know why but this convert it to legible character (most cases) mode = 0 while i < len( s ): #GO TO HELL, REALLY, I HAVE NO IDEA HOW THERE IS PEOPLE IN THE WORLD DOING THIS THING, DO YOU KNOW AN STANDARD ENCODING? YOU DOOOON'T!!!! seed = k[(i % len(k))] #logger.debug("seed: "+seed) primitive = ord(seed) ^ ord(s[i]) #logger.debug("xorted: "+str(primitive)) if len(r) == 0 and str(primitive) != '<': #tryes to check what fix is neccesary if str(primitive) == '15': mode = 1 elif str(primitive) == '14': mode = 2 elif str(primitive) == '4': mode = 3 elif str(primitive) == '7': mode = 4 elif str(primitive) == '9': mode = 5 else: logger.debug("detected new start value: " + str(primitive) + ", probably needs new encoding method") #mode 1 and mode 2 if (str(primitive) == '1' and mode == 1) or (mode == 2 and str(primitive) == '0'): r += "." elif (str(primitive) == '2' and mode == 1) or ( mode == 2 and (str(primitive) == '1' or str(primitive) == '113')): r += "/" elif (str(primitive) == '15' and mode == 1) or (mode == 2 and str(primitive) == '14') or ( mode == 3 and str(primitive) == '4') or (mode == 4 and str(primitive) == '7') or ( mode == 5 and str(primitive) == '9'): r += "<" elif (str(primitive) == '112' and mode == 1) or (mode == 2 and str(primitive) == '15') or ( str(primitive) == '5' and mode == 3) or (str(primitive) == '8' and mode == 4) or (mode == 5 and str(primitive) == '10'): r += "=" elif (str(primitive) == '113' and mode == 1) or (mode == 2 and str(primitive) == '112') or ( str(primitive) == '6' and mode == 3) or (str(primitive) == '9' and mode == 4) or (mode == 5 and str(primitive) == '11'): r += ">" elif (str(primitive) == '13' and mode == 1) or (mode == 2 and str(primitive) == '12') or ( str(primitive) == '2' and mode == 3) or (str(primitive) == '5' and mode == 4) or (mode == 5 and str(primitive) == '7'): r += ":" elif (int(str(primitive)) - 3 < 10 and mode == 1): r += str(int(str(primitive)) - 3) elif (int(str(primitive)) - 2 < 10 and mode == 2): r += str(int(str(primitive)) - 2) #mode 3 elif (str(primitive) == '1' and mode == 3) or (str(primitive) == '4' and mode == 4): r += "9" elif (str(primitive) == '1' and mode == 4) or (str(primitive) == '3' and mode == 5): r += "6" elif (str(primitive) == '110' and mode == 3): r += "f" elif (str(primitive) == '105' and mode == 3) or ( str(primitive) == '108' and mode == 4) or (mode == 5 and str(primitive) == '110'): r += "a" elif (str(primitive) == '109' and mode == 3): r += "e" elif (str(primitive) == '40' and mode == 3) or (str(primitive) == '43' and mode == 4) or ( mode == 5 and str(primitive) == '45'): r += " " elif (str(primitive) == '108' and mode == 3): r += "d" elif (str(primitive) == '42' and mode == 3) or (str(primitive) == '45' and mode == 4) or ( mode == 5 and str(primitive) == '47'): r += '"' elif (str(primitive) == '111' and mode == 3): r += 'g' elif (str(primitive) == '81' and mode == 3): r += 'i' elif (str(primitive) == '107' and mode == 3) or (str(primitive) == '110' and mode == 4): r += 'c' elif ((str(primitive) == '10' or str(primitive) == '106') and mode == 3) or (str(primitive) == '109' and mode == 4) or (mode == 5 and str(primitive) == '111'): r += 'b' #mode 4 elif mode == 4 and str(primitive) == '105': r += 'a' elif (str(primitive) == '111' and mode == 4): r += 'd' #mode 5 elif (mode == 5 and str(primitive) == '1'): r += '4' elif (mode == 5 and str(primitive) == '5'): r += '8' elif (mode == 5 and str(primitive) == '108'): r += '_' elif (mode == 5 and str(primitive) == '12'): r += '?' else: integer = primitive + xorDiff #logger.debug("new value: "+chr(integer+CORRECTION)) r += chr(integer + CORRECTION) #logger.debug("r is now: "+r) i += 1 logger.debug("loop decoder finished at: " + str(i) + " loop") logger.debug("final decoded value is: " + r) return r
def getChannels(page): x = [] if page == '0': html = Youtvgratis.getContentFromUrl(url=Youtvgratis.MAIN_URL) i = 0 for line in html.split('<div class="col-xs-12 col-sm-2'): if i > 0: title = Decoder.extract('</a>', '</div>', line).strip() img = Decoder.extract(' src="', '"', line) link = Decoder.extract('<a href="', '"', line) element = {} element["link"] = link element["title"] = title element["thumbnail"] = img logger.debug("appending img: " + img + ", title: " + title + ", link: " + link) x.append(element) i += 1 else: html = Youtvgratis.getContentFromUrl(url=page, referer=Youtvgratis.MAIN_URL) logger.debug("decoded html is: " + html) url2 = Decoder.extractWithRegex('http://youtvgratis.com/embed/', '"', html).replace('"', '') html2 = Youtvgratis.getContentFromUrl(url=url2, referer=page, cookie=Youtvgratis.cookie) if 'file: "' in html2: listUrl = Youtvgratis.extractFile(html2) element = {} element["link"] = listUrl + "|" + Downloader.getHeaders(url2) element["title"] = page element["thumbnail"] = "" x.append(element) else: logger.debug("html2 is: " + html2) if 'http://cinestrenostv.tv/' in html2: newUrl = Decoder.extractWithRegex( 'http://cinestrenostv.tv/', '"', html2).replace('"', "") logger.debug("extracting") x = Cineestrenostv.getChannels(newUrl) elif 'http://embed.latino-webtv.com/' in html2: #search iframe iframeUrl = Decoder.extractWithRegex( 'http://embed.latino-webtv.com/', '"', html2).replace('"', "") html3 = Youtvgratis.getContentFromUrl(url=iframeUrl, referer=url2) if "http://latino-webtv.com/embed/" in html3: iframeUrl2 = Decoder.extractWithRegex( 'http://latino-webtv.com/embed/', '"', html3).replace('"', "") logger.debug("trying with latinoweb url: " + iframeUrl2) html4 = Youtvgratis.getContentFromUrl( url=iframeUrl2, referer=iframeUrl) if 'file: "' in html4: listUrl = Youtvgratis.extractFile( html4) + "|" + Downloader.getHeaders( iframeUrl2) element = {} element["link"] = listUrl element["title"] = page element["thumbnail"] = "" x.append(element) return x
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
def mainLogicExtractIframeChannel(html3, iframeUrl2): element = {} if html3.find( '<script type="text/javascript" src="http://tv.verdirectotv.org/channel.php?file=' ) > -1: element = Cineestrenostv.extractScriptVerdirectotv( html3, iframeUrl2) elif html3.find( '<script type="text/javascript" src="http://www.sunhd.info/channelsa.php?file=' ) > -1: element = Cineestrenostv.extractScriptSunhdinfo(html3, iframeUrl2) elif html3.find( '<script type="text/javascript" src="http://www.ponlatv.com/channel.php?file=' ) > -1: element = Cineestrenostv.extractScriptPonlatv(html3, iframeUrl2) elif html3.find("http://vercanalestv.com/tv/") > -1: #vercanalestv iframeUrl = Decoder.extractWithRegex("http://vercanalestv.com/tv/", '"', html3) logger.debug("obtained iframeUrl: " + iframeUrl) html2 = Cineestrenostv.getContentFromUrl( iframeUrl[0:len(iframeUrl) - 1], "", Cineestrenostv.cookie, "") if html2.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="' ) > -1: element = Cineestrenostv.extractIframeChannel(html2, iframeUrl) else: logger.error("Something unexpected happened with url: " + iframeUrl) #print "ERROR: "+html2 elif html3.find( "http://www.dinostream.pw/channel.php?file=" ) > -1: #dinostream.pw has an iframe inside, so get iframe content and proccess it logger.debug("processing dinostream channel...") element = Cineestrenostv.extractScriptDinostream(html3, iframeUrl2) elif html3.find( "<script type='text/javascript' src='http://www.embeducaster.com/static/scripts/ucaster.js'></script>" ) > -1: #ucaster cases if html3.find( "<script type='text/javascript'> width=650, height=400, channel='" ) > -1: channel = Decoder.extract( "<script type='text/javascript'> width=650, height=400, channel='", "'", html3) else: channel = Decoder.extract( "<script type='text/javascript'> width=", "',", html3) channel = channel[channel.find("channel='") + len("channel='"):] logger.debug("ucaster channel: " + channel) if html3.find( '<script type="text/javascript" src="http://tv.verdirectotv.org/channel.php?file=' ) > -1: element = Cineestrenostv.extractScriptVerdirectotv( html3, iframeUrl2) else: ucasterUrl = 'http://www.embeducaster.com/embedplayer/' + channel + '/1/620/430' html4 = Cineestrenostv.getContentFromUrl( ucasterUrl, "", Cineestrenostv.cookie, iframeUrl2) playerUrl = Decoder.decodeUcaster(html4, iframeUrl2) logger.debug("lifeflash - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl logger.debug(channel + ", " + element["link"]) elif html3.find( 'http://www.mipsplayer.com/content/scripts/mipsEmbed.js' ) > -1: #before verdirectotv.com, if not is always called channel = Decoder.extract("channel='", "'", html3) mipsUrl = 'http://www.mipsplayer.com/embedplayer/' + channel + '/1/650/400' logger.debug("mips url is: " + mipsUrl) html4 = Cineestrenostv.getContentFromUrl(mipsUrl, "", Cineestrenostv.cookie, iframeUrl2) playerUrl = Decoder.decodeMipsplayer(html4, iframeUrl2) logger.debug("mipsplayer - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl elif 'http://09stream.com/canal' in html3: logger.debug("using 09stream logic...") scriptUrl = Decoder.extractWithRegex("http://09stream.com/canal", '"', html3).replace('"', "") html4 = Cineestrenostv.getContentFromUrl( url=scriptUrl, cookie=Cineestrenostv.cookie, referer=iframeUrl2) element = Cineestrenostv.extractIframeChannel(html4, scriptUrl) elif html3.find("http://verdirectotv.com/tv") > -1: logger.debug("proccessing level 3, cookie: " + Cineestrenostv.cookie) scriptUrl = Decoder.extractWithRegex("http://verdirectotv.com/tv", '"', html3) scriptUrl = scriptUrl[0:len(scriptUrl) - 1] html4 = Cineestrenostv.getContentFromUrl(scriptUrl, "", Cineestrenostv.cookie, iframeUrl2) #logger.debug("verdirectotv html: "+html4) if html4.find("http://www.dinostream.pw/channel.php?file=") > -1: scriptUrl2 = Decoder.extractWithRegex( "http://www.dinostream.pw/channel.php?file=", '&autostart=true"', html4) scriptUrl2 = scriptUrl2[0:len(scriptUrl2) - 1] element = Decoder.extractDinostreamPart(scriptUrl2, scriptUrl) elif html4.find( "<script type='text/javascript' src='http://www.embeducaster.com/static/scripts/ucaster.js'></script>" ) > -1: #ucaster cases channel = Decoder.extract( "<script type='text/javascript'> width=650, height=400, channel='", "'", html4) if html4.find( '<script type="text/javascript" src="http://tv.verdirectotv.org/channel.php?file=' ) > -1: element = Cineestrenostv.extractScriptVerdirectotv( html4, scriptUrl) else: ucasterUrl = 'http://www.embeducaster.com/embedplayer/' + channel + '/1/620/430' html4 = Cineestrenostv.getContentFromUrl( ucasterUrl, "", Cineestrenostv.cookie, scriptUrl) playerUrl = Decoder.decodeUcaster(html4, iframeUrl2) logger.debug("lifeflash - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl logger.debug(channel + ", " + element["link"]) elif html4.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="' ) > -1: #retry the same logic element = Cineestrenostv.extractIframeChannel( html4, iframeUrl2) elif html4.find( '<script type="text/javascript" src="http://tv.verdirectotv.org/channel.php?file=' ) > -1: element = Cineestrenostv.extractScriptVerdirectotv( html4, scriptUrl) elif html4.find( "<script type='text/javascript' src='http://www.liveflashplayer.net/resources/scripts/" ) > -1: channel = Decoder.extract("channel='", "'", html4) mipsUrl = 'http://www.liveflashplayer.net/embedplayer/' + channel + '/1/620/430' html4 = Cineestrenostv.getContentFromUrl( mipsUrl, "", Cineestrenostv.cookie, scriptUrl) playerUrl = Decoder.decodeLiveFlash(html4, iframeUrl2) logger.debug("lifeflash - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl elif html4.find( 'http://www.mipsplayer.com/content/scripts/mipsEmbed.js' ) > -1: channel = Decoder.extract("channel='", "'", html4) mipsUrl = 'http://www.mipsplayer.com/embedplayer/' + channel + '/1/650/400' html4 = Cineestrenostv.getContentFromUrl( mipsUrl, "", Cineestrenostv.cookie, scriptUrl) playerUrl = Decoder.decodeMipsplayer(html4, iframeUrl2) logger.debug("mipsplayer - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl elif scriptUrl != iframeUrl2: logger.debug("trying new loop with: " + scriptUrl + ", " + iframeUrl2) element = Cineestrenostv.mainLogicExtractIframeChannel( html4, scriptUrl) else: logger.debug("big data: " + html4) elif html3.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="653" height="403" src="' ) > -1: logger.debug("extracting iframe channel with referer: " + iframeUrl2) element = Cineestrenostv.extractIframeChannel(html3, iframeUrl2) elif html3.find('file: "') > -1 and html3.find( '.m3u8') > -1: #direct link, not needed any logic link = Decoder.extract('file: "', '",', html3) link = link + "|Referer=" + iframeUrl2 logger.debug("detected direct link: " + link) element["title"] = "Watching direct link" element["permalink"] = True element["link"] = link elif html3.find("http://telefivegb.com/") > -1 or html3.find( "http://verlatelegratis.net") > -1: element = Cineestrenostv.extractNewIframeChannel(html3, iframeUrl2) elif html3.find("http://tvpor-internet.com/") > -1 or html3.find( "http://www.malosolandia.com/") > -1: logger.debug("inside here!..") newUrl = "dummy url" #dummy if html3.find("http://tvpor-internet.com/") > -1: logger.debug("inside here1!..") newUrl = Decoder.extractWithRegex('http://tvpor-internet.com/', '"', html3).replace('"', "") elif html3.find("http://www.malosolandia.com/") > -1: logger.debug("inside here2!..") logger.debug("using malosolandia") newUrl = Decoder.extractWithRegex( 'http://www.malosolandia.com/', '.html', html3) else: logger.debug("nothing done!") if newUrl != "dummy url": logger.debug("html is: " + html3) logger.debug("using new url: " + newUrl) html4 = Cineestrenostv.getContentFromUrl( newUrl, "", Cineestrenostv.cookie, iframeUrl2) logger.debug("redirecting using: " + newUrl + ", html: " + html4) element = Cineestrenostv.mainLogicExtractIframeChannel( html4, newUrl) else: logger.debug(html3) elif html3.find("http://www.rtve.es/directo/la-2/") > -1: element["title"] = "La 2" element["permalink"] = True element[ "link"] = "http://hlslive.rtve.es/LA2_LV3_IPH/LA2_LV3_IPH.m3u8" elif html3.find("http://www.rtve.es/directo/canal-24h/") > -1: element["title"] = "24H" element["permalink"] = True element[ "link"] = "http://hlslive.rtve.es/24H_LV3_IPH/24H_LV3_IPH.m3u8" elif html3.find("http://leton.tv/player.php") > -1: logger.debug("detected leton link...") letonUrl = Decoder.extractWithRegex('http://leton.tv/player.php', '"', html3).replace('"', "") letonHtml = Cineestrenostv.getContentFromUrl( letonUrl, "", Cineestrenostv.cookie, iframeUrl2) #print letonHtml playerUrl = Decoder.decodeLetonTv(letonHtml, letonUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl elif html3.find( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="' ) > -1: logger.debug( "detected iframe with embed page, doing a new loop again...") iframeUrl3 = Decoder.extract( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" width="650" height="400" src="', '"></iframe>', html3) #normal cases, standar width and height if iframeUrl3 != iframeUrl2: html4 = Cineestrenostv.getContentFromUrl( iframeUrl3, "", "", iframeUrl2) return Cineestrenostv.mainLogicExtractIframeChannel( html4, iframeUrl3) else: logger.debug("infinite loop detected, stopped!") elif '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" allowfullscreen width="650" height="400" src="http://cinestrenos' in html3: logger.debug("other loop inside...") iframeUrl3 = Decoder.extract( '<iframe scrolling="no" marginwidth="0" marginheight="0" frameborder="0" allowfullscreen width="650" height="400" src="', '"', html3) html4 = Cineestrenostv.getContentFromUrl(url=iframeUrl3, referer=iframeUrl2) logger.debug("using new iframe url: " + iframeUrl3) element = Cineestrenostv.extractIframeChannel(html4, iframeUrl3) else: #tries to decode the bussinesslink, TODO, review this part #print html3 playerUrl = Decoder.decodeBussinessApp(html3, iframeUrl2) logger.debug("bussinessapp - player url is: " + playerUrl) element["title"] = "Watch streaming" element["permalink"] = True element["link"] = playerUrl return element
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
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