예제 #1
0
def get_media_url(url):
    def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
        return ((num == 0) and numerals[0]) or (baseN(
            num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])

    def conv(s, addfactor=None):
        if 'function()' in s:
            addfactor = s.split('b.toString(')[1].split(')')[0]
            fname = re.findall('function\(\)\{function (.*?)\(', s)[0]
            s = s.replace(fname, 'myfunc')
            s = ''.join(s.split('}')[1:])
        if '+' not in s:
            if '.0.toString' in s:
                ival, b = s.split('.0.toString(')
                b = b.replace(')', '')
                return baseN(int(ival), int(eval(b)))
            elif 'myfunc' in s:
                b, ival = s.split('myfunc(')[1].split(',')
                ival = ival.replace(')', '').replace('(', '').replace(';', '')
                b = b.replace(')', '').replace('(', '').replace(';', '')
                b = eval(addfactor.replace('a', b))
                return baseN(int(ival), int(b))
            else:
                return eval(s)
        r = ''
        for ss in s.split('+'):
            r += conv(ss, addfactor)
        return r

    try:
        web_url = url
        headers = {'User-Agent': common.FF_USER_AGENT}
        html = net.http_GET(web_url, headers=headers).content.encode('utf-8')
        aaencoded = re.findall(
            '<script type="text/javascript">(゚ω゚.*?)</script>', html,
            re.DOTALL)
        if aaencoded:
            enc_index = re.search(
                'welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);', html
            )  # only digits, math ops, whitespace. [^;] too loose for eval
            if enc_index:
                enc_index = eval(enc_index.group(1))
                dtext = AADecoder(aaencoded[enc_index]).decode()
                dtext1 = re.findall('window\..+?=(.*?);', dtext)
                if len(dtext1) == 0:
                    dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext)
                dtext = conv(dtext1[0])
                return dtext.replace(
                    "https", "http") + '|User-Agent=%s' % urllib.quote_plus(
                        common.FF_USER_AGENT)

    except Exception as e:
        common.log_utils.log_debug(
            'Exception during openload resolve parse: %s' % e)
        raise

    raise ResolverError(
        'Unable to resolve openload.io link. Filelink not found.')
예제 #2
0
def get_media_url(url):
    def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
        return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])

    def conv(s, addfactor=None):
        if 'function()' in s:
            addfactor = s.split('b.toString(')[1].split(')')[0]
            fname = re.findall('function\(\)\{function (.*?)\(', s)[0]
            s = s.replace(fname, 'myfunc')
            s = ''.join(s.split('}')[1:])
        if '+' not in s:
            if '.0.toString' in s:
                ival, b = s.split('.0.toString(')
                b = b.replace(')', '')
                return baseN(int(ival), int(eval(b)))
            elif 'myfunc' in s:
                b, ival = s.split('myfunc(')[1].split(',')
                ival = ival.replace(')', '').replace('(', '').replace(';', '')
                b = b.replace(')', '').replace('(', '').replace(';', '')
                b = eval(addfactor.replace('a', b))
                return baseN(int(ival), int(b))
            else:
                return eval(s)
        r = ''
        for ss in s.split('+'):
            r += conv(ss, addfactor)
        return r

    try:
        web_url = url
        headers = {'User-Agent': common.FF_USER_AGENT}
        html = net.http_GET(web_url, headers=headers).content.encode('utf-8')
        aaencoded = re.findall('<script type="text/javascript">(゚ω゚.*?)</script>', html, re.DOTALL)
        if aaencoded:
            enc_index = re.search('welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);', html)  # only digits, math ops, whitespace. [^;] too loose for eval
            if enc_index:
                enc_index = eval(enc_index.group(1))
                dtext = AADecoder(aaencoded[enc_index]).decode()
                dtext1 = re.findall('window\..+?=(.*?);', dtext)
                if len(dtext1) == 0:
                    dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext)
                dtext = conv(dtext1[0])
                return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT

    except Exception as e:
        common.log_utils.log_debug('Exception during openload resolve parse: %s' % e)
        raise

    raise ResolverError('Unable to resolve openload.io link. Filelink not found.')
