示例#1
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')
示例#2
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,
            'Referer': 'https://vidembed.cc/'
        }

        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.cc' + '/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.cc'})
            return helpers.pick_source(sources) + helpers.append_headers(
                headers)

        raise ResolverError('Video not found')
示例#4
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')
    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')
示例#6
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')
示例#7
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")
示例#8
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
     r = re.search(r'base64,([^"]+)', html)
     if r:
         html = base64.b64decode(r.group(1)).decode('utf-8')
         sources = helpers.scrape_sources(html)
         if sources:
             return helpers.pick_source(helpers.sort_sources_list(
                 sources)) + helpers.append_headers(headers)
     raise ResolverError('Video Link Not Found')
示例#9
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 = 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)))
                return stream_url + helpers.append_headers(headers)

        raise ResolverError('File not found')
示例#10
0
    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')
示例#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')
示例#12
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')
示例#13
0
    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')
示例#14
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')
    def get_media_url(self, host, media_id):
        embeds = ['http://bestarticles.me/', 'http://tellygossips.net/']
        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')

        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.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))
            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')
示例#16
0
    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.')
示例#17
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')
示例#18
0
    def get_media_url(self, host, media_id):
        url = self.get_url(host, media_id)
        result = json.loads(self.net.http_GET(url, headers=self.headers).content)
        if result.get('message') == 'Success':
            js_data = result.get('data')
            if 'streamLinks' in js_data.keys():
                js_result = result
            else:
                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.get('data').get('token'):
                    self.set_setting('token', js_result.get('data').get('token'))
                    self.set_setting('premium', 'true')
            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.')
示例#19
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
        json_data = json.loads(html).get('video_balancer', {})
        if json_data:
            url = json_data.get('m3u8', None)
            if url:
                headers.update({'Origin': 'http://rutube.ru'})
                mbtext = self.net.http_GET(url, headers=headers).content
                sources = re.findall(
                    'RESOLUTION=(?P<label>[^x]+).+\n(?P<url>[^?]+)', mbtext,
                    re.IGNORECASE)
                return helpers.pick_source(helpers.sort_sources_list(
                    sources)) + helpers.append_headers(headers)

            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)

        raise ResolverError('No playable video 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')