def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        response = self.net.http_GET(web_url, headers=headers)
        html = response.content
        if re.search('>(File Not Found)<', html):
            raise ResolverError('File Not Found or removed')

        data = helpers.get_hidden(html)
        headers.update({'Referer': web_url})
        common.kodi.sleep(10000)
        html = self.net.http_POST(response.get_url(), form_data=data, headers=headers).content
        sources = helpers.scrape_sources(html)
        return helpers.pick_source(sources) + helpers.append_headers(headers)
Ejemplo n.º 2
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)

        response = self.net.http_GET(web_url)
        html = response.content

        if html:
            try:
                js_data = json.loads(html)
                sources = [(video['key'], video['url'])
                           for video in js_data['videos']]
                sources = sources[::-1]
                source = helpers.pick_source(sources)
                source = source.encode('utf-8')
                return source + helpers.append_headers({
                    'Cookie':
                    response.get_headers(as_dict=True).get('Set-Cookie', '')
                })
            except:
                raise ResolverError('No playable video found.')

        else:
            raise ResolverError('No playable video found.')
Ejemplo n.º 3
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        resp = self.net.http_GET(web_url)
        html = resp.content
        headers = dict(self.net.get_cookies())
        encoded_headers = urllib.urlencode({'Cookie': headers['www.playhd.video']['/']['AVS'], 
                                            'Referer': 'http://www.playhd.video/embed.php'})
        r = re.search('"content_video".*\n.*?src="(.*?)"', html)
        if r:
            stream_url = r.group(1) + '|' + encoded_headers
        else:
            raise ResolverError('no file located')

        return stream_url
Ejemplo n.º 4
0
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {
         'Cookie': 'ref_url=http%3A%2F%2Fwww.movieswatch.com.pk%2F',
         'User-Agent': common.RAND_UA
     }
     html = self.net.http_GET(web_url, headers=headers).content
     if html:
         sources = helpers.scrape_sources(html)
         if sources:
             source = helpers.pick_source(sources)
             headers.pop('Cookie')
             return source + helpers.append_headers(headers)
     raise ResolverError('File not found')
    def get_media_url(self, host, media_id):
        common.log_utils.log('in get_media_url %s : %s' % (host, media_id))
        url = 'http://www.alldebrid.com/service.php?link=%s' % (media_id)
        html = self.net.http_GET(url).content
        if html == 'login':
            raise ResolverError('alldebrid: Authentication Error')

        try:
            js_data = json.loads(html)
            if 'error' in js_data and js_data['error']:
                raise ResolverError('alldebrid: %s' % (js_data['error']))

            if 'streaming' in js_data:
                return helpers.pick_source(js_data['streaming'].items())
        except ResolverError:
            raise
        except:
            match = re.search(
                '''<a\s+class=["']link_dl['"]\s+href=["']([^'"]+)''', html)
            if match:
                return match.group(1)

        raise ResolverError('alldebrid: no stream returned')
Ejemplo n.º 6
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("script'>(eval.*?)</script", html, re.DOTALL)
        
        if r:
            html = jsunpack.unpack(r.group(1))
            src = re.search(r'file:\s*"([^"]+mp4)',html)
            if src:
                return src.group(1) + helpers.append_headers(headers)

        raise ResolverError('File Not Found or removed')
Ejemplo 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

        html = helpers.get_packed_data(html)
        sources = re.search(r'sources:\s*(\[[^]]+])', html)
        if sources:
            sources = json.loads(sources.group(1))
            sources = [(x.get('label'), x.get('file')) for x in sources]
            source = helpers.pick_source(sorted(sources, reverse=True))
            return source + helpers.append_headers(headers)

        raise ResolverError('No playable video found.')
