Example #1
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content

        if html:
            try:
                packed = helpers.get_packed_data(html)
                packed = re.search(
                    """(eval\s*\(function.*?\|location\|.*?\)\))""",
                    packed).groups()[0]
                packed = jsunpack.unpack(packed)
                location_href = re.search(
                    """document\.location\.href\s*=\s*["']([^"']+)""",
                    packed).groups()[0]
                location_href = 'http:%s' % location_href if location_href.startswith(
                    "//") else location_href

                return helpers.get_media_url(
                    location_href,
                    patterns=['''file:["'](?P<url>(?!http://s13)[^"']+)'''
                              ]).replace(' ', '%20')

            except:
                raise ResolverError('File not found')

        raise ResolverError('File not found')
Example #2
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content

        tries = 0
        while tries < MAX_TRIES:
            data = helpers.get_hidden(html)
            data.update(captcha_lib.do_captcha(html))

            html = self.net.http_POST(web_url, form_data=data).content
            html += helpers.get_packed_data(html)
            match = re.search('name="src"\s*value="([^"]+)', html)
            if match:
                return match.group(1)

            # try to find source in html
            match = re.search('<span[^>]*>\s*<a\s+href="([^"]+)', html,
                              re.DOTALL)
            if match:
                return match.group(1)

            tries += 1

        raise ResolverError(
            'Unable to resolve kingfiles link. Filelink not found.')
Example #3
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content

        if html:
            try:
                packed = helpers.get_packed_data(html)
                i = 0  #just incase of infinite loop
                while jsunpack.detect(packed) and i < 5:
                    i += 1
                    try:
                        packed = jsunpack.unpack(packed)
                    except:
                        break

                location_href = re.search(
                    """document\.location\.href\s*=\s*["']([^"']+)""",
                    packed).groups()[0]
                location_href = 'http:%s' % location_href if location_href.startswith(
                    "//") else location_href

                return helpers.get_media_url(
                    location_href,
                    patterns=['''file:["'](?P<url>(?!http://s13)[^"']+)'''
                              ]).replace(' ', '%20')

            except Exception as e:
                raise ResolverError(e)

        raise ResolverError('File not found')
Example #4
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        response = self.net.http_GET(web_url, headers=headers)
        html = response.content
        data = helpers.get_hidden(html)
        headers['Cookie'] = response.get_headers(as_dict=True).get(
            'Set-Cookie', '')
        sleep_time = 10  # in seconds
        wait_ms = sleep_time * 1000
        common.kodi.notify(header=None,
                           msg='XvidStage requires %s second wait' %
                           sleep_time,
                           duration=wait_ms)
        common.kodi.sleep(wait_ms)
        html = self.net.http_POST(web_url, headers=headers,
                                  form_data=data).content

        if html:
            packed = helpers.get_packed_data(html)

            sources = helpers.scrape_sources(packed, result_blacklist=['tmp'])
            if sources:
                return helpers.pick_source(sources) + helpers.append_headers(
                    headers)

        raise ResolverError('Unable to locate video')
Example #5
0
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     self.headers['Referer'] = web_url
     html = self.net.http_GET(web_url, headers=self.headers).content
     html += helpers.get_packed_data(html)
     match = re.search('vurl_\d+="([^"]+)', html)
     if match:
         self.headers.update({'Referer': web_url})
         return match.group(1) + helpers.append_headers(self.headers)
     else:
         raise ResolverError('File not found')
Example #6
0
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {'User-Agent': common.RAND_UA}
     html = self.net.http_GET(web_url, headers=headers).content
     
     html += helpers.get_packed_data(html)
     sources = helpers.scrape_sources(html)
     if sources:
         return helpers.pick_source(sources) + helpers.append_headers(headers)
             
     raise ResolverError("Video not found")
