Exemplo n.º 1
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://www1.putlockertv.se/'
        }
        html = self.net.http_GET(web_url, headers=headers).content

        if html:
            sources = helpers.scrape_sources(html)
            if sources:
                headers.update({'Referer': web_url})
                return helpers.pick_source(sources) + helpers.append_headers(
                    headers)

        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,
                   '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.º 3
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}
        html = self.net.http_GET(web_url, headers=headers).content

        r = re.search(r'JuicyCodes\.Run\("([^)]+)"\)', html)

        if r:
            jc = r.group(1).replace('"+"', '')
            jc = base64.b64decode(jc.encode('ascii'))
            jc = jsunpack.unpack(jc.decode('ascii'))
            sources = helpers.scrape_sources(jc)
            return helpers.pick_source(sources) + helpers.append_headers(
                headers)

        raise ResolverError('Video cannot be located.')
Exemplo n.º 4
0
    def get_media_url(self, host, media_id):
        headers = {
            'User-Agent': common.EDGE_USER_AGENT
        }

        query = urlparse.parse_qs(media_id)

        try: oid, video_id = query['oid'][0], query['id'][0]
        except: oid, video_id = re.findall('(.*)_(.*)', media_id)[0]

        sources = self.__get_sources(oid, video_id)
        sources.sort(key=lambda x: int(x[0]), reverse=True)

        source = helpers.pick_source(sources)
        return source + helpers.append_headers(headers)
        raise ResolverError('No video 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

        if html:
            _srcs = re.search(r'sources\s*:\s*\[(.+?)\]', html)
            if _srcs:
                srcs = helpers.scrape_sources(
                    _srcs.group(1), patterns=['''["'](?P<url>http[^"']+)'''])
                if srcs:
                    headers.update({'Referer': web_url})
                    return helpers.pick_source(srcs) + helpers.append_headers(
                        headers)

        raise ResolverError('Unable to locate link')
Exemplo n.º 6
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'Origin': 'https://mixdrop.co',
            'Referer': 'https://mixdrop.co/e/' + media_id,
            'User-Agent': common.RAND_UA
        }
        html = self.net.http_GET(web_url, headers=headers).content

        try:
            r = re.search('\s+?(eval\(function\(p,a,c,k,e,d\).+)\s+?', html)
            r = jsunpack.unpack(r.group(1))
            r = re.search('vsrc?="([^"]+)', r.replace('\\', ''))
            return "https:" + r.group(1)
        except:
            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.get_dom(html, 'video_sources')
        if sources:
            sources = re.findall(
                'name\s*=\s*[\'|"]([^\'"]+).+?streamable.+?>([^<]+)',
                sources[0])
            if sources[-1][0].lower() == 'lq': sources = sources[::-1]
            source = helpers.pick_source(sources)
            if source.startswith('//'): source = 'http:' + source
            return source

        raise ResolverError('Stream not found')
Exemplo n.º 8
0
    def get_media_url(self, host, media_id):
        url = self.get_url(host, media_id)
        cmn.debug('Icdrama: ' + url)

        if 'vidembed' in url or 'vb.icdrama' in url:
            headers = self.headers
            headers['Referer'] = 'http://adrama.to'

            response = requests.get(url, headers=headers)

            unwrapped_url = ''

            streams = self._extract_streams(response)
            cmn.debug("Icdrama: Extracted links... " + str(streams))

            unwrapped_url = ''
            if xbmcaddon.Addon().getSetting('auto_select_source') == 'true':
                unwrapped_url = sourceutil.pick_source(streams)
            else:
                unwrapped_url = helpers.pick_source(streams, False)

            if ('redirector.googlevideo.com' in unwrapped_url
                    or 'blogspot.com' in unwrapped_url
                    or 'googleusercontent.com' in unwrapped_url or 'fbcdn.net'
                    in unwrapped_url):  # for current Videobug source
                # Kodi can play directly, skip further resolve
                return unwrapped_url

            return resolveurl.resolve(unwrapped_url)
        else:
            try:
                html = self.net.http_GET(url, headers=self.headers).content

                iframe = BeautifulSoup(html,
                                       'html5lib').find(id='iframeplayer')
                if iframe:
                    iframe_url = urljoin(self.get_url(host, ''), iframe['src'])
                    return resolveurl.resolve(iframe_url)
                else:
                    cmn.popup(loc.getLocalizedString(33305))
                    return ''

            except Exception as e:
                if 'No link selected' in str(e):
                    return ''
                raise ResolverError('Icdrama resolver: ' + str(e) + ' : ' +
                                    self.get_url(host, media_id))