Ejemplo 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}
     html = self.net.http_GET(web_url, headers=headers).content
     
     if html:
         try:
             packed = helpers.get_packed_data(html)
             i = 0 # just incase of infinite loop
             while jsunpack.detect(packed) and i < 5:
                 i += 1
                 try: packed = jsunpack.unpack(packed)
                 except: break
                 
             location_href = re.search("""(?:window|document)\.location\.href\s*=\s*["']([^"']+)""", packed, re.I).groups()[0]
             location_href = 'http:%s' % location_href if location_href.startswith("//") else location_href
             
             return helpers.get_media_url(location_href, patterns=['''file:["'](?P<url>(?!http://s(?:13|57))[^"']+)''']).replace(' ', '%20')
             
         except Exception as e:
             raise ResolverError(e)
         
     raise ResolverError('File not found')
    def get_media_url(self, host, media_id, cached_only=False):
        torrent = False
        cached = self.__check_cache(media_id)
        media_id_lc = media_id.lower()
        if cached:
            logger.log_debug('Premiumize.me: %s is readily available to stream' % media_id)
            if media_id_lc.endswith('.torrent') or media_id_lc.startswith('magnet:'):
                torrent = True
        elif media_id_lc.endswith('.torrent') or media_id_lc.startswith('magnet:'):
            if self.get_setting('cached_only') == 'true' or cached_only:
                raise ResolverError('Premiumize.me: Cached torrents only allowed to be initiated')
            torrent = True
            logger.log_debug('Premiumize.me: initiating transfer to cloud for %s' % media_id)
            self.__initiate_transfer(media_id)
            self.__clear_finished()
            # self.__delete_folder()

        link = self.__direct_dl(media_id, torrent=torrent)
        if link is not None:
            logger.log_debug('Premiumize.me: Resolved to %s' % link)
            return link + helpers.append_headers(self.headers)

        raise ResolverError('Link Not Found')
Ejemplo n.º 10
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

        if 'File was deleted' in html:
            raise ResolverError('File Removed')

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

        packed = re.search('(eval\(function.*?)\s*</script>', html, re.DOTALL)
        if packed:
            js = jsunpack.unpack(packed.group(1))
        else:
            js = html

        link = re.search('(?:m3u8").*?"(.*?)"', js)
        if link:
            common.log_utils.log_debug('watchvideo.us Link Found: %s' %
                                       link.group(1))
            return link.group(1)

        raise ResolverError('Unable to find watchvideo.us video')
Ejemplo n.º 11
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.')
Ejemplo 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': web_url}
     download_serv = json.loads(self.net.http_GET('https://apiv2.' + host + '/getServer?c=' + media_id, headers=headers).content)
     if (download_serv['status'] == 'ok'):
         download_url = json.loads(self.net.http_GET('https://' + download_serv['data']['server'] + '.' + host + '/getUpload?c=' + media_id, headers=headers).content)
         sources = []
         if(download_url['data']['files']):
             for file_index in download_url['data']['files']:
                 url = download_url['data']['files'][file_index]['link']
                 size = download_url['data']['files'][file_index]['size']
                 sources += [(size, url)]
         return helpers.pick_source(sources, False)
     raise ResolverError('Unable to locate video')
Ejemplo n.º 13
0
 def get_media_url(self, host, media_id):
     try:
         web_url = self.get_stream_url(host, media_id)
         stream_url = helpers.get_media_url(web_url)
     except:
         stream_url = None
         
     if not stream_url:
         stream_url = self.__box_url(host, media_id)
         
     if stream_url:
         return stream_url
     else:
         raise ResolverError('File not found')
Ejemplo n.º 14
0
 def get_url(self, host, media_id):
     location, user, media_id = media_id.split('|')
     if user == 'None':
         try:
             web_url = 'https://my.mail.ru/video/embed/%s' % media_id
             response = self.net.http_GET(web_url)
             html = response.content.encode('utf-8')
             media_id = re.search(r'[\"\']movieSrc[\"\']\s?:\s?[\"\'](.*?)[\"\']', html).groups()[0]
             return 'http://videoapi.my.mail.ru/videos/%s.json?ver=0.2.60' % (media_id)
             
         except:
             raise ResolverError('No playable video found.')
     
     else: return 'http://videoapi.my.mail.ru/videos/%s/%s/_myvideo/%s.json?ver=0.2.60' % (location, user, media_id)
Ejemplo n.º 15
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
        if '404 Not Found' in html or 'Has Been Removed' in html:
            raise ResolverError('The requested video was not found.')

        data = helpers.get_hidden(html)
        data['method_free'] = 'Proceed+to+video'
        headers = {'Referer': web_url}
        html = self.net.http_POST(web_url, data, headers=headers).content

        match = re.search('file\s*:\s*"([^"]+)', html)
        if match:
            return match.group(1)
        else:
            for match in re.finditer('(eval\(function.*?)</script>', html,
                                     re.DOTALL):
                js_data = jsunpack.unpack(match.group(1))
                match = re.search('''file\s*:\s*['"]([^"']+)''', js_data)
                if match:
                    return match.group(1)

        raise ResolverError('No playable video found.')