Example #7
0
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     self.headers['Referer'] = web_url
     html = self.net.http_GET(web_url, headers=self.headers).content
     html += helpers.get_packed_data(html)
     match = re.search('vurl_\d+="([^"]+)', html)
     if match:
         self.headers.update({'Referer': web_url})
         return match.group(1) + helpers.append_headers(self.headers)
     else:
         raise ResolverError('File not found')
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {'User-Agent': common.RAND_UA}
     html = self.net.http_GET(web_url, headers=headers).content
     
     if html:
         html += helpers.get_packed_data(html)
         source = re.search('''sources\s*:\s*\["([^"]+)''', html)
         if source:
             return source.group(1) + helpers.append_headers(headers)
             
     raise ResolverError("Video not found")
Example #9
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA, 'verifypeer': 'False'}
        html = self.net.http_GET(web_url, headers=headers).content

        if html:
            html += helpers.get_packed_data(html)
            source = re.search(r'''sources\s*:\s*\["([^"]+)''', html)
            if source:
                return source.group(1) + helpers.append_headers(headers)

        raise ResolverError("Video not found")
Example #10
0
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {'User-Agent': common.RAND_UA}
     html = self.net.http_GET(web_url, headers=headers).content
     
     if html:
         packed = helpers.get_packed_data(html)
         headers.update({'Referer': web_url})
         sources = helpers.parse_sources_list(packed)
         
         if sources: return helpers.pick_source(sources) + helpers.append_headers(headers)
         
     raise ResolverError('File not found')
Example #11
0
def get_media_url(url):
    try:
        hostname = urlparse.urlparse(url).hostname
        headers = {'User-Agent': common.FF_USER_AGENT}
        html = net.http_GET(url, headers=headers).content
        headers.update({'Referer': url})
        for match in re.finditer('''<script[^>]*src=["']([^'"]+)''', html):
            _html = get_js(match.group(1), headers, hostname)

        match = re.search('''href=['"]([^"']+/playvideo-[^"']+)''', html)
        if match:
            playvid_url = match.group(1)
            html = net.http_GET(playvid_url, headers=headers).content
            headers.update({'Referer': playvid_url})
            for match in re.finditer('''<script[^>]*src=["']([^'"]+)''', html):
                js = get_js(match.group(1), headers, hostname)
                match = re.search(
                    '''!=\s*null.*?get\(['"]([^'"]+).*?\{([^:]+)''', js,
                    re.DOTALL)
                if match:
                    fx_url, fx_param = match.groups()
                    fx_url = resolve_url(
                        urlparse.urljoin('http://www.flashx.tv', fx_url) +
                        '?' + urllib.urlencode({fx_param: "y"}) + '&' +
                        urllib.urlencode({"fxfx": 6}))
                    common.logger.log('fxurl: %s' % (fx_url))
                    _html = net.http_GET(fx_url, headers=headers).content

            headers.update({'Referer': url})
            html = net.http_GET(playvid_url, headers=headers).content
            html += helpers.get_packed_data(html)

        sources = helpers.scrape_sources(
            html,
            patterns=[
                """src:\s*["'](?P<url>[^"']+).+?res:\s*["']?(?P<label>\d+)"""
            ],
            result_blacklist=["trailer.mp4"],
            generic_patterns=False)

        if sources:
            return helpers.pick_source(sources) + helpers.append_headers(
                headers)

    except Exception as e:
        logger.log_debug('Exception during flashx resolve parse: %s' % e)
        raise

    raise ResolverError('Unable to resolve flashx link. Filelink not found.')
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        response = self.net.http_GET(web_url, headers=headers)
        html = response.content
        data = helpers.get_hidden(html)
        headers['Cookie'] = response.get_headers(as_dict=True).get('Set-Cookie', '')
        html = self.net.http_POST(web_url, headers=headers, form_data=data).content

        if html:
            packed = helpers.get_packed_data(html)

            sources = helpers.scrape_sources(packed, result_blacklist=['tmp'])
            if sources: return helpers.pick_source(sources) + helpers.append_headers(headers)

        raise ResolverError('Unable to locate video')
