Exemplo n.º 1
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'Referer': web_url, 'User-Agent': common.CHROME_USER_AGENT}
        html = self.net.http_GET(web_url, headers=headers).content
        sources = helpers.parse_sources_list(html)
        if sources:
            try:
                token = re.search('''var thief\s*=\s*["']([^"']+)''', html)
                if token:
                    vt_url = 'http://vidup.tv/jwv/%s' % token.group(1)
                    vt_html = self.net.http_GET(vt_url,
                                                headers=headers).content
                    vt = re.search('''\|([-\w]{50,})''', vt_html)
                    if vt:
                        sources = helpers.sort_sources_list(sources)
                        params = {
                            'direct': 'false',
                            'ua': 1,
                            'vt': vt.group(1)
                        }
                        return helpers.pick_source(
                            sources) + '?' + urllib.urlencode(
                                params) + helpers.append_headers(headers)
                    else:
                        raise ResolverError('Video VT Missing')
                else:
                    raise ResolverError('Video Token Missing')
            except urllib2.HTTPError:
                raise ResolverError('Unable to read page data')

        raise ResolverError('Unable to locate video')
Exemplo n.º 2
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        
        try:
            html = self.net.http_GET(web_url, headers=headers).content
        except  urllib2.HTTPError as e:
            if e.code == 404:
                raise ResolverError("Video not found")

        srcs = re.findall(r'href="(%s&q=[^"]+)' % web_url, html, re.I)
        if srcs:
            sources = []
            for src in srcs:
                shtml = self.net.http_GET(src, headers=headers).content
                strurl = helpers.parse_html5_source_list(shtml)
                if strurl:
                    sources.append(strurl[0])
            sources = helpers.sort_sources_list(sources)
        else:
            sources = helpers.parse_html5_source_list(html)
        
        if len(sources) > 0:
            return helpers.pick_source(sources) + helpers.append_headers(headers)
        else:
            raise ResolverError("Video not found")
Exemplo n.º 3
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')
Exemplo n.º 4
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}
        api_url = 'https://%s/api/source/%s' % (host, media_id)
        js_result = self.net.http_POST(api_url,
                                       form_data={
                                           'r': ''
                                       },
                                       headers=headers).content

        if js_result:
            try:
                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)
                    return helpers.pick_source(
                        sources) + helpers.append_headers(headers)
                else:
                    raise Exception(js_data.get('data'))
            except Exception as e:
                raise ResolverError('Error getting video: %s' % e)

        raise ResolverError('Video not found')
Exemplo n.º 5
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        r = self.net.http_GET(web_url, headers=self.desktopHeaders)

        sources = helpers.scrape_sources(
            r.content,
            generic_patterns=False,
            patterns=[
                '''file:.*?['"](?P<url>.*?)['"](?:.*?label.*?['"](?P<label>.*?)['"])?'''
            ])
        if sources:

            # Headers for requesting media (copied from Firefox).
            parsedUrl = urlparse(r.get_url())
            kodiHeaders = {
                'User-Agent':
                self.userAgent,
                'Accept':
                'video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5',
                'Referer':
                '%s://%s/' % (parsedUrl.scheme, parsedUrl.netloc),
                'Cookie':
                '; '.join(cookie.name + '=' + cookie.value
                          for cookie in self.net._cj)
            }

            sources = helpers.sort_sources_list(sources)
            return helpers.pick_source(sources) + helpers.append_headers(
                kodiHeaders)

        raise ResolverError('Unable to locate video')
