def resolve(url):
    if 'embed' in url:
        import streamlive_embed
        return streamlive_embed.resolve(url)
    
    try:
        page = url
        addonid = 'script.module.liveresolver'

        user, password = control.setting('streamlive_user'), control.setting('streamlive_pass')
        if (user == '' or password == ''):
            user, password = control.addon(addonid).getSetting('streamlive_user'), control.addon(addonid).getSetting('streamlive_pass')
        if (user == '' or password == ''): return ''

        try: 
            referer = urlparse.parse_qs(urlparse.urlparse(url).query)['referer'][0]
            url = url.replace(referer,'').replace('?referer=','').replace('&referer=','')
        except:
            referer = url


        post_data = 'username=%s&password=%s&accessed_by=web&submit=Login'%(user,password)

        cj = get_cj()
        result = client.request(url,cj=cj,headers={'referer':'http://www.streamlive.to', 'Content-type':'application/x-www-form-urlencoded', 'Origin': 'http://www.streamlive.to', 'Host':'www.streamlive.to', 'User-agent':client.agent()})
        if 'this channel is a premium channel.' in result.lower():
          control.infoDialog('Premium channel. Upgrade your account to watch it!', heading='Streamlive.to')
          return 

        if 'not logged in yet' in result.lower():
            #Cookie expired or not valid, request new cookie
            cj = login(cj,post_data)
            cj.save (cookieFile,ignore_discard=True)
            result = client.request(url,cj=cj)

        token_url = re.compile('getJSON\("(.+?)"').findall(result)[0]
        r2 = client.request(token_url,referer=referer)
        token = json.loads(r2)["token"]

        file = re.compile('(?:[\"\'])?file(?:[\"\'])?\s*:\s*(?:\'|\")(.+?)(?:\'|\")').findall(result)[0].replace('.flv','')
        rtmp = re.compile('streamer\s*:\s*(?:\'|\")(.+?)(?:\'|\")').findall(result)[0].replace(r'\\','\\').replace(r'\/','/')
        app = re.compile('.*.*rtmp://[\.\w:]*/([^\s]+)').findall(rtmp)[0]
        url=rtmp + ' app=' + app + ' playpath=' + file + ' swfUrl=http://www.streamlive.to/ads/streamlive.swf flashver=' + constants.flash_ver() + ' live=1 timeout=15 token=' + token + ' swfVfy=1 pageUrl='+page

        
        return url
    except:
        return
Example #2
0
def resolve(url):
    try:

        if 'player' not in url:
            result = client.request(url)
            rr = 'http://www.laola1.tv' + re.findall(
                '(\/titanplayer.php\?videoid=[^\"\']+)', result)[0]
        else:
            rr = url
        result = client.request(rr)
        streamid = re.compile('streamid: "(.+?)"',
                              re.DOTALL).findall(result)[0]
        partnerid = re.compile('partnerid: "(.+?)"',
                               re.DOTALL).findall(result)[0]
        portalid = re.compile('portalid: "(.+?)"',
                              re.DOTALL).findall(result)[0]
        sprache = re.compile('sprache: "(.+?)"', re.DOTALL).findall(result)[0]
        auth = re.compile('auth = "(.+?)"', re.DOTALL).findall(result)[0]
        timestamp = ''.join(
            re.compile(
                '<!--.*?([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2}).*?-->',
                re.DOTALL).findall(result)[0])

        hdvideourl = 'http://www.laola1.tv/server/hd_video.php?play=' + streamid + '&partner=' + partnerid + '&portal=' + portalid + '&v5ident=&lang=' + sprache
        result = client.request(hdvideourl)
        url2 = re.findall('<url>([^<]+)</url>', result)[0]
        url2 = url2.replace('amp;', '')
        url2 = url2 + '&timestamp=' + timestamp + '&auth=' + auth
        result = client.request(url2, referer=hdvideourl)

        url = re.findall('url\s*=\s*[\"\']([^\'\"]+)', result)[0]
        auth = re.findall('auth\s*=\s*[\"\']([^\'\"]+)', result)[0]
        status = re.findall('status\s*=\s*[\"\']([^\'\"]+)', result)[0]
        if status == '-1':
            comment = re.findall('comment\s*=\s*[\"\']([^\'\"]+)', result)[0]
            control.infoDialog(comment, heading='laola1.tv')
            return

        chars = string.ascii_uppercase
        rand = ''.join(random.choice(chars) for x in range(12))
        url = url.replace('/z/', '/i/')
        url = urlparse.urljoin(
            url, 'master.m3u8?hdnea=' + auth + '&g=' + rand + '&hdcore=3.8.0')
        return url
    except:
        return