예제 #3
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        html = self.net.http_GET(web_url, headers=headers).content
        data = helpers.get_hidden(html)
        data['confirm.y'] = random.randint(0, 120)
        data['confirm.x'] = random.randint(0, 120)
        headers['Referer'] = web_url
        post_url = web_url + '#'
        html = self.net.http_POST(post_url, form_data=data,
                                  headers=headers).content.encode('utf-8')
        match = re.search('hide\(\);(.*?;)\s*//', html, re.DOTALL)
        if match:
            dtext = AADecoder(match.group(1)).decode()
            match = re.search('"?sources"?\s*:\s*\[(.*?)\]', dtext, re.DOTALL)
            if match:
                for match in re.finditer(
                        '''['"]?file['"]?\s*:\s*['"]([^'"]+)['"][^}]*['"]?label['"]?\s*:\s*['"]([^'"]*)''',
                        match.group(1), re.DOTALL):
                    stream_url, _label = match.groups()
                    stream_url = stream_url.replace('\/', '/')
                    stream_url += '|User-Agent=%s&Referer=%s' % (
                        common.FF_USER_AGENT, web_url)
                    return stream_url

        raise ResolverError('File Not Found or removed')
예제 #4
0
def get_media_url(url):
    try:
        headers = {'User-Agent': common.FF_USER_AGENT}
        html = net.http_GET(url, headers=headers).content.encode('utf-8')
        decodes = [
            AADecoder(match.group(1)).decode() for match in re.finditer(
                '<script[^>]+>(゚ω゚ノ[^<]+)<', html, re.DOTALL)
        ]
        if not decodes:
            raise ResolverError('No Encoded Section Found. Deleted?')

        common.log_utils.log(decodes)
        enc_index = 0
        for text in decodes:
            match = re.search('welikekodi_ya_rly\s*=\s*(.*?)([0-9/\*\-\+ ]+)',
                              text)
            if match:
                enc_index = eval(match.group(2))
                if 'round' in match.group(1):
                    enc_index = int(round(enc_index))

        common.log_utils.log('chosen encode: %s' % (decodes[enc_index]))
        match = re.search('window\..+?=(.*?);', decodes[enc_index])
        if not match:
            match = re.search('.*attr\(\"href\",\((.*)', decodes[enc_index])

        if match:
            common.log_utils.log('to conv: %s' % (match.group(1)))
            dtext = conv(match.group(1))
            dtext = dtext.replace('https', 'http')
            request = urllib2.Request(dtext, None, headers)
            response = urllib2.urlopen(request)
            url = response.geturl()
            response.close()

        url += '|' + urllib.urlencode({
            'Referer': url,
            'User-Agent': common.IOS_USER_AGENT
        })
        return url

    except Exception as e:
        common.log_utils.log_debug(
            'Exception during openload resolve parse: %s' % e)
        raise

    raise ResolverError(
        'Unable to resolve openload.io link. Filelink not found.')
예제 #5
0
    def get_media_url(self, host, media_id):
        try:
            web_url = self.get_url(host, media_id)
            headers = {'User-Agent': common.FF_USER_AGENT}
            html = self.net.http_GET(web_url,
                                     headers=headers).content.encode('utf-8')
            common.log_utils.log(html)
            aaencoded = re.search(
                'id="videooverlay".*?<script[^>]*>(.*)</script>', html,
                re.DOTALL)
            dtext = AADecoder(aaencoded.group(1)).decode()
            stream_url = re.search('[\'"](http.*?)[\'"]', dtext)
            if stream_url:
                return stream_url.group(
                    1) + '|User-Agent=%s' % (common.FF_USER_AGENT)
        except Exception as e:
            common.log_utils.log_debug(
                'Exception during openload resolve parse: %s' % (e))

        try:
            info_url = 'https://api.openload.io/1/file/info?file=%s' % (
                media_id)
            js_result = self.__get_json(info_url)
            if 'result' in js_result and media_id in js_result['result']:
                if js_result['result'][media_id]['status'] != 200:
                    raise ResolverError('File Not Available')
            ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % (
                media_id)
            js_result = self.__get_json(ticket_url)
            video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s' % (
                media_id, js_result['result']['ticket'])
            captcha_url = js_result['result'].get('captcha_url', None)
            if captcha_url:
                captcha_response = captcha_lib.get_response(captcha_url)
                if captcha_response:
                    video_url += '&captcha_response=%s' % urllib.quote(
                        captcha_response)
            xbmc.sleep(js_result['result']['wait_time'] * 1000)
            js_result = self.__get_json(video_url)
            return js_result['result']['url'] + '?mime=true'
        except ResolverError:
            raise
        except Exception as e:
            raise ResolverError('Exception in openload: %s' % (e))

        raise ResolverError(
            'Unable to resolve openload.io link. Filelink not found.')