Exemplo n.º 9
0
    def get_media_url(self, host, media_id):
        if '|' in media_id:
            media_id, referer = media_id.split('|')
            r = urllib_parse.urlparse(referer)
            referer = '{0}://{1}/'.format(r.scheme, r.netloc)
        else:
            referer = False
        web_url = self.get_url(host, media_id)
        if not referer:
            referer = 'https://{0}/'.format(host)
        headers = {'User-Agent': common.FF_USER_AGENT,
                   'Referer': referer}
        html = self.net.http_GET(web_url, headers=headers).content
        params = re.search(r'video:\s*([^;]+)', html)
        if params:
            params = params.group(1)
            server = re.findall(r'server:\s*"([^"]+)', params)[0][::-1]
            server = base64.b64decode(server.encode('ascii')).decode('ascii')
            ids = re.search(r'cdn_id:\s*"([^"]+)', params)
            if ids:
                id1, id2 = ids.group(1).split('_')
                sources = json.loads(re.findall(r'cdn_files:\s*([^}]+})', params)[0])
                sources = [(key[4:], 'https://{0}/videos/{1}/{2}/{3}'.format(server, id1, id2, sources[key].replace('.', '.mp4?extra=')))
                           for key in list(sources.keys())]
            else:
                vid = re.findall(r'id:\s*"([^"]+)', params)[0]
                ekeys = json.loads(re.findall(r'quality":\s*([^}]+})', params)[0])
                data = {
                    'token': re.findall(r'access_token:\s*"([^"]+)', params)[0],
                    'videos': vid,
                    'ckey': re.findall(r'c_key:\s*"([^"]+)', params)[0],
                    'credentials': re.findall(r'credentials:\s*"([^"]+)', params)[0]
                }
                vurl = 'https://{0}/method/video.get/{1}?{2}'.format(server, vid, urllib_parse.urlencode(data))
                headers.update({'Origin': referer[:-1]})
                vhtml = self.net.http_GET(vurl, headers=headers).content
                sources = json.loads(vhtml).get('response').get('items')[0].get('files')
                sources = [(key[4:], sources[key] + '&videos={0}&extra_key={1}&videos={0}'.format(vid, ekeys[key[4:]]))
                           for key in list(sources.keys())]

            source = helpers.pick_source(sorted(sources, reverse=True))
            if 'extra_key' in source:
                source = source.replace('https://', 'https://{0}/'.format(server))

            return source + helpers.append_headers(headers)

        raise ResolverError('No playable video 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.RAND_UA, 'Referer': web_url}
        html = self.net.http_GET(web_url, headers=headers).content
        r = re.findall(r'JuicyCodes.Run\(([^\)]+)', html, re.IGNORECASE)

        if r:
            Juice = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
            e = re.sub(r'\"\s*\+\s*\"', '', r[-1])
            e = re.sub(r'[^A-Za-z0-9+\\/=]', '', e)

            t = ""
            n = r = i = s = o = u = a = f = 0

            while f < len(e):
                try:
                    s = Juice.index(e[f])
                    f += 1
                    o = Juice.index(e[f])
                    f += 1
                    u = Juice.index(e[f])
                    f += 1
                    a = Juice.index(e[f])
                    f += 1
                    n = s << 2 | o >> 4
                    r = (15 & o) << 4 | u >> 2
                    i = (3 & u) << 6 | a
                    t += chr(n)
                    if 64 != u: t += chr(r)
                    if 64 != a: t += chr(i)
                except:
                    continue
                pass

            try:
                t = jsunpack.unpack(t)
                t = unicode(t, 'utf-8')
            except:
                t = None

            sources = helpers.scrape_sources(t)

            headers.update({'Range': 'bytes=0-'})
            return helpers.pick_source(sources) + helpers.append_headers(
                headers)

        raise ResolverError('Video cannot be located.')
Exemplo n.º 11
0
    def get_media_url(self, host, media_id):
        html = self.net.http_GET(
            "http://www.veoh.com/iphone/views/watch.php?id=" + media_id +
            "&__async=true&__source=waBrowse").content
        if not re.search('This video is not available on mobile', html):
            r = re.compile("watchNow\('(.+?)'").findall(html)
            if (len(r) > 0):
                return r[0]

        url = 'http://www.veoh.com/rest/video/' + media_id + '/details'
        html = self.net.http_GET(url).content
        file_id = re.compile('fullPreviewHashPath="(.+?)"').findall(html)

        if len(file_id) == 0:
            raise ResolverError('File Not Found or removed')

        return file_id[0]
Exemplo n.º 12
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
     params = "".join([x.replace("' + '", "") for x in self.between(html, "params += '", "';")])
     vkey = params.split('=')[-1]
     m = hashlib.md5()
     m.update((vkey + 'PT6l13umqV8K827').encode('utf-8'))
     params += '&pkey={0}'.format(m.hexdigest())
     params = urllib_parse.unquote(params)
     url = 'https://www.{0}/player_config/?{1}'.format(host, params)
     sources_html = self.net.http_GET(url, headers=headers).content
     if sources_html:
         sources = helpers.scrape_sources(sources_html, patterns=[r"""video_file>\<\!\[CDATA\[(?P<url>[^\]]+)"""])
         if sources:
             return helpers.pick_source(sources) + helpers.append_headers(headers)
     raise ResolverError('File 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.RAND_UA, 'Referer': web_url}
        html = self.net.http_GET(web_url, headers=headers).content
        r = re.search("script'>(eval.*?)</script", html, re.DOTALL)

        if r:
            html = jsunpack.unpack(r.group(1))
            sources = helpers.scrape_sources(
                html,
                patterns=[r'''file:\s*"(?P<url>[^"]+)'''],
                generic_patterns=False)
            if sources:
                return helpers.pick_source(sources) + helpers.append_headers(
                    headers)

        raise ResolverError('Video cannot be located.')
Exemplo n.º 14
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
        match = re.search(
            r'''vvplay[^']+'([^']+).+\n\s*function\s*makePlay.+?return[^?]+([^"]+)''',
            html)
        if match:
            token = match.group(2)
            url = 'https://dood.watch' + match.group(1)
            headers.update({'Referer': web_url})
            html = self.net.http_GET(url, headers=headers).content
            return self.dood_decode(html) + token + str(int(
                time.time() * 1000)) + helpers.append_headers(headers)

        raise ResolverError('Video Link Not Found')
Exemplo n.º 15
0
    def get_media_url(self, host, media_id):
        if not media_id.isdigit():
            web_url = self.get_url(host, media_id)
            headers = {'User-Agent': common.RAND_UA}
            html = self.net.http_GET(web_url, headers=headers).content
            video_ids = re.findall(r"""<iframe.+?src=["'].*?\?v=(\d+)["'&]""",
                                   html, re.I)
            if video_ids:
                video_id = video_ids[-1]
                return helpers.get_media_url(
                    'http://www.porn00.org/video/?v=%s' % video_id).replace(
                        ' ', '%20')

            raise ResolverError('File not found')
        else:
            return helpers.get_media_url(self.get_url(host, media_id)).replace(
                ' ', '%20')
Exemplo n.º 16
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}
        html = self.net.http_GET(web_url, headers=headers).content
        r = re.search(r"[>;]var\s*hxstring\s*=\s*'([^']+)", html)
        if r:
            b = "\x6b\x36\x73\x79\x7a\x6a\x61\x6a\x34\x6a\x7a\x61\x37\x32\x66\x31\x31\x33\x33\x30\x68\x6c\x76\x6e\x66\x6c\x6e\x62\x33\x68\x37\x79\x74\x68\x7a\x7a\x71\x66\x39\x6d\x37\x30\x6c\x79\x39\x7a\x7a\x76\x63\x33"
            html = base64.b64decode(r.group(1).encode('ascii'))
            html = self.hx_decrypt(b, html.decode('latin-1'))

        sources = helpers.scrape_sources(html)

        if sources:
            return helpers.pick_source(sources) + helpers.append_headers(
                headers)

        raise ResolverError('Video cannot be located.')
Exemplo n.º 17
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        html = self.net.http_GET(web_url).content
        headers = {'User-Agent': common.RAND_UA, 'Referer': web_url}

        tries = 0
        while tries < MAX_TRIES:
            data = helpers.get_hidden(html, index=0)
            data.update(captcha_lib.do_captcha(html))

            html = self.net.http_POST(web_url, headers=headers, form_data=data).content
            match = re.search('href="([^"]+)[^>]*>Click here to download<', html, re.DOTALL | re.I)
            if match:
                return match.group(1) + helpers.append_headers(headers)
            tries += 1

        raise ResolverError('Unable to resolve uploadz.co link. Filelink not found.')
Exemplo n.º 18
0
    def get_media_url(self, host, media_id):

        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.CHROME_USER_AGENT}
        html = self.net.http_GET(web_url, headers=headers).content

        if '<b>File not found, sorry!</b>' not in html:
            html += helpers.get_packed_data(html)
            sources = helpers.scrape_sources(html)

            if sources:
                headers.update({'Referer': web_url})
                vurl = helpers.pick_source(sources)
                vurl = re.sub('get[0-9a-zA-Z]{4,5}-', 'getlink-', vurl)
                return helpers.get_redirect_url(vurl, headers) + helpers.append_headers(headers)

        raise ResolverError('Video not found or removed')