Ejemplo n.º 16
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        self.headers['Referer'] = web_url
        html = self.net.http_GET(web_url, headers=self.headers).content
        r = re.search('src="/?(pcs\?code=[^"]+?)"', html, re.DOTALL)
        if r:
            web_url = 'http://video.anyfiles.pl/%s' % (r.group(1))
            html = self.net.http_GET(web_url, headers=self.headers).content
            match = re.search('(http[^"]+?mp4)', html)
            if match:
                return match.group(1)

        else:
            raise ResolverError('File not found')
Ejemplo n.º 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}
        html = self.net.http_GET(web_url, headers=headers).content

        if html:
            try:
                purl = re.compile('data-src="(.+?)"', re.DOTALL).search(html)
                purl = purl.group(1)
                purl = 'http:' + purl.replace('&amp;', '&')
                html = self.net.http_GET(purl, headers=headers).content
                purl = re.compile(
                    '<link rel="alternate" href=".+?<link rel="alternate" href="(.+?)"',
                    re.DOTALL).search(html).group(1)
                purl += '&format=Script&height=576&width=1024'
                html = self.net.http_GET(purl, headers=headers).content
                a = json.loads(html)
                url = a["captions"][0]["src"]
                url = url.split('/caption/', 1)[1]
                url_snippit = url.split('.', 1)[0]
                url_template = 'https://tvesyfy-vh.akamaihd.net/i/prod/video/%s_,25,40,18,12,7,4,2,00.mp4.csmil/master.m3u8?__b__=1000&hdnea=st=%s~exp=%s'
                curr_time = (datetime.datetime.utcnow() -
                             datetime.datetime(1970, 1, 1))
                start_time = int(
                    (curr_time.microseconds +
                     (curr_time.seconds + curr_time.days * 24 * 3600) * 10**6)
                    / 10**6)
                resolved_url = url_template % (url_snippit, str(start_time),
                                               str(start_time + 60))
                headers.update({'Referer': web_url})

                return resolved_url + helpers.append_headers(headers)

            except:
                raise ResolverError('Video not found')

        raise ResolverError('Video not found')
Ejemplo n.º 18
0
    def get_media_url(self, host, media_id):
        offset = self.get_setting('ts_offset')
        token = self.get_setting('token')
        api_key = self.get_setting('key')
        if not offset or not token or not api_key:
            logger.log_debug('offset: %s, token: %s, key: %s' %
                             (offset, token, api_key))
            raise ResolverError('Insufficent Information to make API call')

        url = '/downloader/add'
        server_ts = int(time.time()) - int(offset)
        signature = hashlib.sha1(str(server_ts) + url + api_key).hexdigest()
        url = self.base_url + url
        headers = {
            'X-DL-SIGN': signature,
            'X-DL-TOKEN': token,
            'X-DL-TS': server_ts
        }
        logger.log_debug('Debrid-Link Headers: %s' % (headers))
        js_data = self.net.http_POST(url,
                                     form_data={
                                         'link': media_id
                                     },
                                     headers=headers).content
        js_data = json.loads(js_data)
        self.__store_offset(js_data)
        if js_data.get('result') == 'OK':
            stream_url = js_data.get('value', {}).get('downloadLink')
            if stream_url is None:
                raise ResolverError(
                    'No usable link returned from Debrid-Link.fr')

            logger.log_debug('Debrid-Link.fr Resolved to %s' % (stream_url))
            return stream_url
        else:
            raise ResolverError('Debrid-Link.fr Link failed: %s' %
                                (js_data.get('ERR', '')))
Ejemplo n.º 19
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
        data = json.loads(html)

        if data['success'] == '0':
            html = self.net.http_GET('http://indavideo.hu/video/%s' % media_id).content
        
            hash = re.search('emb_hash.+?value\s*=\s*"([^"]+)', html)
            if not hash:
                raise ResolverError('File not found')

            web_url = self.get_url(host, hash.group(1))

            html = self.net.http_GET(web_url).content
            data = json.loads(html)

        if data['success'] == '1':
            video_files = data['data']['video_files']
            if not video_files:
                raise ResolverError('File removed')

            tokens = data['data']['filesh']

            sources = []
            if isinstance(video_files, dict): video_files = video_files.values()
            for i in video_files:
                match = re.search('\.(\d+)\.mp4', i)
                if match: sources.append((match.group(1), i))	
            sources = [(i[0], i[1] + '&token=%s' % tokens[i[0]]) for i in sources]
            try: sources = list(set(sources))
            except: pass
            sources = sorted(sources, key=lambda x: x[0])[::-1]
            return helpers.pick_source(sources)

        raise ResolverError('File not found')