예제 #6
0
def get_media_url(url):
    def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
        return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])

    def conv(s, addfactor=None):
        if 'function()' in s:
            addfactor = s.split('b.toString(')[1].split(')')[0]
            fname = re.findall('function\(\)\{function (.*?)\(', s)[0]
            s = s.replace(fname, 'myfunc')
            s = ''.join(s.split('}')[1:])
        if '+' not in s:
            if '.0.toString' in s:
                ival, b = s.split('.0.toString(')
                b = b.replace(')', '')
                return baseN(int(ival), int(eval(b)))
            elif 'myfunc' in s:
                b, ival = s.split('myfunc(')[1].split(',')
                ival = ival.replace(')', '').replace('(', '').replace(';', '')
                b = b.replace(')', '').replace('(', '').replace(';', '')
                b = eval(addfactor.replace('a', b))
                return baseN(int(ival), int(b))
            else:
                return eval(s)
        r = ''
        for ss in s.split('+'):
            r += conv(ss, addfactor)
        return r

    try:
        web_url = url.replace('/embed/', '/f/')

        headers = {'User-Agent': common.FF_USER_AGENT}
        html = net.http_GET(web_url, headers=headers).content.encode('utf-8')

        enc_index = re.search('welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);', html)
        if enc_index:
            enc_index = eval(enc_index.group(1))
    
            aaencoded = re.findall('<script[^>]+>(゚ω゚ノ[^<]+)<', html, re.DOTALL)
            if aaencoded:
                aaencoded = aaencoded[enc_index]
        
                dtext = AADecoder(aaencoded).decode()
        
                dtext1 = re.findall('window\..+?=(.*?);', dtext)
                if len(dtext1) == 0:
                    dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext)
        
                dtext = conv(dtext1[0])
                dtext = dtext.replace('https', 'http')
        
                request = urllib2.Request(dtext, None, headers)
                response = urllib2.urlopen(request)
                url = response.geturl()
                response.close()
        
                url += '|' + urllib.urlencode({'Referer': web_url, 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'})
                return url
    
    except Exception as e:
        common.log_utils.log_debug('Exception during openload resolve parse: %s' % e)
        raise

    raise ResolverError('Unable to resolve openload.io link. Filelink not found.')
예제 #7
0
def get_media_url(url):
    def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
        return ((num == 0) and numerals[0]) or (baseN(
            num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])

    def conv(s, addfactor=None):
        if 'function()' in s:
            addfactor = s.split('b.toString(')[1].split(')')[0]
            fname = re.findall('function\(\)\{function (.*?)\(', s)[0]
            s = s.replace(fname, 'myfunc')
            s = ''.join(s.split('}')[1:])
        if '+' not in s:
            if '.0.toString' in s:
                ival, b = s.split('.0.toString(')
                b = b.replace(')', '')
                return baseN(int(ival), int(eval(b)))
            elif 'myfunc' in s:
                b, ival = s.split('myfunc(')[1].split(',')
                ival = ival.replace(')', '').replace('(', '').replace(';', '')
                b = b.replace(')', '').replace('(', '').replace(';', '')
                b = eval(addfactor.replace('a', b))
                return baseN(int(ival), int(b))
            else:
                return eval(s)
        r = ''
        for ss in s.split('+'):
            r += conv(ss, addfactor)
        return r

    try:
        web_url = url.replace('/embed/', '/f/')

        headers = {'User-Agent': common.FF_USER_AGENT}
        html = net.http_GET(web_url, headers=headers).content.encode('utf-8')

        enc_index = re.search('welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);',
                              html)
        if enc_index:
            enc_index = eval(enc_index.group(1))

            aaencoded = re.findall('<script[^>]+>(゚ω゚ノ[^<]+)<', html,
                                   re.DOTALL)
            if aaencoded:
                aaencoded = aaencoded[enc_index]

                dtext = AADecoder(aaencoded).decode()

                dtext1 = re.findall('window\..+?=(.*?);', dtext)
                if len(dtext1) == 0:
                    dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext)

                dtext = conv(dtext1[0])
                dtext = dtext.replace('https', 'http')

                request = urllib2.Request(dtext, None, headers)
                response = urllib2.urlopen(request)
                url = response.geturl()
                response.close()

                url += '|' + urllib.urlencode({
                    'Referer':
                    web_url,
                    'User-Agent':
                    'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'
                })
                return url

    except Exception as e:
        common.log_utils.log_debug(
            'Exception during openload resolve parse: %s' % e)
        raise

    raise ResolverError(
        'Unable to resolve openload.io link. Filelink not found.')
예제 #8
0
    def get_media_url(self, host, media_id):
        def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
            return ((num == 0) and numerals[0]) or (baseN(
                num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])

        def conv(s, addfactor=None):
            if 'function()' in s:
                addfactor = s.split('b.toString(')[1].split(')')[0]
                fname = re.findall('function\(\)\{function (.*?)\(', s)[0]
                s = s.replace(fname, 'myfunc')
                s = ''.join(s.split('}')[1:])
            if '+' not in s:
                if '.0.toString' in s:
                    ival, b = s.split('.0.toString(')
                    b = b.replace(')', '')
                    return baseN(int(ival), int(eval(b)))
                elif 'myfunc' in s:
                    b, ival = s.split('myfunc(')[1].split(',')
                    ival = ival.replace(')', '').replace('(', '')
                    b = b.replace(')', '').replace('(', '')
                    b = eval(addfactor.replace('a', b))
                    return baseN(int(ival), int(b))
                else:
                    return eval(s)
            r = ''
            for ss in s.split('+'):
                r += conv(ss, addfactor)
            return r

        try:
            web_url = self.get_url(host, media_id)
            headers = {'User-Agent': common.FF_USER_AGENT}
            html = self.net.http_GET(web_url,
                                     headers=headers).content.encode('utf-8')
            aaencoded = re.findall(
                'id="olvideo".*?text/javascript\">(.*?)</script>', html,
                re.DOTALL)[0]
            dtext = AADecoder(aaencoded).decode()
            dtext = re.findall('window\..+?=(.*?);', dtext)[0]
            dtext = conv(dtext)
            return dtext.replace(
                "https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT

        except Exception as e:
            common.log_utils.log_debug(
                'Exception during openload resolve parse: %s' % e)
            raise

        # Commented out because, by default, all openload videos no longer work with their API so it's a waste
        #         try:
        #             info_url = 'https://api.openload.io/1/file/info?file=%s' % (media_id)
        #             js_result = self.__get_json(info_url)
        #             if 'result' in js_result and media_id in js_result['result']:
        #                 if js_result['result'][media_id]['status'] != 200:
        #                     raise ResolverError('File Not Available')
        #             ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % (media_id)
        #             js_result = self.__get_json(ticket_url)
        #             video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s' % (media_id, js_result['result']['ticket'])
        #             captcha_url = js_result['result'].get('captcha_url', None)
        #             if captcha_url:
        #                 captcha_response = captcha_lib.get_response(captcha_url)
        #                 if captcha_response:
        #                     video_url += '&captcha_response=%s' % urllib.quote(captcha_response)
        #             xbmc.sleep(js_result['result']['wait_time'] * 1000)
        #             js_result = self.__get_json(video_url)
        #             return js_result['result']['url'] + '?mime=true'
        #         except ResolverError:
        #             raise
        #         except Exception as e:
        #             raise ResolverError('Exception in openload: %s' % (e))

        raise ResolverError(
            'Unable to resolve openload.io link. Filelink not found.')
예제 #9
0
    def get_media_url(self, host, media_id):
        def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
            return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])

        def conv(s, addfactor=None):
            if 'function()' in s:
                addfactor = s.split('b.toString(')[1].split(')')[0]
                fname = re.findall('function\(\)\{function (.*?)\(', s)[0]
                s = s.replace(fname, 'myfunc')
                s = ''.join(s.split('}')[1:])
            if '+' not in s:
                if '.0.toString' in s:
                    ival, b = s.split('.0.toString(')
                    b = b.replace(')', '')
                    return baseN(int(ival), int(eval(b)))
                elif 'myfunc' in s:
                    b, ival = s.split('myfunc(')[1].split(',')
                    ival = ival.replace(')', '').replace('(', '').replace(';', '')
                    b = b.replace(')', '').replace('(', '').replace(';', '')
                    b = eval(addfactor.replace('a', b))
                    return baseN(int(ival), int(b))
                else:
                    return eval(s)
            r = ''
            for ss in s.split('+'):
                r += conv(ss, addfactor)
            return r

        try:
            web_url = self.get_url(host, media_id)
            headers = {'User-Agent': common.FF_USER_AGENT}
            html = self.net.http_GET(web_url, headers=headers).content.encode('utf-8')
            aaencoded = re.findall('id="olvideo".*?text/javascript\">(.*?)</script>', html, re.DOTALL)[0]
            dtext = AADecoder(aaencoded).decode()
            #print dtext
            dtext1 = re.findall('window\..+?=(.*?);', dtext)
            if len(dtext1)==0:
                dtext1=re.findall('.*attr\(\"href\",\((.*)',dtext)
            dtext = conv(dtext1[0])
            return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT

        except Exception as e:
            common.log_utils.log_debug('Exception during openload resolve parse: %s' % e)
            raise

        # Commented out because, by default, all openload videos no longer work with their API so it's a waste
        #         try:
        #             info_url = 'https://api.openload.io/1/file/info?file=%s' % (media_id)
        #             js_result = self.__get_json(info_url)
        #             if 'result' in js_result and media_id in js_result['result']:
        #                 if js_result['result'][media_id]['status'] != 200:
        #                     raise ResolverError('File Not Available')
        #             ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % (media_id)
        #             js_result = self.__get_json(ticket_url)
        #             video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s' % (media_id, js_result['result']['ticket'])
        #             captcha_url = js_result['result'].get('captcha_url', None)
        #             if captcha_url:
        #                 captcha_response = captcha_lib.get_response(captcha_url)
        #                 if captcha_response:
        #                     video_url += '&captcha_response=%s' % urllib.quote(captcha_response)
        #             xbmc.sleep(js_result['result']['wait_time'] * 1000)
        #             js_result = self.__get_json(video_url)
        #             return js_result['result']['url'] + '?mime=true'
        #         except ResolverError:
        #             raise
        #         except Exception as e:
        #             raise ResolverError('Exception in openload: %s' % (e))

        raise ResolverError('Unable to resolve openload.io link. Filelink not found.')