Example #13
0
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {'User-Agent': common.RAND_UA}
     html = self.net.http_GET(web_url, headers=headers).content
     packed = helpers.get_packed_data(html)
     
     try:
         sources = re.search("""sources:\s*\["(.+?)"\]""", packed).group(1).split('","')
         sources = [(urlparse(sources[i]).path.split('/')[-1], sources[i]) for i in range(len(sources))]
     except:
         sources = helpers.scrape_sources(html, patterns=["""sources:\s*\[["'](?P<url>[^"']+)"""])
     
     if sources:
         headers.update({'Referer': web_url})
         return helpers.pick_source(sources) + helpers.append_headers(headers)
     
     raise ResolverError('File not found')
Example #14
0
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {'User-Agent': common.RAND_UA}
     html = self.net.http_GET(web_url, headers=headers).content
     packed = helpers.get_packed_data(html)
     
     try:
         sources = re.search("""sources:\s*\["(.+?)"\]""", packed).group(1).split('","')
         sources = [(urlparse(sources[i]).path.split('/')[-1], sources[i]) for i in range(len(sources))]
     except:
         sources = helpers.scrape_sources(html, patterns=["""sources:\s*\[["'](?P<url>[^"']+)"""])
     
     if sources:
         headers.update({'Referer': web_url})
         return helpers.pick_source(sources) + helpers.append_headers(headers)
     
     raise ResolverError('File not found')
Example #15
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'Origin': 'https://{}'.format(host),
            'Referer': 'https://{}/'.format(host),
            'User-Agent': common.RAND_UA
        }
        html = self.net.http_GET(web_url, headers=headers).content

        if '(p,a,c,k,e,d)' in html:
            html = helpers.get_packed_data(html)
        r = re.search(r'vsr[^=]+=\s*"([^"]+)', html)
        if r:
            headers = {'User-Agent': common.RAND_UA}
            return "https:" + r.group(1) + helpers.append_headers(headers)

        raise ResolverError("Video not found")
Example #16
0
def get_media_url(url):
    try:
        hostname = urlparse.urlparse(url).hostname
        headers = {'User-Agent': common.FF_USER_AGENT}
        html = net.http_GET(url, headers=headers).content
        headers.update({'Referer': url})
        for match in re.finditer('''<script[^>]*src=["']([^'"]+)''', html):
            _html = get_js(match.group(1), headers, hostname)

        match = re.search('''href=['"]([^'"]+)''', html)
        if match:
            playvid_url = match.group(1)
            html = net.http_GET(playvid_url, headers=headers).content
            headers.update({'Referer': playvid_url})
            for match in re.finditer('''<script[^>]*src=["']([^'"]+)''', html):
                js = get_js(match.group(1), headers, hostname)
                match = re.search(
                    '''!=\s*null.*?get\(['"]([^'"]+).*?\{([^:]+)''', js,
                    re.DOTALL)
                if match:
                    fx_url, fx_param = match.groups()
                    fx_url = resolve_url(
                        urlparse.urljoin('http://www.flashx.tv', fx_url) +
                        '?' + urllib.urlencode({fx_param: 1}))
                    common.logger.log('fxurl: %s' % (fx_url))
                    _html = net.http_GET(fx_url, headers=headers).content

            headers.update({'Referer': url})
            html = net.http_GET(playvid_url, headers=headers).content
            html += helpers.get_packed_data(html)

        logger.log(html)
        sources = helpers.parse_sources_list(html)
        try:
            sources.sort(key=lambda x: SORT_KEY.get(x[0], 0), reverse=True)
        except:
            pass
        source = helpers.pick_source(sources)
        return source + helpers.append_headers(headers)

    except Exception as e:
        logger.log_debug('Exception during flashx resolve parse: %s' % e)
        raise

    raise ResolverError('Unable to resolve flashx link. Filelink not found.')
