Exemplo n.º 1
0
def resolve(url):
    try:
        addonid = 'script.module.liveresolver'

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

        token = urllib.urlencode({'username': user, 'password': password})
        token = 'http://m-api.ustvnow.com/gtv/1/live/login?%s&device=gtv&redir=0' % token
        token = json.loads(client.request(token))['token']

        result = 'http://m-api.ustvnow.com/gtv/1/live/playingnow?token=%s' % token
        result = json.loads(client.request(result))

        try:
            scode = urlparse.parse_qs(urlparse.urlparse(url).query)['scode'][0]
        except:
            stream_code = urlparse.parse_qs(urlparse.urlparse(url).query)['stream_code'][0]
            scode = [i['scode'] for i in result['results'] if i['stream_code'] == stream_code][0]

        key = (result['globalparams']['passkey']).replace('key=', '')

        url = 'http://m-api.ustvnow.com/stream/1/live/view?token=%s&key=%s&scode=%s' % (token, key, scode)
        url = json.loads(client.request(url))['stream']

        return url
    except:
        return ''
Exemplo n.º 2
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():
            #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
Exemplo n.º 3
0
def resolve(url):
    try:
        addonid = 'script.module.liveresolver'

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

        token = urllib.urlencode({'username': user, 'password': password})
        token = 'http://m-api.ustvnow.com/gtv/1/live/login?%s&device=gtv&redir=0' % token
        token = json.loads(client.request(token))['token']

        result = 'http://m-api.ustvnow.com/gtv/1/live/playingnow?token=%s' % token
        result = json.loads(client.request(result))

        try:
            scode = urlparse.parse_qs(urlparse.urlparse(url).query)['scode'][0]
        except:
            stream_code = urlparse.parse_qs(
                urlparse.urlparse(url).query)['stream_code'][0]
            scode = [
                i['scode'] for i in result['results']
                if i['stream_code'] == stream_code
            ][0]

        key = (result['globalparams']['passkey']).replace('key=', '')

        url = 'http://m-api.ustvnow.com/stream/1/live/view?token=%s&key=%s&scode=%s' % (
            token, key, scode)
        url = json.loads(client.request(url))['stream']

        return url
    except:
        return ''
Exemplo n.º 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