Beispiel #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
        fvars = re.search(r"flashvars(?!')[^{]+([^;]+)", html)
        if fvars:
            sources = json.loads(fvars.group(1)).get('mediaDefinitions', [])
            sources = [
                (item.get("quality"), item.get("videoUrl")) for item in sources
                if item.get('format') != "hls" and item.get("videoUrl") != ""
            ]
            if sources:
                return helpers.pick_source(helpers.sort_sources_list(
                    sources)) + helpers.append_headers(headers)

        vars = re.findall(r'var\s+(.+?)\s*=\s*(.+?);', html)
        links = re.findall(r'quality_(\d+)p\s*=\s*(.+?);', html)
        if links:
            sources = []
            for source in links:
                link = [i.strip() for i in source[1].split('+')]
                link = [i for i in link if i.startswith('*/')]
                link = [re.sub(r'^\*/', '', i) for i in link]
                link = [(i, [x[1] for x in vars if x[0] == i]) for i in link]
                link = [i[1][0] if i[1] else i[0] for i in link]
                link = ''.join(link)
                link = re.sub(r'\s|\+|\'|\"', '', link)
                sources.append([source[0], link])
            if sources:
                return helpers.pick_source(helpers.sort_sources_list(
                    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
        eurl = self.get_url2(host, media_id)
        headers.update({
            'Referer': web_url,
            'Origin': urllib_parse.urljoin(web_url, '/')[:-1],
            'X-Requested-With': 'XMLHttpRequest'
        })
        html = self.net.http_POST(eurl,
                                  form_data="hash={0}".format(media_id),
                                  headers=headers).content
        vurl = json.loads(html).get('videoSource')
        if vurl:
            headers.pop('Origin')
            headers.pop('X-Requested-With')
            headers.update({'Accept': '*/*'})
            ehtml = self.net.http_GET(vurl, headers=headers).content
            sources = re.findall(r'Resolution=\d+x(\d+).+\n([^\n]+)', ehtml,
                                 re.IGNORECASE)
            if sources:
                cookies = self.net.get_cookies(True)
                headers.update({
                    'Cookie':
                    'fireplayer={0}'.format(cookies.get('fireplayer'))
                })
                return helpers.pick_source(helpers.sort_sources_list(
                    sources)) + helpers.append_headers(headers)

        raise ResolverError('File not found')
Beispiel #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

        if 'Not Found' in html:
            raise ResolverError('File Removed')

        if 'Video is processing' in html:
            raise ResolverError('File still being processed')

        packed = re.search(r"JuicyCodes\.Run\((.+?)\)", html, re.I)
        if packed:
            from base64 import b64decode
            packed = packed.group(1).replace('"', '').replace('+', '')
            packed = b64decode(packed.encode('ascii'))
            html += '%s</script>' % packed.decode('latin-1').strip()

        source = helpers.scrape_sources(html)
        if source:
            headers.update({'Referer': web_url, 'Accept': '*/*'})
            vsrv = re.findall(r'//(\d+)/', source[0][1])[0]
            source = re.sub(r"//\d+/", "//{0}/".format(host),
                            source[0][1]) + '?s={0}&d='.format(vsrv)
            html = self.net.http_GET(source, headers=headers).content
            sources = re.findall(r'RESOLUTION=\d+x(\d+)\n([^\n]+)', html)
            return helpers.pick_source(helpers.sort_sources_list(
                sources)) + helpers.append_headers(headers)

        raise ResolverError('Video not found')
Beispiel #4
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA,
                   'Referer': web_url,
                   'Origin': 'https://{0}'.format(host),
                   'X-Requested-With': 'XMLHttpRequest'}
        data = {'id': media_id}
        api_url = 'https://{0}/api/video/get'.format(host)
        html = self.net.http_POST(api_url, data, headers=headers, jdata=True).content
        r = json.loads(html).get('result').get('playlist')
        if r:
            if '{' in r:
                data = json.loads(r)
                ct = data.get('ct', False)
                salt = codecs.decode(data.get('s'), 'hex')
                murl = json.loads(jscrypto.decode(ct, '2021', salt))
            else:
                murl = r
            headers.pop('X-Requested-With')
            html = self.net.http_GET(murl, headers=headers).content
            sources = re.findall(r'RESOLUTION=\d+x(?P<label>[\d]+).*\n(?!#)(?P<url>[^\n]+)', html, re.IGNORECASE)
            if sources:
                stream_url = urllib_parse.urljoin(murl, helpers.pick_source(helpers.sort_sources_list(sources)))
                return stream_url + 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.FF_USER_AGENT}
        html = self.net.http_GET(web_url, headers=headers).content
        headers.update({'Referer': web_url})

        match = re.search(r'Video is processing now\.', html)
        if match:
            raise ResolverError('Video is still processing. Try later')

        match = re.search(r'&hash=([^&]+)', html)
        if match:
            web_url = 'https://wolfstream.tv/dl?op=download_orig&id={0}&mode=o&hash={1}'.format(
                media_id, match.group(1))
            html2 = self.net.http_GET(web_url, headers=headers).content
            r = re.search(r'<a\s*href="([^"]+)[^>]+>Direct', html2)
            if r:
                return r.group(1) + helpers.append_headers(headers)

        match = re.search(r'(?:src|file):\s*"([^"]+)', html)
        if match:
            html2 = self.net.http_GET(match.group(1), headers=headers).content
            sources = re.findall(
                r'RESOLUTION=\d+x(?P<label>[\d]+).+\n(?!#)(?P<url>[^\n]+)',
                html2, re.IGNORECASE)
            if sources:
                return helpers.pick_source(helpers.sort_sources_list(
                    sources)) + helpers.append_headers(headers)

        raise ResolverError('Video Link Not Found')
