예제 #1
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 = {}
            for match in re.finditer('input type="hidden" name="([^"]+)" value="([^"]+)', html):
                key, value = match.groups()
                data[key] = value
            data['method_free'] = 'Free Download'
            data.update(captcha_lib.do_captcha(html))
            
            html = self.net.http_POST(web_url, form_data=data).content
            # try to find source in packed data
            if jsunpack.detect(html):
                js_data = jsunpack.unpack(html)
                match = re.search('name="src"\s*value="([^"]+)', js_data)
                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 UrlResolver.ResolverError('Unable to resolve kingfiles link. Filelink not found.')
예제 #2
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'User-Agent': common.IOS_USER_AGENT,
            'Referer': web_url
        }

        html = self.net.http_GET(web_url, headers=headers).content
        if jsunpack.detect(html):
            js_data = jsunpack.unpack(html)
            match = re.search('"src"\s*,\s*"([^"]+)', js_data)

        try:
            stream_url = match.group(1)

            r = urllib2.Request(stream_url, headers=headers)
            r = int(urllib2.urlopen(r, timeout=15).headers['Content-Length'])

            if r > 1048576:
                stream_url += '|' + urllib.urlencode(headers)
                return stream_url
        except:
            ResolverError("File Not Playable")

        raise ResolverError('No playable video found.')
예제 #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')
예제 #4
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["method_free"] = "Free Download"
            data.update(captcha_lib.do_captcha(html))

            html = self.net.http_POST(web_url, form_data=data).content
            # try to find source in packed data
            if jsunpack.detect(html):
                js_data = jsunpack.unpack(html)
                match = re.search('name="src"\s*value="([^"]+)', js_data)
                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.")
예제 #5
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

        if jsunpack.detect(html):
            js_data = jsunpack.unpack(html)

            sources = []
            stream_url = ''
            for match in re.finditer(
                    'label:\s*"([^"]+)"\s*,\s*file:\s*"([^"]+)', js_data):
                label, stream_url = match.groups()
                sources.append((label, stream_url))

            if sources:
                sources = sorted(sources, key=lambda x: x[0])[::-1]
                source = helpers.pick_source(
                    sources,
                    self.get_setting('auto_pick') == 'true')

            if source:
                return source

        raise ResolverError("File Link Not Found")
예제 #6
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.IOS_USER_AGENT, 'Referer': web_url}

        html = self.net.http_GET(web_url, headers=headers).content
        if jsunpack.detect(html):
            js_data = jsunpack.unpack(html)
            match = re.search('"src"\s*,\s*"([^"]+)', js_data)
            if match:
                return match.group(
                    1) + '|User-Agent=%s' % (common.IOS_USER_AGENT)

        raise UrlResolver.ResolverError('No playable video found.')
예제 #7
0
파일: videomega.py 프로젝트: msports/mw
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'User-Agent': common.IOS_USER_AGENT,
            'Referer': web_url
        }
        
        html = self.net.http_GET(web_url, headers=headers).content
        if jsunpack.detect(html):
            js_data = jsunpack.unpack(html)
            match = re.search('"src"\s*,\s*"([^"]+)', js_data)
            if match:
                return match.group(1) + '|User-Agent=%s' % (common.IOS_USER_AGENT)

        raise UrlResolver.ResolverError('No playable video found.')
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        html = self.net.http_GET(web_url).content

        if jsunpack.detect(html):
            js_data = jsunpack.unpack(html)

            max_label = 0
            stream_url = ''
            for match in re.finditer('label:\s*"(\d+)p"\s*,\s*file:\s*"([^"]+)', js_data):
                label, link = match.groups()
                if int(label) > max_label:
                    stream_url = link
                    max_label = int(label)
            if stream_url:
                return stream_url
            else:
                raise UrlResolver.ResolverError("File Link Not Found")
예제 #9
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

        if jsunpack.detect(html):
            js_data = jsunpack.unpack(html)

            max_label = 0
            stream_url = ''
            for match in re.finditer('label:\s*"(\d+)p"\s*,\s*file:\s*"([^"]+)', js_data):
                label, link = match.groups()
                if int(label) > max_label:
                    stream_url = link
                    max_label = int(label)
            if stream_url:
                return stream_url
            else:
                raise ResolverError("File Link Not Found")