Example #17
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        html = self.net.http_GET(web_url).content
        html = helpers.get_packed_data(html)
        url = re.findall('file\s*:\s*(?:\'|\")(.+?)(?:\'|\")', html)

        if not url: raise ResolverError('No video found')

        headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': web_url}

        url = urlparse.urljoin(web_url, url[-1])
        url = self.net.http_HEAD(url, headers=headers).get_url()

        url = url + helpers.append_headers(headers)
        return url

        raise ResolverError('No video found')
Example #18
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content
        data = helpers.get_hidden(html)
        common.kodi.sleep(5000)
        headers.update({'Referer': web_url})
        html = self.net.http_POST(web_url, headers=headers,
                                  form_data=data).content

        if html:
            packed = helpers.get_packed_data(html)
            sources = helpers.scrape_sources(
                packed,
                patterns=['''file:\s*["'](?P<url>(?!rtmp://)[^"']+)'''])
            data = re.findall("""_[^=]+=\[([^\]]+)\];""", html, re.DOTALL)
            if sources and data:
                data = data[2].replace('\\x', '').split(",")
                data = [
                    x.replace('"', '').replace(' ', '').decode("hex")
                    for x in data
                ]
                key = "".join(data[7:9])
                if key.startswith("embed"):
                    key = key[6:] + key[:6]
                i = 0
                headers.update({'Referer': web_url})
                for source in sources:
                    try:
                        src = urlparse.urlparse(source[1])
                        l = list(src)
                        b = l[2].split("/")[1:]
                        b[0] = self.decrypt(b[0], key)
                        l[2] = "/".join(b)
                        sources[i] = (source[0], urlparse.urlunparse(l))
                        i += 1
                    except:
                        i += 1

                return helpers.pick_source(sources) + helpers.append_headers(
                    headers)

        raise ResolverError('File not found')
Example #19
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': web_url}
        html = self.net.http_GET(web_url, headers=headers).content
        html += helpers.get_packed_data(html)
        match = re.search('playlist\s*:\s*"([^"]+)', html)
        if match:
            xml = self.net.http_GET(match.group(1), headers=headers).content
            count = 1
            sources = []
            streams = set()
            for match in re.finditer('''file="([^'"]*mp4)''', xml):
                stream_url = match.group(1)
                if stream_url not in streams:
                    sources.append(('Source %s' % (count), stream_url))
                    streams.add(stream_url)
                    count += 1

        return helpers.pick_source(sources) + helpers.append_headers(headers)
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': web_url}
     html = self.net.http_GET(web_url, headers=headers).content
     html += helpers.get_packed_data(html)
     match = re.search('playlist\s*:\s*"([^"]+)', html)
     if match:
         xml = self.net.http_GET(match.group(1), headers=headers).content
         count = 1
         sources = []
         streams = set()
         for match in re.finditer('''file="([^'"]*mp4)''', xml):
             stream_url = match.group(1)
             if stream_url not in streams:
                 sources.append(('Source %s' % (count), stream_url))
                 streams.add(stream_url)
                 count += 1
         
     return helpers.pick_source(sources) + helpers.append_headers(headers)
Example #21
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'User-Agent': common.RAND_UA,
            'Referer': 'http://gamovideo.com/player61/jwplayer.flash.swf'
        }
        r = self.net.http_GET(web_url, headers=headers)
        cookie = ''
        for item in r.get_headers(as_dict=True)['Set-Cookie'].split('GMT,'):
            cookie += item.split('path')[0]
        headers.update({'Cookie': cookie + 'sugamun=1; invn=1; pfm=1'})

        html = self.net.http_GET(web_url, headers=headers).content
        html += helpers.get_packed_data(html)
        source = re.search(r'''file:\s*["'](?P<url>http[^"']+)["']''', html)
        headers.pop('Cookie')
        if source:
            return source.group(1) + helpers.append_headers(headers)

        raise ResolverError('Video not found')
