Ejemplo n.º 1
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        logger.log_debug('HugeFiles: get_link: %s' % (web_url))
        html = self.net.http_GET(web_url).content

        r = re.findall('File Not Found', html)
        if r:
            raise ResolverError('File Not Found or removed')

        # Grab data values
        data = helpers.get_hidden(html)
        data.update(captcha_lib.do_captcha(html))
        logger.log_debug('HugeFiles - Requesting POST URL: %s with data: %s' %
                         (web_url, data))
        html = self.net.http_POST(web_url, data).content

        # Re-grab data values
        data = helpers.get_hidden(html)
        data['referer'] = web_url
        headers = {'User-Agent': common.EDGE_USER_AGENT}
        logger.log_debug('HugeFiles - Requesting POST URL: %s with data: %s' %
                         (web_url, data))
        request = urllib_request.Request(web_url,
                                         data=urllib_parse.urlencode(data),
                                         headers=headers)

        try:
            stream_url = urllib_request.urlopen(request).geturl()
        except:
            return

        logger.log_debug('Hugefiles stream Found: %s' % stream_url)
        return stream_url
Ejemplo n.º 2
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        rurl = 'https://{0}/'.format(host)
        headers = {'User-Agent': common.FF_USER_AGENT,
                   'Referer': rurl}
        html = self.net.http_GET(web_url, headers=headers).content
        r = re.search("href='([^']+).+?GET LINK", html)
        if r:
            g = self.net.http_GET(r.group(1), headers=headers)
            html = g.content
            gp = urllib_parse.urlparse(g.get_url())
            data = helpers.get_hidden(html)
            headers.update({
                'Origin': '{0}://{1}'.format(gp.scheme, gp.netloc),
                'Referer': g.get_url(),
                'X-Requested-With': 'XMLHttpRequest'
            })
            purl = re.findall('<form.+?action="([^"]+)', html)[0]
            if purl.startswith('/'):
                purl = '{0}://{1}{2}'.format(gp.scheme, gp.netloc, purl)
            common.kodi.sleep(5000)
            html = self.net.http_POST(purl, form_data=data, headers=headers).content
            jd = json.loads(html)
            if jd.get('status') == "success":
                headers.pop('X-Requested-With')
                return jd.get('url') + helpers.append_headers(headers)

        raise ResolverError('File Not Found or removed')
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        rurl = urllib_parse.urljoin(web_url, '/')
        headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': rurl}
        html = self.net.http_GET(web_url, headers=headers).content
        r = re.search(r"btn--primary'\s*href='([^']+)", html)
        if r:
            common.kodi.sleep(7000)
            g = self.net.http_GET(r.group(1), headers=headers)
            ghtml = g.content
            gurl = g.get_url()
            data = helpers.get_hidden(ghtml)
            headers.update({
                'Origin': urllib_parse.urljoin(gurl, '/')[:-1],
                'Referer': gurl,
                'X-Requested-With': 'XMLHttpRequest'
            })
            purl = re.findall('<form.+?action="([^"]+)', ghtml)[0]
            if purl.startswith('/'):
                purl = urllib_parse.urljoin(gurl, purl)
            common.kodi.sleep(5000)
            html = self.net.http_POST(purl, form_data=data,
                                      headers=headers).content
            jd = json.loads(html)
            if jd.get('status') == "success":
                headers.pop('X-Requested-With')
                return jd.get('url') + helpers.append_headers(headers)

        raise ResolverError('File Not Found or removed')