Beispiel #6
0
    def get_media_url(self, host, media_id):
        headers = {'User-Agent': common.FF_USER_AGENT}
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url, headers=headers).content
        html = json.loads(html)
        url = ''
        json_data = html.get('video_balancer')
        if json_data:
            url = json_data.get('m3u8')
            if not url:
                json_url = json_data.get('json')
                html = self.net.http_GET(json_url, headers=headers).content
                js_data = json.loads(html)
                if js_data.get('results', False):
                    return js_data.get('results')[0] + helpers.append_headers(
                        headers)

        if not url:
            json_data = html.get('live_streams')
            if json_data:
                url = json_data.get('hls')[0].get('url')

        if url:
            headers.update({'Origin': 'http://rutube.ru'})
            mbtext = self.net.http_GET(url, headers=headers).content
            sources = re.findall(
                r'RESOLUTION=\d+x(?P<label>\d+).*\n(?P<url>[^?\n]+)', mbtext,
                re.IGNORECASE)
            return helpers.pick_source(helpers.sort_sources_list(
                sources)) + helpers.append_headers(headers)

        raise ResolverError('No playable video found.')
Beispiel #7
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': 'https://vidembed.io/'
        }

        key = '25746538592938496764662879833288'.encode('utf8')
        iv = self.f_random(16)
        encryptor = pyaes.Encrypter(
            pyaes.AESModeOfOperationCBC(key, iv.encode('utf8')))
        eid = encryptor.feed(media_id)
        eid += encryptor.feed()
        url = 'https://vidembed.io' + '/encrypt-ajax.php?id=' + base64.b64encode(eid).decode('utf8') \
            + '&refer=none&time=' + self.f_random(2) + iv + self.f_random(2)
        headers.update({'X-Requested-With': 'XMLHttpRequest'})
        js_data = json.loads(self.net.http_GET(url, headers=headers).content)
        sources = js_data.get('source', None)
        if sources:
            sources = [(source.get('label'), source.get('file'))
                       for source in sources]
            headers.pop('X-Requested-With')
            source = helpers.pick_source(helpers.sort_sources_list(sources))
            return source + helpers.append_headers(headers)

        # Try Beta Server if no sources found with earlier method
        headers.pop('X-Requested-With')
        html = self.net.http_GET(web_url, headers=headers).content
        sources = helpers.scrape_sources(html)
        if sources:
            headers.update({'Origin': 'https://vidembed.io'})
            return helpers.pick_source(sources) + helpers.append_headers(
                headers)

        raise ResolverError('Video not found')