Ejemplo n.º 20
0
    def get_media_url(self, host, media_id):
        username = self.get_setting('username')
        password = self.get_setting('password')
        url = 'http://api.zevera.com/jDownloader.ashx?'
        query = urllib.urlencode({
            'cmd': 'generatedownloaddirect',
            'login': username,
            'pass': password,
            'olink': media_id
        })
        url = url + query
        opener = urllib2.build_opener(NoRedirection)
        urllib2.install_opener(opener)
        redirs = 0
        while redirs < MAX_REDIR:
            request = urllib2.Request(url)
            request.get_method = lambda: 'HEAD'
            try:
                response = urllib2.urlopen(request, timeout=TIMEOUT)
                if response.getcode() == 200:
                    logger.log_debug('Zevera: Resolved to %s' % (url))
                    return url
                elif response.getcode() == 302:
                    url = response.info().getheader('Location')
                    redirs += 1
                    logger.log_debug('Zevera Redir #%d: %s' % (redirs, url))
                else:
                    common.logger.log_warning(
                        'Unexpected Zevera Response (%s): %s' %
                        (response.getcode(), response.read()))
                    raise ResolverError('Zevera: Unexpected Response Received')
            except socket.timeout:
                common.logger.log_warning('Zevera timeout: %s' % (url))
                raise ResolverError('Zevera: Timeout')

        raise ResolverError('Zevera: Redirect beyond max allowed (%s)' %
                            (MAX_REDIR))
Ejemplo n.º 21
0
def get_media_url(url):
    try:
        hostname = urlparse.urlparse(url).hostname
        headers = {'User-Agent': common.FF_USER_AGENT}
        html = net.http_GET(url, headers=headers).content
        headers.update({'Referer': url})
        for match in re.finditer('''<script[^>]*src=["']([^'"]+)''', html):
            _html = get_js(match.group(1), headers, hostname)

        match = re.search('''href=['"]([^"']+/playvideo-[^"']+)''', html)
        if match:
            playvid_url = match.group(1)
            html = net.http_GET(playvid_url, headers=headers).content
            headers.update({'Referer': playvid_url})
            for match in re.finditer('''<script[^>]*src=["']([^'"]+)''', html):
                js = get_js(match.group(1), headers, hostname)
                match = re.search(
                    '''!=\s*null.*?get\(['"]([^'"]+).*?\{([^:]+)''', js,
                    re.DOTALL)
                if match:
                    fx_url, fx_param = match.groups()
                    fx_url = resolve_url(
                        urlparse.urljoin('http://www.flashx.tv', fx_url) +
                        '?' + urllib.urlencode({fx_param: "y"}) + '&' +
                        urllib.urlencode({"fxfx": 6}))
                    common.logger.log('fxurl: %s' % (fx_url))
                    _html = net.http_GET(fx_url, headers=headers).content

            headers.update({'Referer': url})
            html = net.http_GET(playvid_url, headers=headers).content
            html += helpers.get_packed_data(html)

        sources = helpers.scrape_sources(
            html,
            patterns=[
                """src:\s*["'](?P<url>[^"']+).+?res:\s*["']?(?P<label>\d+)"""
            ],
            result_blacklist=["trailer.mp4"],
            generic_patterns=False)

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

    except Exception as e:
        logger.log_debug('Exception during flashx resolve parse: %s' % e)
        raise

    raise ResolverError('Unable to resolve flashx link. Filelink not found.')
Ejemplo n.º 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,
         'Referer': 'https://{0}/'.format(host)
     }
     r = self.net.http_GET(web_url, headers=headers)
     src = re.search(r'''ById\('vi.+?=\s*["']([^"']+)['"].+?["']([^"']+)''',
                     r.content)
     if src:
         src_url = 'https:{0}{1}&stream=1'.format(src.group(1),
                                                  src.group(2))
         return helpers.get_redirect_url(
             src_url, headers) + helpers.append_headers(headers)
     raise ResolverError('Video cannot be located.')