Ejemplo n.º 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,
                   'Origin': 'https://www.{0}'.format(host),
                   'Referer': web_url}
        html = self.net.http_GET(web_url, headers=headers).content
        data = helpers.get_hidden(html)
        data.update({"method_free": "Download Gratuito >>"})
        html = self.net.http_POST(web_url, form_data=data, headers=headers).content
        tries = 0
        while tries < MAX_TRIES:
            data = helpers.get_hidden(html)
            data.update({"method_free": "Download Gratuito >>"})
            data.update(captcha_lib.do_captcha(html))
            common.kodi.sleep(15000)
            html = self.net.http_POST(web_url, form_data=data, headers=headers).content
            r = re.search(r'''id="direct_link".+?href="([^"]+)''', html, re.DOTALL)
            if r:
                # headers.update({'verifypeer': 'false'})
                return r.group(1).replace(' ', '%20') + helpers.append_headers(headers)
            tries += 1

        raise ResolverError('Unable to locate link')
    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
        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, data, headers=headers).content
            r = re.search(r'''class="downloadbtn"[^>]+onClick\s*=\s*\"window\.open\('([^']+)''', html)
            if r:
                return r.group(1) + helpers.append_headers(headers)

            common.kodi.sleep(1000)
            tries = tries + 1

        raise ResolverError('Unable to locate link')
Ejemplo n.º 6
0
def do_solvemedia_captcha(captcha_url):
    common.logger.log_debug('SolveMedia Captcha: %s' % captcha_url)
    if captcha_url.startswith('//'):
        captcha_url = 'http:' + captcha_url
    html = net.http_GET(captcha_url).content
    data = {
        'adcopy_challenge':
        ''  # set to blank just in case not found; avoids exception on return
    }
    data.update(helpers.get_hidden(html), include_submit=False)
    captcha_img = os.path.join(common.profile_path, IMG_FILE)
    try:
        os.remove(captcha_img)
    except:
        pass

    # Check for alternate puzzle type - stored in a div
    alt_frame = re.search('<div><iframe src="(/papi/media[^"]+)', html)
    if alt_frame:
        html = net.http_GET("http://api.solvemedia.com%s" %
                            alt_frame.group(1)).content
        alt_puzzle = re.search(
            r'<div\s+id="typein">\s*<img\s+src="data:image/png;base64,([^"]+)',
            html, re.DOTALL)
        if alt_puzzle:
            open(captcha_img, 'wb').write(alt_puzzle.group(1).decode('base64'))
    else:
        open(captcha_img, 'wb').write(
            net.http_GET("http://api.solvemedia.com%s" % re.search(
                '<img src="(/papi/media[^"]+)"', html).group(1)).content)

    solution = get_response(captcha_img)
    data['adcopy_response'] = solution
    html = net.http_POST('http://api.solvemedia.com/papi/verify.noscript',
                         data)
    return {
        'adcopy_challenge': data['adcopy_challenge'],
        'adcopy_response': 'manual_challenge'
    }
Ejemplo n.º 7
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        rurl = 'https://{0}/'.format(host)
        headers = {'User-Agent': common.RAND_UA, 'Referer': rurl}
        html = self.net.http_GET(web_url, headers=headers).content
        sources = re.findall(r'download_video([^"]+)[^\d]+\d+x(\d+)', html)
        if sources:
            sources.sort(key=lambda x: int(x[1]), reverse=True)
            sources = [(x[1] + 'p', x[0]) for x in sources]
            code, mode, hash = eval(helpers.pick_source(sources))
            dl_url = 'https://{0}/dl?op=download_orig&id={1}&mode={2}&hash={3}'.format(
                host, code, mode, hash)
            html = self.net.http_GET(dl_url, headers=headers).content
            domain = base64.b64encode(
                (rurl[:-1] + ':443').encode('utf-8')).decode('utf-8').replace(
                    '=', '')
            token = helpers.girc(html, rurl, domain)
            if token:
                payload = helpers.get_hidden(html)
                payload.update({'g-recaptcha-response': token})
                req = self.net.http_POST(dl_url,
                                         form_data=payload,
                                         headers=headers).content
                r = re.search('href="([^"]+)">Direct', req)
                if r:
                    return r.group(1) + helpers.append_headers(headers)
        else:
            eurl = self.get_embedurl(host, media_id)
            headers.update({'watchsb': 'streamsb'})
            html = self.net.http_GET(eurl, headers=headers).content
            data = json.loads(html).get("stream_data", {})
            strurl = data.get('file') or data.get('backup')
            if strurl:
                headers.pop('watchsb')
                return strurl + helpers.append_headers(headers)

        raise ResolverError('Video not found')