Example #22
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        response = self.net.http_GET(web_url, headers=headers)
        html = response.content
        data = helpers.get_hidden(html)
        headers['Cookie'] = response.get_headers(as_dict=True).get('Set-Cookie', '')
        sleep_time = 10  # in seconds
        wait_ms = sleep_time * 1000
        common.kodi.notify(header=None, msg='XvidStage requires %s second wait' % sleep_time, duration=wait_ms)
        common.kodi.sleep(wait_ms)
        html = self.net.http_POST(web_url, headers=headers, form_data=data).content

        if html:
            packed = helpers.get_packed_data(html)

            sources = helpers.scrape_sources(packed, result_blacklist=['tmp'])
            if sources: return helpers.pick_source(sources) + helpers.append_headers(headers)

        raise ResolverError('Unable to locate video')
Example #23
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        response = self.net.http_GET(web_url, headers=headers)
        html = response.content
        data = helpers.get_hidden(html)
        headers['Cookie'] = response.get_headers(as_dict=True).get(
            'Set-Cookie', '')
        html = self.net.http_POST(web_url, headers=headers,
                                  form_data=data).content

        if html:
            packed = helpers.get_packed_data(html)

            sources = helpers.scrape_sources(packed, result_blacklist=['tmp'])
            if sources:
                return helpers.pick_source(sources) + helpers.append_headers(
                    headers)

        raise ResolverError('Unable to locate video')
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {'User-Agent': common.RAND_UA}
     _html = self.net.http_GET(web_url, headers=headers).content
     data = helpers.get_hidden(_html)
     headers.update({'Referer': web_url})
     common.kodi.sleep(3000)
     html = self.net.http_POST(web_url, headers=headers, form_data=data).content
     
     if html:
         packed = helpers.get_packed_data(html)
         _sources = re.search("""sources:\s*\[([^\]]+)""", packed)
         if _sources:
             sources = re.findall("""["']([^"'\s,]+)""", _sources.group(1))
             if sources:
                 from urlparse import urlparse
                 sources = [(urlparse(source).path.split('/')[-1], source) for source in sources]
                 return helpers.pick_source(sources) + helpers.append_headers(headers)
         
     raise ResolverError('File not found')
    def get_media_url(self, host, media_id):

        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content

        html += helpers.get_packed_data(html)
        sources = helpers.scrape_sources(html)

        if sources:

            sources = [('mp4', self.net.http_HEAD(sources[0][1]).get_url())]

            headers.update({'Referer': web_url})

            return helpers.pick_source(sources) + helpers.append_headers(
                headers)

        else:

            raise ResolverError("Video not found")
Example #26
0
def get_media_url(url):
    try:
        hostname = urlparse.urlparse(url).hostname
        headers = {'User-Agent': common.FF_USER_AGENT}
        html = net.http_GET(url, headers=headers).content
        headers.update({'Referer': url})
        for match in re.finditer('''<script[^>]*src=["']([^'"]+)''', html):
            _html = get_js(match.group(1), headers, hostname)
                
        match = re.search('''href=['"]([^'"]+)''', html)
        if match:
            playvid_url = match.group(1)
            html = net.http_GET(playvid_url, headers=headers).content
            headers.update({'Referer': playvid_url})
            for match in re.finditer('''<script[^>]*src=["']([^'"]+)''', html):
                js = get_js(match.group(1), headers, hostname)
                match = re.search('''!=\s*null.*?get\(['"]([^'"]+).*?\{([^:]+)''', js, re.DOTALL)
                if match:
                    fx_url, fx_param = match.groups()
                    fx_url = resolve_url(urlparse.urljoin('http://www.flashx.tv', fx_url) + '?' + urllib.urlencode({fx_param: 1}))
                    common.logger.log('fxurl: %s' % (fx_url))
                    _html = net.http_GET(fx_url, headers=headers).content
                    
            headers.update({'Referer': url})
            html = net.http_GET(playvid_url, headers=headers).content
            html += helpers.get_packed_data(html)
        
        logger.log(html)
        sources = helpers.parse_sources_list(html)
        try: sources.sort(key=lambda x: SORT_KEY.get(x[0], 0), reverse=True)
        except: pass
        source = helpers.pick_source(sources)
        return source + helpers.append_headers(headers)
        
    except Exception as e:
        logger.log_debug('Exception during flashx resolve parse: %s' % e)
        raise
    
    raise ResolverError('Unable to resolve flashx link. Filelink not found.')