Exemplo n.º 19
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')
Exemplo n.º 20
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        r = self.net.http_GET(web_url, headers=headers)
        cookie = ''
        for item in r.get_headers(as_dict=True)['Set-Cookie'].split('GMT,'):
            cookie += item.split('path')[0]
        headers.update({'Cookie': cookie + 'sugamun=1; invn=1; pfm=1'})

        html = self.net.http_GET(web_url, headers=headers).content
        html += helpers.get_packed_data(html)
        source = re.search(r'''file:\s*["'](?P<url>http[^"']+)["']''', html)
        headers.pop('Cookie')
        if source:
            return source.group(1) + helpers.append_headers(headers)

        raise ResolverError('Video not found')
Exemplo n.º 21
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')
Exemplo n.º 22
0
    def get_media_url(self, host, media_id):
        if '|' in media_id:
            media_id, referer = media_id.split('|')
        else:
            referer = None
        web_url = self.get_url(host, media_id)
        referer = web_url if referer is None else referer
        headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': referer}
        response = self.net.http_GET(web_url, headers=headers).content
        srcs = helpers.scrape_sources(
            response, patterns=[r'''file:\s*"(?P<url>[^"]+)'''])
        if srcs:
            headers.update({'Referer': web_url})
            return helpers.pick_source(sorted(
                srcs, reverse=True)) + helpers.append_headers(headers)

        raise ResolverError('No playable video found.')