Example #3
0
def resolve(url):
    try:
        
        if 'player' not in url:
            result = client.request(url)
            rr = 'http://www.laola1.tv' + re.findall('(\/titanplayer.php\?videoid=[^\"\']+)',result)[0]
        else:
            rr = url
        result = client.request(rr)   
        streamid = re.compile('streamid: "(.+?)"', re.DOTALL).findall(result)[0]
        partnerid = re.compile('partnerid: "(.+?)"', re.DOTALL).findall(result)[0]
        portalid = re.compile('portalid: "(.+?)"', re.DOTALL).findall(result)[0]
        sprache = re.compile('sprache: "(.+?)"', re.DOTALL).findall(result)[0]
        auth = re.compile('auth = "(.+?)"', re.DOTALL).findall(result)[0]
        timestamp = ''.join(re.compile('<!--.*?([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2}).*?-->', re.DOTALL).findall(result)[0])

        hdvideourl = 'http://www.laola1.tv/server/hd_video.php?play='+streamid+'&partner='+partnerid+'&portal='+portalid+'&v5ident=&lang='+sprache
        result = client.request(hdvideourl)
        url2 = re.findall('<url>([^<]+)</url>',result)[0]
        url2 = url2.replace('amp;','')
        url2 = url2 +'&timestamp='+timestamp+'&auth='+auth
        result = client.request(url2, referer = hdvideourl)
        
        url = re.findall('url\s*=\s*[\"\']([^\'\"]+)',result)[0]
        auth = re.findall('auth\s*=\s*[\"\']([^\'\"]+)',result)[0]
        status = re.findall('status\s*=\s*[\"\']([^\'\"]+)',result)[0]
        if status == '-1':
            comment = re.findall('comment\s*=\s*[\"\']([^\'\"]+)',result)[0]
            control.infoDialog(comment, heading='laola1.tv')
            return

        chars=string.ascii_uppercase
        rand =  ''.join(random.choice(chars) for x in range(12))
        url = url.replace('/z/','/i/')
        url = urlparse.urljoin(url, 'master.m3u8?hdnea=' + auth + '&g=' + rand + '&hdcore=3.8.0')
        return url
    except:
        return
Example #4
0
def resolve(url):
    if 'embed' in url:
        import streamlive_embed
        return streamlive_embed.resolve(url)

    try:
        page = url
        addonid = 'script.module.liveresolver'

        user, password = control.setting('streamlive_user'), control.setting(
            'streamlive_pass')
        if (user == '' or password == ''):
            user, password = control.addon(addonid).getSetting(
                'streamlive_user'), control.addon(addonid).getSetting(
                    'streamlive_pass')
        if (user == '' or password == ''): return ''

        try:
            referer = urlparse.parse_qs(
                urlparse.urlparse(url).query)['referer'][0]
            url = url.replace(referer,
                              '').replace('?referer=',
                                          '').replace('&referer=', '')
        except:
            referer = url

        post_data = 'username=%s&password=%s&accessed_by=web&submit=Login' % (
            user, password)

        cj = get_cj()
        result = client.request(url,
                                cj=cj,
                                headers={
                                    'referer': 'http://www.streamlive.to',
                                    'Content-type':
                                    'application/x-www-form-urlencoded',
                                    'Origin': 'http://www.streamlive.to',
                                    'Host': 'www.streamlive.to',
                                    'User-agent': client.agent()
                                })
        if 'this channel is a premium channel.' in result.lower():
            control.infoDialog(
                'Premium channel. Upgrade your account to watch it!',
                heading='Streamlive.to')
            return

        if 'not logged in yet' in result.lower(
        ) or 'you have reached the limit today' in result.lower():
            #Cookie expired or not valid, request new cookie
            cj = login(cj, post_data)
            cj.save(cookieFile, ignore_discard=True)
            result = client.request(url, cj=cj)

        token_url = re.compile('getJSON\("(.+?)"').findall(result)[0]
        r2 = client.request(token_url, referer=referer)
        token = json.loads(r2)["token"]

        file = re.compile(
            '(?:[\"\'])?file(?:[\"\'])?\s*:\s*(?:\'|\")(.+?)(?:\'|\")'
        ).findall(result)[0].replace('.flv', '')
        rtmp = re.compile('streamer\s*:\s*(?:\'|\")(.+?)(?:\'|\")').findall(
            result)[0].replace(r'\\', '\\').replace(r'\/', '/')
        app = re.compile('.*.*rtmp://[\.\w:]*/([^\s]+)').findall(rtmp)[0]
        url = rtmp + ' app=' + app + ' playpath=' + file + ' swfUrl=http://www.streamlive.to/ads/streamlive.swf flashver=' + constants.flash_ver(
        ) + ' live=1 timeout=15 token=' + token + ' swfVfy=1 pageUrl=' + page

        return url
    except:
        return