def get_media_url(self, host, media_id):
        if '$$' in media_id:
            media_id, referer = media_id.split('$$')
            referer = urllib_parse.urljoin(referer, '/')
        else:
            # Needs to be hard coded for now if nothing is passed in.
            referer = 'https://streamrapid.ru/'
        web_url = self.get_url(host, media_id)
        rurl = urllib_parse.urljoin(web_url, '/')
        headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': referer}
        html = self.net.http_GET(web_url, headers).content
        domain = base64.b64encode(
            (rurl[:-1] + ':443').encode('utf-8')).decode('utf-8').replace(
                '=', '.')
        token = helpers.girc(html, rurl, domain)
        number = re.findall(r"recaptchaNumber\s*=\s*'(\d+)", html)
        if token and number:
            eid, media_id = media_id.split('/')
            surl = '{}/ajax/embed-{}/getSources'.format(rurl[:-1], eid)
            if '?' in media_id:
                media_id = media_id.split('?')[0]
            data = {'_number': number[0], 'id': media_id, '_token': token}
            headers.update({'X-Requested-With': 'XMLHttpRequest'})
            shtml = self.net.http_GET('{0}?{1}'.format(
                surl, urllib_parse.urlencode(data)),
                                      headers=headers).content
            sources = json.loads(shtml).get('sources')
            if sources:
                source = sources[0].get('file')
                headers.pop('X-Requested-With')
                return source + helpers.append_headers(headers)

        raise ResolverError('File Not Found or removed')
Esempio n. 2
0
    def get_media_url(self, host, media_id):
        if '$$' in media_id:
            media_id, referer = media_id.split('$$')
            referer = urllib_parse.urljoin(referer, '/')
        else:
            referer = False
        web_url = self.get_url(host, media_id)
        rurl = urllib_parse.urljoin(web_url, '/')
        if not referer:
            referer = rurl
        domain = 'aHR0cHM6Ly9zdHJlYW1yYXBpZC5ydTo0NDM.'
        headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': referer}
        html = self.net.http_GET(web_url, headers).content
        token = helpers.girc(html, rurl, domain)
        number = re.findall(r"recaptchaNumber\s*=\s*'(\d+)", html)
        if token and number:
            eid, media_id = media_id.split('/')
            surl = 'https://streamrapid.ru/ajax/embed-{0}/getSources'.format(
                eid)
            if '?' in media_id:
                media_id = media_id.split('?')[0]
            data = {'_number': number[0], 'id': media_id, '_token': token}
            headers.update({'X-Requested-With': 'XMLHttpRequest'})
            shtml = self.net.http_GET('{0}?{1}'.format(
                surl, urllib_parse.urlencode(data)),
                                      headers=headers).content
            sources = json.loads(shtml).get('sources')
            if sources:
                source = sources[0].get('file')
                headers.pop('X-Requested-With')
                return source + helpers.append_headers(headers)

        raise ResolverError('File Not Found or removed')
    def get_media_url(self, host, media_id):
        surl = 'https://abcvideo.cc/dl'
        domain = 'aHR0cHM6Ly9hYmN2aWRlby5jYzo0NDM.'
        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).content
        token = helpers.girc(html, rurl, domain)
        if token:
            data = {
                'op': 'video_src',
                'file_code': media_id,
                'g-recaptcha-response': token
            }
            headers.update({'X-Requested-With': 'XMLHttpRequest'})
            shtml = self.net.http_GET('{0}?{1}'.format(
                surl, urllib_parse.urlencode(data)),
                                      headers=headers).content
            sources = helpers.scrape_sources(shtml)
            if sources:
                headers.pop('X-Requested-With')
                return helpers.pick_source(sources) + helpers.append_headers(
                    headers)

        raise ResolverError('File Not Found or removed')
Esempio n. 4
0
    def get_media_url(self, host, media_id):
        surl = 'https://evoload.io/SecurePlayer'
        domain = 'aHR0cHM6Ly9ldm9sb2FkLmlvOjQ0Mw..'
        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).content
        token = helpers.girc(html, rurl, domain)
        if token:
            edata = {'code': media_id, 'token': token}
            headers.update({'Origin': rurl[:-1], 'X-XSRF-TOKEN': ''})
            shtml = self.net.http_POST(surl,
                                       form_data=edata,
                                       headers=headers,
                                       jdata=True).content
            r = re.search('"src":"([^"]+)', shtml)
            if r:
                headers.pop('X-XSRF-TOKEN')
                return r.group(1) + 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 = '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')