Exemplo n.º 23
0
    def _filter_m3u8(_json):

        for media in _json['MediaFiles']:

            if media['RoleName'] == 'main':

                if len(media['Formats']) == 1:

                    return media['Formats'][0]['Url']

                else:

                    for result in media['Formats']:
                        if '.m3u8' in result['Url']:
                            return result['Url']

        raise ResolverError('Failed to resolve video content')
Exemplo n.º 24
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'Origin': 'https://{}'.format(host),
            'Referer': 'https://{}/'.format(host),
            'User-Agent': common.RAND_UA
        }
        html = self.net.http_GET(web_url, headers=headers).content

        if '(p,a,c,k,e,d)' in html:
            html = helpers.get_packed_data(html)
        r = re.search(r'vsr[^=]+=\s*"([^"]+)', html)
        if r:
            headers = {'User-Agent': common.RAND_UA}
            return "https:" + r.group(1) + helpers.append_headers(headers)

        raise ResolverError("Video not found")
Exemplo n.º 25
0
 def __check_auth(self, media_id):
     common.logger.log('Checking Auth: %s' % (media_id))
     url = 'https://thevideo.website/pair?file_code=%s&check' % (media_id)
     try: js_result = json.loads(self.net.http_GET(url, headers=self.headers).content)
     except ValueError:
         raise ResolverError('Unusable Authorization Response')
     except urllib2.HTTPError as e:
         if e.code == 401:
             js_result = json.loads(str(e.read()))
         else:
             raise
         
     common.logger.log('Auth Result: %s' % (js_result))
     if js_result.get('status'):
         return js_result.get('response', {})
     else:
         return {}