Beispiel #8
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.RAND_UA}
        r = self.net.http_GET(web_url, headers=headers)
        if r.get_url() != web_url:
            host = re.findall(r'(?://|\.)([^/]+)', r.get_url())[0]
            web_url = self.get_url(host, media_id)
        headers.update({'Referer': web_url})
        api_url = 'https://{0}/api/source/{1}'.format(host, media_id)
        r = self.net.http_POST(api_url, form_data={'r': '', 'd': host}, headers=headers)
        if r.get_url() != api_url:
            api_url = 'https://www.{0}/api/source/{1}'.format(host, media_id)
            r = self.net.http_POST(api_url, form_data={'r': '', 'd': host}, headers=headers)
        js_result = r.content

        if js_result:
            js_data = json.loads(js_result)
            if js_data.get('success'):
                sources = [(i.get('label'), i.get('file')) for i in js_data.get('data') if i.get('type') == 'mp4']
                common.logger.log(sources)
                sources = helpers.sort_sources_list(sources)
                rurl = helpers.pick_source(sources)
                str_url = self.net.http_HEAD(rurl, headers=headers).get_url()
                return str_url + helpers.append_headers(headers)

        raise ResolverError('Video not found')
Beispiel #9
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
     sources = helpers.scrape_sources(html)
     if sources:
         return helpers.pick_source(helpers.sort_sources_list(sources)) + helpers.append_headers(headers)
     raise ResolverError('Video not found')
    def get_media_url(self, host, media_id, cached_only=False):
        try:
            if media_id.lower().startswith('magnet:'):
                r = re.search('''magnet:.+?urn:([a-zA-Z0-9]+):([a-zA-Z0-9]+)''', media_id, re.I)
                if r:
                    _hash = r.group(2)
                    if self.__check_cache(_hash):
                        logger.log_debug('AllDebrid: BTIH {0} is readily available to stream'.format(_hash))
                        transfer_id = self.__create_transfer(_hash)
                    else:
                        if self.get_setting('cached_only') == 'true' or cached_only:
                            raise ResolverError('AllDebrid: Cached torrents only allowed to be initiated')
                        else:
                            transfer_id = self.__create_transfer(_hash)
                            self.__initiate_transfer(transfer_id)

                    transfer_info = self.__list_transfer(transfer_id)
                    sources = [(link.get('size'), link.get('link'))
                               for link in transfer_info.get('links')
                               if any(link.get('filename').lower().endswith(x) for x in FORMATS)]
                    media_id = max(sources)[1]
                    self.__delete_transfer(transfer_id)

            url = '{0}/link/unlock?agent={1}&apikey={2}&link={3}'.format(api_url, urllib_parse.quote_plus(AGENT), self.get_setting('token'), urllib_parse.quote_plus(media_id))
            result = self.net.http_GET(url, headers=self.headers).content
        except urllib_error.HTTPError as e:
            try:
                js_result = json.loads(e.read())
                if 'error' in js_result:
                    msg = '{0} ({1})'.format(js_result.get('error'), js_result.get('errorCode'))
                else:
                    msg = 'Unknown Error (1)'
            except:
                msg = 'Unknown Error (2)'
            raise ResolverError('AllDebrid Error: {0} ({1})'.format(msg, e.code))
        else:
            js_result = json.loads(result)
            logger.log_debug('AllDebrid resolve: [{0}]'.format(js_result))
            if 'error' in js_result:
                e = js_result.get('error')
                raise ResolverError('AllDebrid Error: {0} ({1})'.format(e.get('message'), e.get('code')))
            elif js_result.get('status', False) == "success":
                if js_result.get('data').get('link'):
                    return js_result.get('data').get('link')
                elif js_result.get('data').get('host') == "stream":
                    sources = js_result.get('data').get('streams')
                    fid = js_result.get('data').get('id')
                    sources = [(str(source.get("quality")), source.get("id")) for source in sources if '+' not in source.get("id")]
                    sid = helpers.pick_source(helpers.sort_sources_list(sources))
                    url = '{0}/link/streaming?agent={1}&apikey={2}&id={3}&stream={4}' \
                          .format(api_url, urllib_parse.quote_plus(AGENT), self.get_setting('token'), fid, sid)
                    result = self.net.http_GET(url, headers=self.headers).content
                    js_data = json.loads(result)
                    if js_data.get('data').get('link'):
                        return js_data.get('data').get('link')

        raise ResolverError('AllDebrid: no stream returned')