Example #27
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        _html = self.net.http_GET(web_url, headers=headers).content
        data = helpers.get_hidden(_html)
        headers.update({'Referer': web_url})
        common.kodi.sleep(3000)
        html = self.net.http_POST(web_url, headers=headers,
                                  form_data=data).content

        if html:
            packed = helpers.get_packed_data(html)
            _sources = re.search("""sources:\s*\[([^\]]+)""", packed)
            if _sources:
                sources = re.findall("""["']([^"'\s,]+)""", _sources.group(1))
                if sources:
                    from urlparse import urlparse
                    sources = [(urlparse(source).path.split('/')[-1], source)
                               for source in sources]
                    return helpers.pick_source(
                        sources) + helpers.append_headers(headers)

        raise ResolverError('File not found')
Example #28
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content

        tries = 0
        while tries < MAX_TRIES:
            data = helpers.get_hidden(html)
            data.update(captcha_lib.do_captcha(html))

            html = self.net.http_POST(web_url, form_data=data).content
            html += helpers.get_packed_data(html)
            match = re.search('name="src"\s*value="([^"]+)', html)
            if match:
                return match.group(1)

            # try to find source in html
            match = re.search('<span[^>]*>\s*<a\s+href="([^"]+)', html, re.DOTALL)
            if match:
                return match.group(1)

            tries += 1

        raise ResolverError('Unable to resolve kingfiles link. Filelink not found.')
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {'User-Agent': common.RAND_UA}
     html = self.net.http_GET(web_url, headers=headers).content
     data = helpers.get_hidden(html)
     common.kodi.sleep(5000)
     headers.update({'Referer': web_url})
     html = self.net.http_POST(web_url, headers=headers, form_data=data).content
     
     if html:
         packed = helpers.get_packed_data(html)
         sources = helpers.scrape_sources(packed, patterns=['''file:\s*["'](?P<url>(?!rtmp://)[^"']+)'''])
         data = re.findall("""_[^=]+=\[([^\]]+)\];""", html, re.DOTALL)
         if sources and data:
             data = data[2].replace('\\x', '').split(",")
             data = [x.replace('"', '').replace(' ', '').decode("hex") for x in data]
             key = "".join(data[7:9])
             if key.startswith("embed"):
                 key = key[6:]+key[:6]
             i = 0
             headers.update({'Referer': web_url})
             for source in sources:
                 try:
                     src = urlparse.urlparse(source[1])
                     l = list(src)
                     b = l[2].split("/")[1:]
                     b[0] = self.decrypt(b[0], key)
                     l[2] = "/".join(b)
                     sources[i] = (source[0], urlparse.urlunparse(l))
                     i += 1
                 except:
                     i += 1
                 
             return helpers.pick_source(sources) + helpers.append_headers(headers)
     
     raise ResolverError('File not found')
Example #30
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        html = self.net.http_GET(web_url, headers=headers).content

        if html:
            source = re.search(
                '''srces\.push\({type:"video/mp4",src:\s*((\w+)\(.+?\))''',
                html)
            if source:
                packed = helpers.get_packed_data(html)
                packed = re.sub('eval\s*\(.*\)', '', packed)
                js = packed + ";" + source.group(1) + ";"
                # I dont like this but we'll see how it goes
                _source = js2py.eval_js(
                    js.replace("window.%s" % source.group(2), source.group(2)))

                if _source:
                    _source = "http:%s" % _source if _source.startswith(
                        "//") else _source
                    headers.update({'Referer': web_url})
                    return _source + helpers.append_headers(headers)

        raise ResolverError("Unable to locate video")