Exemplo n.º 1
0
    def decrypt(encrypted):
        decrypted = encrypted
        try:
            logger.debug("Encrypted content is: "+encrypted)
            if not ONLINE:
                decrypted = PBEWithMD5AndDES.decrypt(encrypted, Spliveappcom.PASSWORD)
            elif len(encrypted)>0 and encrypted.find("http://")==-1:
                decrypted = Downloader.getContentFromUrl(Spliveappcom.DECODER_URL+'?data='+encrypted+"&key="+Spliveappcom.PASSWORD+"&iterations=1000")
            logger.debug("Decrypted content is: "+decrypted)
        except:
            logger.error("Could not be unencrypted: "+encrypted)
            pass

        return decrypted
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
def openSpliveLink(url, page, provider):
    if url.find(".m3u8") == -1 and url.find("rtmp://") == -1:
        channel = Spliveappcom.decodeUrl(url, provider)
        link = channel[0]["link"]
        if link.find(", referer:") > -1:
            link = link[0:link.find(", referer:")]
        url = link
    else:
        logger.debug(
            "nothing decoded for splive encrypted channels, continue...")

    logger.debug("splive BRUTE logic for url: " + url)

    try:
        if 'ponlatv.com' in url or 'playerhd1.pw' in url:
            logger.debug("trying to decode cineestrenos script from url: " +
                         url)
            url = Cineestrenostv.extractScriptLevel3(
                url, referer=Cineestrenostv.MAIN_URL)
            logger.debug("decoded link was: " + url)

        else:
            url = Cineestrenostv.getChannels(url)[0]["link"]
            html = Downloader.getContentFromUrl(url)
            element = Cineestrenostv.extractIframeChannel(html, url)
            if element is not None and element.has_key("link"):
                url = element["link"]
                logger.debug("cineestrenos url was decoded to: " + url)
            else:
                logger.debug("nothing was done to decode cineestrenostv url!")
    except:
        logger.debug("nothing to be decoded with url: " + url)
        pass

    link = url

    logger.info("found link: " + link + ", launching...")
    open(link, page)
Exemplo n.º 4
0
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))
Exemplo n.º 5
0
 def parse_relayer(params):
     url = "NonE"
     try:
         if params.has_key("url"):
             url = params["url"]
             logger.debug("mobdro.directURL: " + url)
         elif params.has_key("relayer"):
             params2 = json.loads(params["relayer"])
             logger.debug("RELAYED: " + repr(params2))
             protocol = "http"  #params2["protocol"]
             app = params2["app"]
             server = params2["server"]
             playpath = params2["playpath"]
             password = params2["password"]
             dire = params2["dir"]
             expiration_time = params2["expiration_time"]
             millis = int(round(time.time() * 1000))
             l = millis / 1000L + expiration_time
             arr = [password, l, dire, playpath]
             url = "%s%d/%s/%s"
             url = url % tuple(arr)
             url_md5 = md5.new(url).digest()
             url_base64 = base64.b64encode(url_md5)
             url_base64 = url_base64.replace("+", "-").replace("/",
                                                               "_").replace(
                                                                   "=", "")
             #arr = [server, url_base64, l, playpath]
             arr = [protocol, server, app, playpath, url_base64, l]
             url = "%s://%s/%s/%s?st=%s&e=%d"  #"http://%s/live/%s/%d/%s"
             url = url % tuple(arr)
             url += "|" + Downloader.getHeaders(Mobdro.MAIN_URL)
         else:
             logger.debug("REJECTED: " + repr(params))
     except KeyError:
         url = "exception"
         pass
     return url
Exemplo n.º 6
0
    def extractProvidersFromLink(url, cookie=""):
        x = []
        if cookie == "":
            cookie = HdfullTv.getNewCookie()
        javascript = HdfullTv.getContentFromUrl(
            url='https://hdfull.me/js/providers.js?v=3.0.50',
            referer=url,
            cookie=cookie)
        '''
        from pyjsparser import PyJsParser
        p = PyJsParser()
        processed = p.parse(javascript)
        logger.debug("str: "+str(processed))
        for value in processed["body"]:
            logger.debug("level: "+str(value))
            if value.has_key('body'):
                pass
        '''
        content = HdfullTv.jhexdecode(javascript)
        logger.debug("content is: " + content)

        html = HdfullTv.getContentFromUrl(url=url, cookie=cookie)
        contentOfuscated = Decoder.extract("var ad = '", "';", html)
        logger.debug("ofuscated content is: " + contentOfuscated)

        javascriptKey = Downloader.getContentFromUrl(
            url=
            "https://hdfull.me/templates/hdfull/js/jquery.hdfull.view.min.js",
            cookie=cookie,
            referer=url)
        logger.debug("hdfull javascript for key is: " + javascriptKey)
        #key = re.match('JSON.parse\(atob.*?substrings\((.*?)\)',javascriptKey)[0]
        key = Decoder.extract('.substrings(', ')', javascriptKey)
        logger.debug("key is: " + key)
        logger.debug("decrypting...")
        jsonLinks = HdfullTv.obfs(base64.b64decode(contentOfuscated),
                                  126 - int(key))
        logger.debug("json links are: " + str(jsonLinks))

        jsonList = json.loads(jsonLinks)
        for jsonElement in jsonList:
            id = jsonElement["id"]
            provider = str(jsonElement["provider"])
            code = str(jsonElement["code"])
            lang = jsonElement["lang"]
            quality = jsonElement["quality"]
            logger.debug("splitter is: " + ";p[" + provider + "]=")
            line = Decoder.extract(";p[" + provider + "]=", "};", content)
            logger.debug("line is: " + line)
            link = Decoder.extract('return "', '"', line)
            logger.debug("hdfull link is: " + link + " - " + code)
            if len(link) > 0:
                element = {}
                element["link"] = link + code
                element["title"] = Decoder.extract(
                    "://", '"', line) + " - " + lang + " - " + quality
                element["finalLink"] = True
                x.append(element)
            else:
                logger.debug("Discarted: " + line + " - " + code)

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

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

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


                file = base64.decodestring(curl)+token+"|"+Downloader.getHeaders(swfUrl)
                logger.debug("final url is: "+file)
            else:
                logger.debug("trying crickfreetv way...: "+html2)
                file = Cricfreetv.seekIframeScript(html2, page, page)
            logger.debug("final remote url: "+file)
            element = {}
            element["link"] = file
            element["permaLink"] = True
            element["title"] = "Watch streaming"
            x.append(element)
        return x
Exemplo n.º 13
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 '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