Exemplo n.º 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}
        
        try:
            html = self.net.http_GET(web_url, headers=headers).content
        except  urllib2.HTTPError as e:
            if e.code == 404:
                raise ResolverError("Video not found")

        srcs = re.findall(r'href="(%s&q=[^"]+)' % web_url, html, re.I)
        if srcs:
            sources = []
            for src in srcs:
                shtml = self.net.http_GET(src, headers=headers).content
                strurl = helpers.parse_html5_source_list(shtml)
                if strurl:
                    sources.append(strurl[0])
        else:
            sources = helpers.parse_html5_source_list(html)
        
        if len(sources) > 0:
            sources = helpers.sort_sources_list(sources)
            return helpers.pick_source(sources) + helpers.append_headers(headers)
        else:
            raise ResolverError("Video not found")
Exemplo n.º 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}
     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')
Exemplo n.º 8
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.mehlizmovieshd.com/'}
     html = self.net.http_GET(web_url, headers=headers).content
     
     if html:
         sources = helpers.parse_sources_list(html)
         if sources:
             sources = helpers.sort_sources_list(sources)
             return helpers.pick_source(sources) + helpers.append_headers(headers)
         
     raise ResolverError('Video not found')
Exemplo n.º 9
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.mehlizmovieshd.com/'}
     html = self.net.http_GET(web_url, headers=headers).content
     
     if html:
         sources = helpers.parse_sources_list(html)
         if sources:
             sources = helpers.sort_sources_list(sources)
             return helpers.pick_source(sources) + helpers.append_headers(headers)
         
     raise ResolverError('Video not found')
Exemplo n.º 10
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.get_dom(html, 'video_sources')
        if sources:
            sources = re.findall('name\s*=\s*[\'|"]([^\'"]+).+?streamable.+?>([^<]+)', sources[0])
            source = helpers.pick_source(helpers.sort_sources_list(sources))
            if source.startswith('//'): source = 'http:' + source
            return source.replace('&amp;', '&')

        raise ResolverError('Stream not found')
Exemplo n.º 11
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')
Exemplo n.º 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,
                   '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')
Exemplo n.º 13
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):
        web_url = self.get_url(host, media_id)
        js_result = json.loads(
            self.net.http_GET(web_url, headers=self.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=self.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(
                    self.headers)
        raise ResolverError('No playable video found.')
Exemplo n.º 15
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}
     api_url = 'https://www.%s/api/source/%s' % (host, media_id)
     js_result = self.net.http_POST(api_url, form_data={'r': ''}, headers=headers).content
     
     if js_result:
         try:
             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)
                 return helpers.pick_source(sources) + helpers.append_headers(headers)
             else:
                 raise Exception(js_data.get('data'))
         except Exception as e:
             raise ResolverError('Error getting video: %s' % e)
             
     raise ResolverError('Video not found')
Exemplo n.º 16
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')
            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')
Exemplo n.º 17
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'Referer': web_url, 'User-Agent': common.CHROME_USER_AGENT}
        html = self.net.http_GET(web_url, headers=headers).content
        sources = helpers.parse_sources_list(html)
        if sources:
            try:
                token = re.search('''var thief\s*=\s*["']([^"']+)''', html)
                if token:
                    vt_url = 'http://vidup.tv/jwv/%s' % token.group(1)
                    vt_html = self.net.http_GET(vt_url, headers=headers).content
                    vt = re.search('''\|([-\w]{50,})''', vt_html)
                    if vt:
                        sources = helpers.sort_sources_list(sources)
                        params = {'direct': 'false', 'ua': 1, 'vt': vt.group(1)}
                        return helpers.pick_source(sources) + '?' + urllib.urlencode(params) + helpers.append_headers(headers)
                    else:
                        raise ResolverError('Video VT Missing')
                else:
                    raise ResolverError('Video Token Missing')
            except urllib2.HTTPError:
                raise ResolverError('Unable to read page data')

        raise ResolverError('Unable to locate video')
Exemplo n.º 18
0
    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, js_result.get(key).values()[0])
                           for key in 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.')
Exemplo n.º 19
0
    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, quote_plus(AGENT), self.get_setting('token'),
                quote_plus(media_id))
            result = self.net.http_GET(url, headers=self.headers).content
        except 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, 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')