예제 #10
0
def get_media_url(url):
    try:
        HTTP_HEADER = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0',
            'Accept':
            'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
            'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
            'Accept-Encoding': 'none',
            'Accept-Language': 'en-US,en;q=0.8',
            'Referer': url
        }  # 'Connection': 'keep-alive'

        html = net.http_GET(url, headers=HTTP_HEADER).content
        try:
            html = html.encode('utf-8')
        except:
            pass
        html = unpack(html)

        decodes = []
        hidden_id = ''
        for match in re.finditer('<script[^>]*>(.*?)</script>', html,
                                 re.DOTALL):
            decode = ''
            encoded = match.group(1)
            match = re.search("(゚ω゚ノ.*?\('_'\);)", encoded, re.DOTALL)
            if match:
                decode = AADecoder(match.group(1)).decode()
                decodes.append(decode)

            match = re.search('(.=~\[\].*\(\);)', encoded, re.DOTALL)
            if match:
                decode = JJDecoder(match.group(1)).decode()
                decodes.append(decode)

            match = re.search(r'=\s*\$\("#([^"]+)"', decode,
                              re.DOTALL | re.IGNORECASE)
            if match:
                hidden_id = match.group(1)

        if not hidden_id:
            raise ResolverError('Hidden ID Not Found. Deleted?')

        match = re.search(r'<span[^>]+id\s*="%s"[^>]*>([^<]+)' % (hidden_id),
                          html, re.DOTALL | re.IGNORECASE)
        if match:
            hidden_url = match.group(1)
        else:
            raise ResolverError('Stream Url Not Found. Deleted?')

        if not decodes:
            raise ResolverError('No Encoded Section Found. Deleted?')

        hiddenurl = HTMLParser().unescape(hidden_url)
        magic_number = 0
        for decode in decodes:
            match = re.search('charCodeAt\(\d+\)\s*\+\s*(\d+)\)', decode,
                              re.DOTALL | re.I)
            if match:
                magic_number = match.group(1)
                break

        s = []
        for idx, i in enumerate(hiddenurl):
            j = ord(i)
            if (j >= 33 & j <= 126):
                j = 33 + ((j + 14) % 94)

            if idx == len(hiddenurl) - 1:
                j += int(magic_number)
            s.append(chr(j))
        res = ''.join(s)

        videoUrl = 'https://openload.co/stream/{0}?mime=true'.format(res)
        dtext = videoUrl.replace('https', 'http')
        headers = {'User-Agent': HTTP_HEADER['User-Agent']}
        req = urllib2.Request(dtext, None, headers)
        res = urllib2.urlopen(req)
        videourl = res.geturl()
        if MIN_SIZE < int(res.headers['Content-Length']) < MAX_SIZE:
            raise ResolverError('Openload.co resolve failed. Pigeons? (%s)' %
                                (res.headers['Content-Length']))
        res.close()

        return videourl
    except Exception as e:
        common.log_utils.log_debug(
            'Exception during openload resolve parse: %s' % e)
        raise

    raise ResolverError(
        'Unable to resolve openload.io link. Filelink not found.')