Beispiel #11
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': 'https://{0}/'.format(host),
                'X-Requested-With': 'XMLHttpRequest'}
     js_data = json.loads(self.net.http_GET(web_url, headers=headers).content)
     sources = js_data.get('source', None)
     if sources:
         sources = [(source.get('label'), source.get('file')) for source in sources]
         headers.pop('X-Requested-With')
         return helpers.pick_source(helpers.sort_sources_list(sources)) + helpers.append_headers(headers)
     raise ResolverError('Video not found')
    def get_media_url(self, host, media_id):
        embeds = [
            'http://bestarticles.me/', 'http://tellygossips.net/',
            'http://tvarticles.org/'
        ]
        web_url = self.get_url(host, media_id)
        headers = {
            'User-Agent': common.FF_USER_AGENT,
            'Referer': random.choice(embeds)
        }

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

        if 'Not Found' in html:
            raise ResolverError('File Removed')

        if 'Video is processing' in html:
            raise ResolverError('File still being processed')

        html += helpers.get_packed_data(html)
        packed = re.search(r"JuicyCodes\.Run\((.+?)\)", html, re.I)
        if packed:
            from base64 import b64decode
            packed = packed.group(1).replace('"', '').replace('+', '')
            packed = b64decode(packed.encode('ascii'))
            html += '%s</script>' % packed.decode('latin-1').strip()

        source = helpers.scrape_sources(
            html,
            patterns=[r'''"file":\s*"(?P<url>[^"]+\.(?:m3u8|mp4|txt))"'''])
        if source:
            headers.update({'Referer': web_url, 'Accept': '*/*'})
            vsrv = re.search(r'//(\d+)/', source[0][1])
            if vsrv:
                source = re.sub(r"//\d+/", "//{0}/".format(host),
                                source[0][1]) + '?s={0}&d='.format(
                                    vsrv.group(1))
                disk = re.findall(r'videoDisk":\s*"([^"]+)', html)
                if disk:
                    disk = base64.b64encode(
                        disk[0].encode('utf-8')).decode('utf-8')
                    source += disk
            else:
                source = source[0][1]
            html = self.net.http_GET(source, headers=headers).content
            sources = re.findall(r'RESOLUTION=\d+x(\d+)\n([^\n]+)', html)
            src = helpers.pick_source(helpers.sort_sources_list(sources))
            if not src.startswith('http'):
                src = re.sub(source.split('/')[-1], src, source)
            return src + helpers.append_headers(headers)

        raise ResolverError('Video not found')
Beispiel #13
0
    def get_media_url(self, host, media_id):
        try:
            result = self.__check_auth(media_id)
            if not result:
                result = self.__auth_ip(media_id)
        except ResolverError:
            raise

        if result:
            return helpers.pick_source(
                helpers.sort_sources_list(result)) + helpers.append_headers(
                    self.headers)

        raise ResolverError("Unable to retrieve video")
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'Referer': web_url, 'User-Agent': common.RAND_UA}

        html = self.net.http_GET(web_url, headers=headers).content
        sources = re.findall('data-quality.+?href="(?P<url>[^"]+).+?>(?P<label>[^<]+)', html)
        if sources:
            sources = [(source[1], source[0]) for source in sources]
            html = self.net.http_GET(helpers.pick_source(helpers.sort_sources_list(sources)), headers=headers).content
            match = re.search(r"player_data='([^']+)", html)
            if match:
                js_data = json.loads(match.group(1))
                return self.cda_decode(js_data.get('video').get('file')) + helpers.append_headers(headers)

        raise ResolverError('Video Link Not Found')