Exemplo n.º 26
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'<link\s*href="([^"]+)', html)
        if alt_url:
            headers.update({'Referer': web_url})
            html = self.net.http_GET(alt_url.group(1), headers=headers).content
            url = re.findall(r"video_url:\s*'([^']+)", html)
            if url:
                url = url[0]
                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')
Exemplo n.º 27
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
        match = re.search(r'''<video-player.+?scws_id[^\d]+(\d+)''', html,
                          re.DOTALL)
        if match:
            scws_id = match.group(1)
            headers.update({'Referer': 'https://streamingcommunity.fun/'})
            html = self.net.http_GET('https://scws.xyz/videos/' + scws_id,
                                     headers=headers).content
            a = json.loads(html).get('client_ip')
            url = 'https://scws.xyz/master/{0}?{1}'.format(
                scws_id, self.get_token(a))
            return url + helpers.append_headers(headers)

        raise ResolverError('Video Link Not Found')
Exemplo n.º 28
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {
            'Referer':
            web_url,
            'User-Agent':
            'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'
        }

        player_headers = {
            'Cookie':
            'PHPSESSID=1',
            'Referer':
            web_url,
            'User-Agent':
            'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'
        }
        player_headers.update(headers)

        html = self.net.http_GET(web_url, headers=headers).content
        try:
            html = html.encode('utf-8')
        except:
            pass
        match = re.findall('data-quality="(.*?)" href="(.*?)".*?>(.*?)</a>',
                           html, re.DOTALL)
        if match:
            mylinks = sorted(match, key=lambda x: x[2])
            html = self.net.http_GET(mylinks[-1][1], headers=headers).content

        from HTMLParser import HTMLParser
        match = re.search('''['"]file['"]:\s*['"](.+?)['"]''',
                          HTMLParser().unescape(html))
        if match:
            mylink = match.group(1).replace("\\", "")
            return self.__check_vid(mylink) + helpers.append_headers(
                player_headers)

        html = jsunpack.unpack(
            re.search("eval(.*?)\{\}\)\)", html, re.DOTALL).group(1))
        match = re.search('src="(.*?\.mp4)"', html)
        if match:
            return self.__check_vid(
                match.group(1)) + helpers.append_headers(player_headers)

        raise ResolverError('Video Link Not Found')
Exemplo n.º 29
0
    def authorize_resolver(self):
        url = 'https://uptobox.com/api/streaming'
        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')])

            # cancelled
            if js_result is None:
                return
            return self.__get_token(js_result)
        raise ResolverError('Error during authorisation.')
Exemplo n.º 30
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': web_url}
        response = self.net.http_GET(web_url, headers=headers)
        html = response.content
        sources = []
        for r in re.finditer(r'''href=["']?(?P<url>[^"']+)["']?>DOWNLOAD\s*<span>(?P<label>[^<]+)''', html, re.DOTALL):
            match = r.groupdict()
            stream_url = match['url'].replace('&amp;', '&')
            label = match.get('label', '0')
            sources.append([label, stream_url])
        if len(sources) > 1:
            sources.sort(key=lambda x: int(re.sub(r"\D", "", x[0])), reverse=True)
            return helpers.pick_source(sources) + helpers.append_headers(headers)

        raise ResolverError('File not found')