Ejemplo n.º 23
0
    def get_media_url(self, host, media_id):
        web_url = self.get_url(host, media_id)
        headers = {'User-Agent': common.FF_USER_AGENT}
        response = self.net.http_GET(web_url, headers=headers)
        html = response.content

        if html:
            smil_id = re.search('([a-zA-Z0-9]+)(?=\|smil)', html).groups()[0]
            smil_url = 'http://%s/%s.smil' % (host, smil_id)
            smil = self.net.http_GET(smil_url, headers=headers).content
            sources = helpers.parse_smil_source_list(smil)
            return helpers.pick_source(sources) + helpers.append_headers(
                headers)

        raise ResolverError('No playable video found.')
Ejemplo n.º 24
0
 def _redirect_test(self, url):
     opener = urllib2.build_opener()
     opener.addheaders = [('User-agent', common.IOS_USER_AGENT)]
     opener.addheaders = [('Referer', urlparse(url).netloc)]
     try:
         resp = opener.open(url)
         if url != resp.geturl():
             return resp.geturl()
         else:
             return url
     except urllib2.HTTPError, e:
         if e.code == 403:
             if url != e.geturl():
                 return e.geturl()
         raise ResolverError('File not found')
Ejemplo n.º 25
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://verystream.com'}
        response = self.net.http_GET(web_url, headers=headers)
        html = response.content

        if html:
            regex = '(%s~[~.:a-zA-Z0-9]+)' % media_id
            videolink = re.search(regex, html)
            if videolink:
                source = 'https://verystream.com/gettoken/%s?mime=true' % videolink.group(1)
                headers.update({'Referer': web_url})
                return source + helpers.append_headers(headers)

        raise ResolverError("Could not locate video")
Ejemplo n.º 26
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
        for match in re.finditer('(eval\(function.*?)</script>', html,
                                 re.DOTALL):
            js_data = jsunpack.unpack(match.group(1))
            r = re.search('file\s*:\s*"([^"]+)', js_data)
            if r:
                return r.group(1)

        r = re.search('file\s*:\s*"([^"]+)', html)
        if r:
            return r.group(1)

        raise ResolverError('File Not Found or removed')
Ejemplo n.º 27
0
    def get_media_url(self, host, media_id):
        result = self.__check_auth(media_id)
        if not result:
            result = self.__auth_ip(media_id)

        if result:
            return helpers.get_media_url(
                result,
                patterns=[
                    '''src:\s*["'](?P<url>[^"']+).+?res:\s*(?P<label>\d+)'''
                ],
                result_blacklist=["trailer"],
                generic_patterns=False).replace(' ', '%20')

        raise ResolverError(i18n('no_ip_authorization'))
Ejemplo n.º 28
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
        for match in re.finditer('(eval\(function.*?)</script>', html,
                                 re.DOTALL):
            html += jsunpack.unpack(match.group(1))

        common.log_utils.log(html)

        match = re.search('vurl\s*=\s*"([^"]+)', html)
        if match:
            return match.group(1)
        else:
            raise ResolverError(
                'Unable to resolve cloudtime link. Filelink not found.')
Ejemplo n.º 29
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
     js = jsunpack.unpack(html).split(';')
     try:
         charcodes = [
             int(val)
             for val in js[1].split('=')[-1].replace('[', '').replace(
                 ']', '').split(',')
         ]
         sub = int(''.join(char for char in js[2].split('-')[1]
                           if char.isdigit()))
     except IndexError:
         raise ResolverError('Video not found')
     charcodes = [val - sub for val in charcodes]
     try:
         srcs = ''.join(map(unichr, charcodes))
     except ValueError:
         raise ResolverError('Video not found')
     source_list = helpers.scrape_sources(srcs)
     source = helpers.pick_source(source_list)
     print "source", source
     return source  #+ helpers.append_headers(headers)
Ejemplo n.º 30
0
 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {
         'Referer': web_url
     }
     headers.update(self.headers)
     html = self.net.http_GET(web_url, headers=headers).content
     sources = re.findall(r"'?label'?\s*:\s*'([^']+)p'\s*,\s*'?file'?\s*:\s*'([^']+)", html, re.I)
     if sources:
         vt = self.__auth_ip(media_id)
         if vt:
             source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true')
             return '%s?direct=false&ua=1&vt=%s|User-Agent=%s' % (source, vt, common.SMU_USER_AGENT)
     else:
         raise ResolverError('Unable to locate links')