Beispiel #15
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': 'https://{0}/player?v={1}'.format(host, media_id),
                   'X-Requested-With': 'XMLHttpRequest'}
        html = self.net.http_GET(web_url, headers=headers).content
        sources = re.findall(r'video_source\s*name="(?P<label>[^"]+)[^>]+>(?P<url>[^<]+)', html)

        if sources:
            source = helpers.pick_source(helpers.sort_sources_list(sources))
            source = 'https:' + source if source.startswith('//') else source
            headers.pop('X-Requested-With')
            headers.update({'Origin': 'https://{}'.format(host)})
            return source.replace('&amp;', '&') + helpers.append_headers(headers)

        raise ResolverError('Stream not found')
Beispiel #16
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

        r = re.search(r'v-bind:stream="([^"]+)', html)
        if r:
            data = json.loads(r.group(1).replace('&quot;', '"'))
            murl = self.decode(data.get('host')) + data.get('hash') + '/index.m3u8'
            html = self.net.http_GET(murl, headers=headers).content
            sources = re.findall(r'RESOLUTION=\d+x(?P<label>[\d]+).*\n(?!#)(?P<url>[^\n]+)', html, re.IGNORECASE)
            if sources:
                stream_url = urllib_parse.urljoin(murl, helpers.pick_source(helpers.sort_sources_list(sources)))
                headers.update({'Referer': web_url, 'Origin': 'https://{0}'.format(host)})
                return stream_url + helpers.append_headers(headers)

        raise ResolverError('File not found')
    def get_media_url(self, host, media_id):
        url = self.get_url(host, media_id)
        js_data = json.loads(self.net.http_GET(url, headers=self.headers).content)
        if js_data.get('message') == 'Success':
            js_data = js_data.get('data')
            heading = i18n('uptobox_auth_header')
            line1 = i18n('auth_required')
            line2 = i18n('upto_link').format(js_data.get('base_url'))
            line3 = i18n('upto_pair').format(js_data.get('pin'))
            with common.kodi.CountdownDialog(heading, line1, line2, line3, True, js_data.get('expired_in'), 10) as cd:
                js_result = cd.start(self.__check_auth, [js_data.get('check_url')])
            if js_result:
                js_result = js_result.get('data').get('streamLinks')
                sources = [(key, list(js_result.get(key).values())[0]) for key in list(js_result.keys())]
                return helpers.pick_source(helpers.sort_sources_list(sources)) + helpers.append_headers(self.headers)

        raise ResolverError('The requested video was not found or may have been removed.')