예제 #11
0
    def get_media_url(self, host, media_id):
        def baseN(num,b,numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
            return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])

        def conv(s,addfactor=None):
            #print s
            if 'function()' in s:
                addfactor=s.split('b.toString(')[1].split(')')[0]
                fname=re.findall('function\(\)\{function (.*?)\(',s)[0]
                s=s.replace(fname,'myfunc')
                s=''.join(s.split('}')[1:])
            if '+' not in s:
                if '.0.toString' in s:
                    ival,b=s.split('.0.toString(')
                    b=b.replace(')','')
                    #print  ival, b
                    return baseN(int(ival),int(eval(b)))
                elif 'myfunc' in s:
                    b,ival=s.split('myfunc(')[1].split(',')
                    ival=ival.replace(')','').replace('(','')
                    b=b.replace(')','').replace('(','')
                    b=eval(addfactor.replace('a',b))
                    #print  ival, b
                    return baseN(int(ival),int(b))
                else:
                    #print s
                    return eval(s)
            r=''
            for ss in s.split('+'):
                r+=conv(ss,addfactor)
            return r

        try:
            web_url = self.get_url(host, media_id)
            headers = {'User-Agent': common.FF_USER_AGENT}
            html = self.net.http_GET(web_url, headers=headers).content.encode('utf-8')
            common.log_utils.log(html)
            aaencoded = re.findall('id=\"olvideo\".*\n.*?text/javascript\">(.*)</script>',html)[0] 
            dtext = AADecoder(aaencoded).decode()
            dtext = re.findall('window.vs=(.*?);',dtext)[0]
            dtext = conv(dtext)
            return dtext.replace("https","http") + '|User-Agent=%s' % (common.FF_USER_AGENT)
            
        except Exception as e:
            common.log_utils.log_debug('Exception during openload resolve parse: %s' % (e))

        try:
            info_url = 'https://api.openload.io/1/file/info?file=%s' % (media_id)
            js_result = self.__get_json(info_url)
            if 'result' in js_result and media_id in js_result['result']:
                if js_result['result'][media_id]['status'] != 200:
                    raise ResolverError('File Not Available')
            ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % (media_id)
            js_result = self.__get_json(ticket_url)
            video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s' % (media_id, js_result['result']['ticket'])
            captcha_url = js_result['result'].get('captcha_url', None)
            if captcha_url:
                captcha_response = captcha_lib.get_response(captcha_url)
                if captcha_response:
                    video_url += '&captcha_response=%s' % urllib.quote(captcha_response)
            xbmc.sleep(js_result['result']['wait_time'] * 1000)
            js_result = self.__get_json(video_url)
            return js_result['result']['url'] + '?mime=true'
        except ResolverError:
            raise
        except Exception as e:
            raise ResolverError('Exception in openload: %s' % (e))

        raise ResolverError('Unable to resolve openload.io link. Filelink not found.')