Beispiel #18
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'User-Agent': common.RAND_UA,
            'Referer': 'https://www.{0}/'.format(host)
        }
        html = self.net.http_GET(web_url, headers=headers).content
        sources = []

        qvars = re.search(r'qualityItems_[^\[]+([^;]+)', html)
        if qvars:
            sources = json.loads(qvars.group(1))
            sources = [(src.get('text'), src.get('url')) for src in sources
                       if src.get('url')]

        if not sources:
            fvars = re.search(r'flashvars_\d+\s*=\s*(.+?);\s', html)
            if fvars:
                sources = json.loads(fvars.group(1)).get('mediaDefinitions')
                sources = [(src.get('quality'), src.get('videoUrl'))
                           for src in sources
                           if type(src.get('quality')) is not list
                           and src.get('videoUrl')]

        if not sources:
            sections = re.findall(r'(var\sra[a-z0-9]+=.+?);flash', html)
            for section in sections:
                pvars = re.findall(r'var\s(ra[a-z0-9]+)=([^;]+)', section)
                link = re.findall(r'var\smedia_\d+=([^;]+)', section)[0]
                link = re.sub(r"/\*.+?\*/", '', link)
                for key, value in pvars:
                    link = re.sub(key, value, link)
                link = link.replace('"', '').split('+')
                link = [i.strip() for i in link]
                link = ''.join(link)
                if 'urlset' not in link:
                    r = re.findall(r'(\d+p)', link, re.I)
                    if r:
                        sources.append((r[0], link))

        if sources:
            headers.update({'Origin': 'https://www.{0}'.format(host)})
            return helpers.pick_source(helpers.sort_sources_list(
                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 = {'Referer': web_url, 'User-Agent': common.RAND_UA}

        html = self.net.http_GET(web_url, headers=headers).content
        match = re.search(r"player_data='([^']+)", html)
        if match:
            qdata = json.loads(match.group(1)).get('video',
                                                   {}).get('qualities')
            sources = [(q, '?wersja={0}'.format(q)) for q in qdata.keys()]
            if len(sources) > 1:
                html = self.net.http_GET(
                    web_url +
                    helpers.pick_source(helpers.sort_sources_list(sources)),
                    headers=headers).content
                match = re.search(r"player_data='([^']+)", html)
            src = json.loads(match.group(1)).get('video').get('file')
            return self.cda_decode(src) + helpers.append_headers(headers)

        raise ResolverError('Video Link Not Found')
Beispiel #20
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
        alt_url = re.search(r"video_alt_url:\s*'([^']+)", html)
        if alt_url:
            alt_url = alt_url.group(1)
            if alt_url.startswith('http'):
                html = self.net.http_GET(alt_url, headers=headers).content

        sources = re.findall(
            r"video(?:_alt)?_url:\s*'(?P<url>[^']+).+?text:\s*'(?P<label>[^']+)",
            html)
        if sources:
            sources = [(label, url) for url, label in sources]
            url = helpers.pick_source(helpers.sort_sources_list(sources))
            if url.startswith('function/'):
                lcode = re.findall(r"license_code:\s*'([^']+)", html)[0]
                url = helpers.fun_decode(url, lcode)
            return url + helpers.append_headers(headers)

        raise ResolverError('File not found')
Beispiel #21
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': 'https://{0}/videos/{1}'.format(host, media_id),
            'X-Requested-With': 'XMLHttpRequest'
        }
        js_data = json.loads(
            self.net.http_GET(web_url, headers=headers).content)

        if js_data.get('video').get('sources'):
            sources = []
            for item in js_data.get('video').get('sources'):
                sources.append((item.get('label'), item.get('file')))
            source = helpers.pick_source(helpers.sort_sources_list(sources))
            headers.pop('X-Requested-With')
            headers.update({"Range": "bytes=0-"})
            de = js_data.get('de')
            en = js_data.get('en')
            return '{0}?de={1}&en={2}{3}'.format(
                source, de, en, helpers.append_headers(headers))

        raise ResolverError('Stream not found')
Beispiel #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}
        html = self.net.http_GET(web_url, headers=headers).content
        headers.update({'Referer': web_url})

        match = re.search(r"playlistUrl='([^']+)", html)
        if match:
            web_url = 'https://{0}{1}'.format(host, match.group(1))
            html2 = self.net.http_GET(web_url, headers=headers).content
            r = json.loads(html2)[0].get('sources', None)
            if r:
                html = self.net.http_GET(r[0].get('file'),
                                         headers=headers).content
                sources = re.findall(
                    r'RESOLUTION=\d+x(?P<label>[\d]+).*\n(?!#)(?P<url>[^\n]+)',
                    html, re.IGNORECASE)
                if sources:
                    return helpers.pick_source(
                        helpers.sort_sources_list(
                            sources)) + helpers.append_headers(headers)

        raise ResolverError('Video Link Not Found')
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'User-Agent': common.RAND_UA,
            'Origin': 'https://www.dailymotion.com',
            'Referer': 'https://www.dailymotion.com/'
        }
        js_result = json.loads(
            self.net.http_GET(web_url, headers=headers).content)

        if js_result.get('error'):
            raise ResolverError(js_result.get('error').get('title'))

        quals = js_result.get('qualities')
        if quals:
            mbtext = self.net.http_GET(quals.get('auto')[0].get('url'),
                                       headers=headers).content
            sources = re.findall(
                'NAME="(?P<label>[^"]+)",PROGRESSIVE-URI="(?P<url>[^#]+)',
                mbtext)
            return helpers.pick_source(helpers.sort_sources_list(
                sources)) + helpers.append_headers(headers)
        raise ResolverError('No playable video found.')