def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            params = urlparse.parse_qs(source_url)
            if video.video_type == VIDEO_TYPES.MOVIE:
                cmd = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %s, "properties" : ["file", "playcount", "streamdetails"]}, "id": "libMovies"}'
                result_key = 'moviedetails'
            else:
                cmd = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodeDetails", "params": {"episodeid": %s, "properties" : ["file", "playcount", "streamdetails"]}, "id": "libTvShows"}'
                result_key = 'episodedetails'

            run = cmd % (params['id'][0])
            meta = xbmc.executeJSONRPC(run)
            meta = scraper_utils.parse_json(meta)
            log_utils.log('Source Meta: %s' % (meta), log_utils.LOGDEBUG)
            if 'result' in meta and result_key in meta['result']:
                details = meta['result'][result_key]
                def_quality = [item[0] for item in sorted(SORT_KEYS['quality'].items(), key=lambda x:x[1])][self.def_quality]
                host = {'multi-part': False, 'class': self, 'url': details['file'], 'host': 'XBMC Library', 'quality': def_quality, 'views': details['playcount'], 'rating': None, 'direct': True}
                stream_details = details['streamdetails']
                if len(stream_details['video']) > 0 and 'width' in stream_details['video'][0]:
                    host['quality'] = scraper_utils.width_get_quality(stream_details['video'][0]['width'])
                hosters.append(host)
        return hosters
Exemple #2
0
 def __get_links(self, url, video):
     hosters = []
     search_url = self.__translate_search(url)
     html = self._http_get(search_url, cache_limit=.5)
     js_result = scraper_utils.parse_json(html, search_url)
     if 'data' in js_result:
         for item in js_result['data']:
             post_hash, size, post_title, ext, duration = item['0'], item['4'], item['10'], item['11'], item['14']
             checks = [False] * 6
             if not scraper_utils.title_check(video, post_title): checks[0] = True
             if 'alangs' in item and item['alangs'] and 'eng' not in item['alangs']: checks[1] = True
             if re.match('^\d+s', duration) or re.match('^[0-5]m', duration): checks[2] = True
             if 'passwd' in item and item['passwd']: checks[3] = True
             if 'virus' in item and item['virus']: checks[4] = True
             if 'type' in item and item['type'].upper() != 'VIDEO': checks[5] = True
             if any(checks):
                 log_utils.log('EasyNews Post excluded: %s - |%s|' % (checks, item), log_utils.LOGDEBUG)
                 continue
             
             stream_url = urllib.quote('%s%s/%s%s' % (post_hash, ext, post_title, ext))
             stream_url = 'http://members.easynews.com/dl/%s' % (stream_url)
             stream_url = stream_url + '|Cookie=%s' % (self._get_stream_cookies())
             host = self._get_direct_hostname(stream_url)
             quality = scraper_utils.width_get_quality(item['width'])
             hoster = {'multi-part': False, 'class': self, 'views': None, 'url': stream_url, 'rating': None, 'host': host, 'quality': quality, 'direct': True}
             if size: hoster['size'] = size
             if post_title: hoster['extra'] = post_title
             hosters.append(hoster)
     return hosters
 def __get_links(self, url, video):
     hosters = []
     search_url = self.__translate_search(url)
     html = self._http_get(search_url, cache_limit=.5)
     js_result = scraper_utils.parse_json(html, search_url)
     if 'data' in js_result:
         for item in js_result['data']:
             post_hash, size, post_title, ext, duration = item['0'], item['4'], item['10'], item['11'], item['14']
             checks = [False] * 6
             if not scraper_utils.title_check(video, post_title): checks[0] = True
             if 'alangs' in item and item['alangs'] and 'eng' not in item['alangs']: checks[1] = True
             if re.match('^\d+s', duration) or re.match('^[0-5]m', duration): checks[2] = True
             if 'passwd' in item and item['passwd']: checks[3] = True
             if 'virus' in item and item['virus']: checks[4] = True
             if 'type' in item and item['type'].upper() != 'VIDEO': checks[5] = True
             if any(checks):
                 log_utils.log('EasyNews Post excluded: %s - |%s|' % (checks, item), log_utils.LOGDEBUG)
                 continue
             
             stream_url = urllib.quote('%s%s/%s%s' % (post_hash, ext, post_title, ext))
             stream_url = 'http://members.easynews.com/dl/%s' % (stream_url)
             stream_url = stream_url + '|Cookie=%s' % (self._get_stream_cookies())
             host = self._get_direct_hostname(stream_url)
             quality = scraper_utils.width_get_quality(item['width'])
             hoster = {'multi-part': False, 'class': self, 'views': None, 'url': stream_url, 'rating': None, 'host': host, 'quality': quality, 'direct': True}
             if size: hoster['size'] = size
             if post_title: hoster['extra'] = post_title
             hosters.append(hoster)
     return hosters
Exemple #4
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            params = urlparse.parse_qs(source_url)
            if video.video_type == VIDEO_TYPES.MOVIE:
                cmd = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %s, "properties" : ["file", "playcount", "streamdetails"]}, "id": "libMovies"}'
                result_key = 'moviedetails'
            else:
                cmd = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodeDetails", "params": {"episodeid": %s, "properties" : ["file", "playcount", "streamdetails"]}, "id": "libTvShows"}'
                result_key = 'episodedetails'

            run = cmd % (params['id'][0])
            meta = xbmc.executeJSONRPC(run)
            meta = scraper_utils.parse_json(meta)
            log_utils.log('Source Meta: %s' % (meta), log_utils.LOGDEBUG)
            if 'result' in meta and result_key in meta['result']:
                details = meta['result'][result_key]
                def_quality = [item[0] for item in sorted(SORT_KEYS['quality'].items(), key=lambda x:x[1])][self.def_quality]
                host = {'multi-part': False, 'class': self, 'url': details['file'], 'host': 'XBMC Library', 'quality': def_quality, 'views': details['playcount'], 'rating': None, 'direct': True}
                stream_details = details['streamdetails']
                if len(stream_details['video']) > 0 and 'width' in stream_details['video'][0]:
                    host['quality'] = scraper_utils.width_get_quality(stream_details['video'][0]['width'])
                hosters.append(host)
        return hosters
 def __get_cloud_links(self, html, page_url, sub):
     hosters = []
     html = html.replace('\\"', '"').replace('\\/', '/')
     match = re.search("dizi_kapak_getir\('([^']+)", html)
     if match:
         ep_id = match.group(1)
         for script_url in dom_parser.parse_dom(html, 'script', {'data-cfasync': 'false'}, ret='src'):
             html = self._http_get(script_url, cache_limit=24)
             match1 = re.search("var\s+kapak_url\s*=\s*'([^']+)", html)
             match2 = re.search("var\s+aCtkp\s*=\s*'([^']+)", html)
             if match1 and match2:
                 link_url = '%s?fileid=%s&access_token=%s' % (match1.group(1), ep_id, match2.group(1))
                 headers = {'Referer': page_url}
                 html = self._http_get(link_url, headers=headers, cache_limit=.5)
                 js_data = scraper_utils.parse_json(html, link_url)
                 for variant in js_data.get('variants', {}):
                     stream_host = random.choice(variant.get('hosts', []))
                     if stream_host:
                         stream_url = STREAM_URL % (stream_host, variant['path'], scraper_utils.get_ua(), urllib.quote(page_url))
                         if not stream_url.startswith('http'):
                             stream_url = 'http://' + stream_url
                         host = self._get_direct_hostname(stream_url)
                         if 'width' in variant:
                             quality = scraper_utils.width_get_quality(variant['width'])
                         elif 'height' in variant:
                             quality = scraper_utils.height_get_quality(variant['height'])
                         else:
                             quality = QUALITIES.HIGH
                         hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': True}
                         hoster['subs'] = sub
                         hosters.append(hoster)
     return hosters
    def __get_links(self, url, video):
        hosters = []
        search_url = urlparse.urljoin(self.base_url, SEARCH_URL)
        query = self.__translate_search(url)
        result = self._http_get(search_url, data=query, allow_redirect=False, cache_limit=.5)
        if 'files' in result:
            for item in result['files']:
                checks = [False] * 6
                if 'type' not in item or item['type'].upper() != 'VIDEO': checks[0] = True
                if 'is_ready' in item and item['is_ready'] != '1': checks[1] = True
                if 'av_result' in item and item['av_result'] in ['warning', 'infected']: checks[2] = True
                if 'video_info' not in item: checks[3] = True
                if 'video_info' in item and item['video_info'] and not re.search('#0:(?:0|1)(?:\(eng\)|\(und\))?:\s*Audio:', item['video_info']): checks[4] = True
                if video.video_type == VIDEO_TYPES.EPISODE:
                    sxe = '[. ][Ss]%02d[Ee]%02d[. ]' % (int(video.season), int(video.episode))
                    if not re.search(sxe, item['name']):
                        if video.ep_airdate:
                            airdate_pattern = '[. ]%s[. ]%02d[. ]%02d[. ]' % (video.ep_airdate.year, video.ep_airdate.month, video.ep_airdate.day)
                            if not re.search(airdate_pattern, item['name']): checks[5] = True
                    
                if any(checks):
                    log_utils.log('Furk.net result excluded: %s - |%s|' % (checks, item['name']), log_utils.LOGDEBUG)
                    continue
                
                match = re.search('(\d{3,})\s?x\s?(\d{3,})', item['video_info'])
                if match:
                    width, _ = match.groups()
                    quality = scraper_utils.width_get_quality(width)
                else:
                    if video.video_type == VIDEO_TYPES.MOVIE:
                        _, _, height, _ = scraper_utils.parse_movie_link(item['name'])
                        quality = scraper_utils.height_get_quality(height)
                    elif video.video_type == VIDEO_TYPES.EPISODE:
                        _, _, _, height, _ = scraper_utils.parse_episode_link(item['name'])
                        if int(height) > -1:
                            quality = scraper_utils.height_get_quality(height)
                        else:
                            quality = QUALITIES.HIGH
                    else:
                        quality = QUALITIES.HIGH
                    
                if 'url_pls' in item:
                    size_gb = scraper_utils.format_size(int(item['size']), 'B')
                    if self.max_bytes and int(item['size']) > self.max_bytes:
                        log_utils.log('Result skipped, Too big: |%s| - %s (%s) > %s (%sGB)' % (item['name'], item['size'], size_gb, self.max_bytes, self.max_gb))
                        continue

                    stream_url = item['url_pls']
                    host = self._get_direct_hostname(stream_url)
                    hoster = {'multi-part': False, 'class': self, 'views': None, 'url': stream_url, 'rating': None, 'host': host, 'quality': quality, 'direct': True}
                    hoster['size'] = size_gb
                    hoster['extra'] = item['name']
                    hosters.append(hoster)
                else:
                    log_utils.log('Furk.net result skipped - no playlist: |%s|' % (json.dumps(item)), log_utils.LOGDEBUG)
                    
        return hosters
Exemple #7
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(url, cache_limit=.5)

            match = re.search('((?:pic|emb|vb)=[^<]+)', html)
            if match:
                embeds = match.group(1)
                for stream_url in embeds.split('&'):
                    if stream_url.startswith('vb='):
                        stream_url = 'http://www.vidbux.com/%s' % (
                            stream_url[3:])
                        host = 'vidbux.com'
                        direct = False
                        quality = scraper_utils.get_quality(
                            video, host, QUALITIES.HD1080)
                    elif stream_url.startswith('pic='):
                        data = {'url': stream_url[4:]}
                        html = self._http_get(PHP_URL,
                                              data=data,
                                              auth=False,
                                              cache_limit=1)
                        js_data = scraper_utils.parse_json(html, PHP_URL)
                        host = self._get_direct_hostname(stream_url)
                        direct = True
                        for item in js_data:
                            if 'medium' in item and item['medium'] == 'video':
                                stream_url = item['url']
                                quality = scraper_utils.width_get_quality(
                                    item['width'])
                                break
                        else:
                            continue
                    elif stream_url.startswith('emb='):
                        stream_url = stream_url.replace('emb=', '')
                        host = urlparse.urlparse(stream_url).hostname
                        direct = False
                        quality = scraper_utils.get_quality(
                            video, host, QUALITIES.HD720)
                    else:
                        continue

                    hoster = {
                        'multi-part': False,
                        'host': host,
                        'class': self,
                        'quality': quality,
                        'views': None,
                        'rating': None,
                        'url': stream_url,
                        'direct': direct
                    }
                    hosters.append(hoster)
        return hosters
 def __get_quality(self, item, video):
     if 'width' in item:
         return scraper_utils.width_get_quality(item['width'])
     elif 'height' in item:
         return scraper_utils.height_get_quality(item['height'])
     else:
         if video.video_type == VIDEO_TYPES.MOVIE:
             _title, _year, height, _extra = scraper_utils.parse_movie_link(item['name'])
         else:
             _title, _season, _episode, height, _extra = scraper_utils.parse_episode_link(item['name'])
         return scraper_utils.height_get_quality(height)
 def __get_cloud_links(self, html, page_url, sub):
     hosters = []
     html = html.replace('\\"', '"').replace('\\/', '/')
     match = re.search("dizi_kapak_getir\('([^']+)", html)
     if match:
         ep_id = match.group(1)
         for attrs, _content in dom_parser2.parse_dom(
                 html, 'script', {'data-cfasync': 'false'}, req='src'):
             script_url = attrs['src']
             html = self._http_get(script_url, cache_limit=24)
             match1 = re.search("var\s+kapak_url\s*=\s*'([^']+)", html)
             match2 = re.search("var\s+aCtkp\s*=\s*'([^']+)", html)
             if match1 and match2:
                 link_url = '%s?fileid=%s&access_token=%s' % (
                     match1.group(1), ep_id, match2.group(1))
                 headers = {'Referer': page_url}
                 html = self._http_get(link_url,
                                       headers=headers,
                                       cache_limit=.5)
                 js_data = scraper_utils.parse_json(html, link_url)
                 for variant in js_data.get('variants', {}):
                     stream_host = random.choice(variant.get('hosts', []))
                     if stream_host:
                         stream_url = stream_host + variant[
                             'path'] + scraper_utils.append_headers(
                                 {
                                     'User-Agent': scraper_utils.get_ua(),
                                     'Referer': page_url
                                 })
                         if not stream_url.startswith('http'):
                             stream_url = 'http://' + stream_url
                         host = scraper_utils.get_direct_hostname(
                             self, stream_url)
                         if 'width' in variant:
                             quality = scraper_utils.width_get_quality(
                                 variant['width'])
                         elif 'height' in variant:
                             quality = scraper_utils.height_get_quality(
                                 variant['height'])
                         else:
                             quality = QUALITIES.HIGH
                         hoster = {
                             'multi-part': False,
                             'host': host,
                             'class': self,
                             'quality': quality,
                             'views': None,
                             'rating': None,
                             'url': stream_url,
                             'direct': True
                         }
                         hoster['subs'] = sub
                         hosters.append(hoster)
     return hosters
    def __get_links(self, url, video):
        hosters = []
        search_url = self.__translate_search(url)
        html = self._http_get(search_url, cache_limit=.5)
        js_result = scraper_utils.parse_json(html, search_url)
        down_url = js_result.get('downURL')
        dl_farm = js_result.get('dlFarm')
        dl_port = js_result.get('dlPort')
        for item in js_result.get('data', []):
            post_hash, size, post_title, ext, duration = item['0'], item['4'], item['10'], item['11'], item['14']
            checks = [False] * 6
            if not scraper_utils.release_check(video, post_title): checks[0] = True
            if 'alangs' in item and item['alangs'] and 'eng' not in item['alangs']: checks[1] = True
            if re.match('^\d+s', duration) or re.match('^[0-5]m', duration): checks[2] = True
            if 'passwd' in item and item['passwd']: checks[3] = True
            if 'virus' in item and item['virus']: checks[4] = True
            if 'type' in item and item['type'].upper() != 'VIDEO': checks[5] = True
            if any(checks):
                log_utils.log('EasyNews Post excluded: %s - |%s|' % (checks, item), log_utils.LOGDEBUG)
                continue
            
            stream_url = down_url + urllib.quote('/%s/%s/%s%s/%s%s' % (dl_farm, dl_port, post_hash, ext, post_title, ext))
            stream_url = stream_url + '|Authorization=%s' % (urllib.quote(self.auth))
            host = self._get_direct_hostname(stream_url)
            quality = None
            if 'width' in item:
                try: width = int(item['width'])
                except: width = 0
                if width:
                    quality = scraper_utils.width_get_quality(width)
            
            if quality is None:
                if video.video_type == VIDEO_TYPES.MOVIE:
                    meta = scraper_utils.parse_movie_link(post_title)
                else:
                    meta = scraper_utils.parse_episode_link(post_title)
                quality = scraper_utils.height_get_quality(meta['height'])
                
            if self.max_bytes:
                match = re.search('([\d.]+)\s+(.*)', size)
                if match:
                    size_bytes = scraper_utils.to_bytes(*match.groups())
                    if size_bytes > self.max_bytes:
                        log_utils.log('Result skipped, Too big: |%s| - %s (%s) > %s (%s GB)' % (post_title, size_bytes, size, self.max_bytes, self.max_gb))
                        continue

            hoster = {'multi-part': False, 'class': self, 'views': None, 'url': stream_url, 'rating': None, 'host': host, 'quality': quality, 'direct': True}
            if any(i for i in ['X265', 'HEVC'] if i in post_title.upper()): hoster['format'] = 'x265'
            if size: hoster['size'] = size
            if post_title: hoster['extra'] = post_title
            hosters.append(hoster)
        return hosters
 def __get_quality(self, item, video):
     if 'width' in item:
         return scraper_utils.width_get_quality(item['width'])
     elif 'height' in item:
         return scraper_utils.height_get_quality(item['height'])
     else:
         if video.video_type == VIDEO_TYPES.MOVIE:
             _title, _year, height, _extra = scraper_utils.parse_movie_link(
                 item['name'])
         else:
             _title, _season, _episode, height, _extra = scraper_utils.parse_episode_link(
                 item['name'])
         return scraper_utils.height_get_quality(height)
Exemple #12
0
 def __get_quality(self, item, video):
     if item.get('width'):
         return scraper_utils.width_get_quality(item['width'])
     elif item.get('height'):
         return scraper_utils.height_get_quality(item['height'])
     elif 'name' in item:
         if video.video_type == VIDEO_TYPES.MOVIE:
             meta = scraper_utils.parse_movie_link(item['name'])
         else:
             meta = scraper_utils.parse_episode_link(item['name'])
         return scraper_utils.height_get_quality(meta['height'])
     else:
         return QUALITIES.HIGH
 def __get_quality(self, item, video):
     if 'width' in item and item['width']:
         return scraper_utils.width_get_quality(item['width'])
     elif 'height' in item and item['height']:
         return scraper_utils.height_get_quality(item['height'])
     elif 'name' in item:
         if video.video_type == VIDEO_TYPES.MOVIE:
             meta = scraper_utils.parse_movie_link(item['name'])
         else:
             meta = scraper_utils.parse_episode_link(item['name'])
         return scraper_utils.height_get_quality(meta['height'])
     else:
         return QUALITIES.HIGH
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)

        match = re.search('((?:pic|emb|vb|dir|emb2)=[^<]+)', html)
        if match:
            embeds = match.group(1)
            for stream_url in embeds.split('&'):
                if stream_url.startswith('dir='):
                    headers = {'Referer': url}
                    html = self._http_get(DIR_URL, params={'v': stream_url[3:]}, headers=headers, auth=False, allow_redirect=False, cache_limit=.5)
                    if html.startswith('http'):
                        stream_url = html + scraper_utils.append_headers({'User-Agent': scraper_utils.get_ua(), 'Referer': url})
                        host = scraper_utils.get_direct_hostname(self, stream_url)
                        direct = True
                        quality = QUALITIES.HD720
                    else:
                        continue
                elif stream_url.startswith('vb='):
                    stream_url = 'http://www.vidbux.com/%s' % (stream_url[3:])
                    host = 'vidbux.com'
                    direct = False
                    quality = scraper_utils.get_quality(video, host, QUALITIES.HD1080)
                elif stream_url.startswith('pic='):
                    data = {'url': stream_url[4:]}
                    html = self._http_get(PHP_URL, data=data, auth=False, cache_limit=1)
                    js_data = scraper_utils.parse_json(html, PHP_URL)
                    host = scraper_utils.get_direct_hostname(self, stream_url)
                    direct = True
                    for item in js_data:
                        if item.get('medium') == 'video':
                            stream_url = item['url']
                            quality = scraper_utils.width_get_quality(item['width'])
                            break
                    else:
                        continue
                elif stream_url.startswith(('emb=', 'emb2=')):
                    stream_url = re.sub('emb\d*=', '', stream_url)
                    host = urlparse.urlparse(stream_url).hostname
                    direct = False
                    quality = scraper_utils.get_quality(video, host, QUALITIES.HD720)
                else:
                    continue

                hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': direct}
                hosters.append(hoster)

        return hosters
Exemple #15
0
 def __get_pk_links(self, html):
     hosters = []
     match = re.search('var\s+parametros\s*=\s*"([^"]+)', html)
     if match:
         params = scraper_utils.parse_query(match.group(1))
         if 'pic' in params:
             data = {'sou': 'pic', 'fv': '25', 'url': params['pic']}
             html = self._http_get(PK_URL,
                                   headers=XHR,
                                   data=data,
                                   cache_limit=0)
             js_data = scraper_utils.parse_json(html, PK_URL)
             for item in js_data:
                 if 'url' in item and item['url']:
                     if 'width' in item and item['width']:
                         quality = scraper_utils.width_get_quality(
                             item['width'])
                     elif 'height' in item and item['height']:
                         quality = scraper_utils.height_get_quality(
                             item['height'])
                     else:
                         quality = QUALITIES.HD720
                     stream_url = item['url'] + scraper_utils.append_headers(
                         {'User-Agent': scraper_utils.get_ua()})
                     hoster = {
                         'multi-part':
                         False,
                         'url':
                         stream_url,
                         'class':
                         self,
                         'quality':
                         quality,
                         'host':
                         scraper_utils.get_direct_hostname(
                             self, item['url']),
                         'rating':
                         None,
                         'views':
                         None,
                         'direct':
                         True
                     }
                     hosters.append(hoster)
     return hosters
Exemple #16
0
    def __get_links(self, url, video):
        hosters = []
        search_url = scraper_utils.urljoin(self.base_url, SEARCH_URL)
        query = self.__translate_search(url)
        result = self._http_get(search_url, data=query, allow_redirect=False, cache_limit=.5)
        for item in result.get('files', []):
            checks = [False] * 6
            if item.get('type', '').upper() != 'VIDEO': checks[0] = True
            if item.get('is_ready') != '1': checks[1] = True
            if item.get('av_result') in ['warning', 'infected']: checks[2] = True
            if 'video_info' not in item: checks[3] = True
            if item.get('video_info') and not re.search('#0:(0|1)(\((eng|und)\))?:\s*Audio:', item['video_info'], re.I): checks[4] = True
            if not scraper_utils.release_check(video, item['name']): checks[5] = True
            if any(checks):
                logger.log('Furk.net result excluded: %s - |%s|' % (checks, item['name']), log_utils.LOGDEBUG)
                continue
            
            match = re.search('(\d{3,})\s*x\s*(\d{3,})', item['video_info'])
            if match:
                width, _height = match.groups()
                quality = scraper_utils.width_get_quality(width)
            else:
                if video.video_type == VIDEO_TYPES.MOVIE:
                    meta = scraper_utils.parse_movie_link(item['name'])
                else:
                    meta = scraper_utils.parse_episode_link(item['name'])
                quality = scraper_utils.height_get_quality(meta['height'])
                
            if 'url_pls' in item:
                size_gb = scraper_utils.format_size(int(item['size']), 'B')
                if self.max_bytes and int(item['size']) > self.max_bytes:
                    logger.log('Result skipped, Too big: |%s| - %s (%s) > %s (%sGB)' % (item['name'], item['size'], size_gb, self.max_bytes, self.max_gb))
                    continue

                stream_url = item['url_pls']
                host = scraper_utils.get_direct_hostname(self, stream_url)
                hoster = {'multi-part': False, 'class': self, 'views': None, 'url': stream_url, 'rating': None, 'host': host, 'quality': quality, 'direct': True}
                hoster['size'] = size_gb
                hoster['extra'] = item['name']
                hosters.append(hoster)
            else:
                logger.log('Furk.net result skipped - no playlist: |%s|' % (json.dumps(item)), log_utils.LOGDEBUG)
                    
        return hosters
 def __get_pk_links(self, html):
     hosters = []
     match = re.search('var\s+parametros\s*=\s*"([^"]+)', html)
     if match:
         params = scraper_utils.parse_query(match.group(1))
         if 'pic' in params:
             data = {'sou': 'pic', 'fv': '25', 'url': params['pic']}
             html = self._http_get(PK_URL, headers=XHR, data=data, cache_limit=0)
             js_data = scraper_utils.parse_json(html, PK_URL)
             for item in js_data:
                 if 'url' in item and item['url']:
                     if 'width' in item and item['width']:
                         quality = scraper_utils.width_get_quality(item['width'])
                     elif 'height' in item and item['height']:
                         quality = scraper_utils.height_get_quality(item['height'])
                     else:
                         quality = QUALITIES.HD720
                     stream_url = item['url'] + scraper_utils.append_headers({'User-Agent': scraper_utils.get_ua()})
                     hoster = {'multi-part': False, 'url': stream_url, 'class': self, 'quality': quality, 'host': scraper_utils.get_direct_hostname(self, item['url']), 'rating': None, 'views': None, 'direct': True}
                     hosters.append(hoster)
     return hosters
Exemple #18
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(url, cache_limit=.5)

            match = re.search('((?:pic|emb|vb)=[^<]+)', html)
            if match:
                embeds = match.group(1)
                for stream_url in embeds.split('&'):
                    if stream_url.startswith('vb='):
                        stream_url = 'http://www.vidbux.com/%s' % (stream_url[3:])
                        host = 'vidbux.com'
                        direct = False
                        quality = scraper_utils.get_quality(video, host, QUALITIES.HD1080)
                    elif stream_url.startswith('pic='):
                        data = {'url': stream_url[4:]}
                        html = self._http_get(PHP_URL, data=data, auth=False, cache_limit=1)
                        js_data = scraper_utils.parse_json(html, PHP_URL)
                        host = self._get_direct_hostname(stream_url)
                        direct = True
                        for item in js_data:
                            if 'medium' in item and item['medium'] == 'video':
                                stream_url = item['url']
                                quality = scraper_utils.width_get_quality(item['width'])
                                break
                        else:
                            continue
                    elif stream_url.startswith('emb='):
                        stream_url = stream_url.replace('emb=', '')
                        host = urlparse.urlparse(stream_url).hostname
                        direct = False
                        quality = scraper_utils.get_quality(video, host, QUALITIES.HD720)
                    else:
                        continue

                    hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': direct}
                    hosters.append(hoster)
        return hosters
Exemple #19
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(url, cache_limit=.5)
            fragment = ''
            if video.video_type == VIDEO_TYPES.EPISODE:
                pattern = 'Season\s+%s\s+Serie\s+%s</h3>(.*?)</table>' % (
                    video.season, video.episode)
                match = re.search(pattern, html, re.DOTALL)
                if match:
                    fragment = match.group(1)
            else:
                fragment = html

            if fragment:
                for match in re.finditer('data-width="([^"]+)"[^>]+>([^<]+)',
                                         fragment, re.DOTALL):
                    width, url = match.groups()
                    host = urlparse.urlsplit(url).hostname.replace(
                        'embed.', '')
                    url = url.replace('&amp;', '&')
                    hoster = {
                        'multi-part': False,
                        'host': host,
                        'class': self,
                        'quality': scraper_utils.width_get_quality(width),
                        'views': None,
                        'rating': None,
                        'url': url,
                        'direct': False
                    }
                    hoster['quality'] = scraper_utils.get_quality(
                        video, host, hoster['quality'])
                    hosters.append(hoster)
        return hosters
 def get_sources(self, video):
     hosters = []
     source_url = self.get_url(video)
     if not source_url or source_url == FORCE_NO_MATCH: return hosters
     url = scraper_utils.urljoin(self.base_url, source_url)
     html = self._http_get(url, cache_limit=.5)
     fragment = ''
     if video.video_type == VIDEO_TYPES.EPISODE:
         pattern = 'Season\s+%s\s+Serie\s+%s<(.*?)</table>' % (video.season, video.episode)
         match = re.search(pattern, html, re.DOTALL)
         if match:
             fragment = match.group(1)
     else:
         fragment = html
     if not fragment: return hosters
     
     for attrs, stream_url in dom_parser2.parse_dom(fragment, 'td', {'class': 'linkHiddenUrl'}, req='data-width'):
         host = urlparse.urlsplit(stream_url).hostname.replace('embed.', '')
         url = url.replace('&amp;', '&')
         quality = scraper_utils.width_get_quality(attrs['data-width'])
         hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': False}
         hoster['quality'] = scraper_utils.get_quality(video, host, hoster['quality'])
         hosters.append(hoster)
     return hosters
    def get_sources(self, video):
        hosters = []
        source_url = self.get_url(video)
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)
        fragment = ''
        if video.video_type == VIDEO_TYPES.EPISODE:
            pattern = 'Season\s+%s\s+Serie\s+%s<(.*?)</table>' % (
                video.season, video.episode)
            match = re.search(pattern, html, re.DOTALL)
            if match:
                fragment = match.group(1)
        else:
            fragment = html
        if not fragment: return hosters

        for attrs, stream_url in dom_parser2.parse_dom(
                fragment, 'td', {'class': 'linkHiddenUrl'}, req='data-width'):
            host = urlparse.urlsplit(stream_url).hostname.replace('embed.', '')
            url = url.replace('&amp;', '&')
            quality = scraper_utils.width_get_quality(attrs['data-width'])
            hoster = {
                'multi-part': False,
                'host': host,
                'class': self,
                'quality': quality,
                'views': None,
                'rating': None,
                'url': stream_url,
                'direct': False
            }
            hoster['quality'] = scraper_utils.get_quality(
                video, host, hoster['quality'])
            hosters.append(hoster)
        return hosters
Exemple #22
0
    def __get_links(self, url, video):
        hosters = []
        search_url, params = self.__translate_search(url)
        html = self._http_get(search_url, params=params, cache_limit=.5)
        js_result = scraper_utils.parse_json(html, search_url)
        down_url = js_result.get('downURL')
        dl_farm = js_result.get('dlFarm')
        dl_port = js_result.get('dlPort')
        for item in js_result.get('data', []):
            post_hash, size, post_title, ext, duration = item['0'], item[
                '4'], item['10'], item['11'], item['14']
            checks = [False] * 6
            if not scraper_utils.release_check(video, post_title):
                checks[0] = True
            if 'alangs' in item and item['alangs'] and 'eng' not in item[
                    'alangs']:
                checks[1] = True
            if re.match('^\d+s', duration) or re.match('^[0-5]m', duration):
                checks[2] = True
            if 'passwd' in item and item['passwd']: checks[3] = True
            if 'virus' in item and item['virus']: checks[4] = True
            if 'type' in item and item['type'].upper() != 'VIDEO':
                checks[5] = True
            if any(checks):
                logger.log(
                    'EasyNews Post excluded: %s - |%s|' % (checks, item),
                    log_utils.LOGDEBUG)
                continue

            stream_url = down_url + urllib.quote(
                '/%s/%s/%s%s/%s%s' %
                (dl_farm, dl_port, post_hash, ext, post_title, ext))
            stream_url = stream_url + '|Authorization=%s' % (urllib.quote(
                self.auth))
            host = scraper_utils.get_direct_hostname(self, stream_url)
            quality = None
            if 'width' in item:
                try:
                    width = int(item['width'])
                except:
                    width = 0
                if width:
                    quality = scraper_utils.width_get_quality(width)

            if quality is None:
                if video.video_type == VIDEO_TYPES.MOVIE:
                    meta = scraper_utils.parse_movie_link(post_title)
                else:
                    meta = scraper_utils.parse_episode_link(post_title)
                quality = scraper_utils.height_get_quality(meta['height'])

            if self.max_bytes:
                match = re.search('([\d.]+)\s+(.*)', size)
                if match:
                    size_bytes = scraper_utils.to_bytes(*match.groups())
                    if size_bytes > self.max_bytes:
                        logger.log(
                            'Result skipped, Too big: |%s| - %s (%s) > %s (%s GB)'
                            % (post_title, size_bytes, size, self.max_bytes,
                               self.max_gb))
                        continue

            hoster = {
                'multi-part': False,
                'class': self,
                'views': None,
                'url': stream_url,
                'rating': None,
                'host': host,
                'quality': quality,
                'direct': True
            }
            if any(i for i in ['X265', 'HEVC'] if i in post_title.upper()):
                hoster['format'] = 'x265'
            if size: hoster['size'] = size
            if post_title: hoster['extra'] = post_title
            hosters.append(hoster)
        return hosters
Exemple #23
0
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if not source_url or source_url == FORCE_NO_MATCH: return hosters
        url = scraper_utils.urljoin(self.base_url, source_url)
        html = self._http_get(url, cache_limit=.5)

        match = re.search('((?:pic|emb|vb|dir|emb2)=[^<]+)', html)
        if match:
            embeds = match.group(1)
            for stream_url in embeds.split('&'):
                if stream_url.startswith('dir='):
                    headers = {'Referer': url}
                    html = self._http_get(DIR_URL,
                                          params={'v': stream_url[3:]},
                                          headers=headers,
                                          auth=False,
                                          allow_redirect=False,
                                          cache_limit=.5)
                    if html.startswith('http'):
                        stream_url = html + scraper_utils.append_headers(
                            {
                                'User-Agent': scraper_utils.get_ua(),
                                'Referer': url
                            })
                        host = scraper_utils.get_direct_hostname(
                            self, stream_url)
                        direct = True
                        quality = QUALITIES.HD720
                    else:
                        continue
                elif stream_url.startswith('vb='):
                    stream_url = 'http://www.vidbux.com/%s' % (stream_url[3:])
                    host = 'vidbux.com'
                    direct = False
                    quality = scraper_utils.get_quality(
                        video, host, QUALITIES.HD1080)
                elif stream_url.startswith('pic='):
                    data = {'url': stream_url[4:]}
                    html = self._http_get(PHP_URL,
                                          data=data,
                                          auth=False,
                                          cache_limit=1)
                    js_data = scraper_utils.parse_json(html, PHP_URL)
                    host = scraper_utils.get_direct_hostname(self, stream_url)
                    direct = True
                    for item in js_data:
                        if item.get('medium') == 'video':
                            stream_url = item['url']
                            quality = scraper_utils.width_get_quality(
                                item['width'])
                            break
                    else:
                        continue
                elif stream_url.startswith(('emb=', 'emb2=')):
                    stream_url = re.sub('emb\d*=', '', stream_url)
                    host = urlparse.urlparse(stream_url).hostname
                    direct = False
                    quality = scraper_utils.get_quality(
                        video, host, QUALITIES.HD720)
                else:
                    continue

                hoster = {
                    'multi-part': False,
                    'host': host,
                    'class': self,
                    'quality': quality,
                    'views': None,
                    'rating': None,
                    'url': stream_url,
                    'direct': direct
                }
                hosters.append(hoster)

        return hosters
Exemple #24
0
    def __get_links(self, url, video):
        hosters = []
        search_url = urlparse.urljoin(self.base_url, SEARCH_URL)
        query = self.__translate_search(url)
        result = self._http_get(search_url,
                                data=query,
                                allow_redirect=False,
                                cache_limit=.5)
        if 'files' in result:
            for item in result['files']:
                checks = [False] * 6
                if 'type' not in item or item['type'].upper() != 'VIDEO':
                    checks[0] = True
                if 'is_ready' in item and item['is_ready'] != '1':
                    checks[1] = True
                if 'av_result' in item and item['av_result'] in [
                        'warning', 'infected'
                ]:
                    checks[2] = True
                if 'video_info' not in item: checks[3] = True
                if 'video_info' in item and item[
                        'video_info'] and not re.search(
                            '#0:(?:0|1)(?:\(eng\)|\(und\))?:\s*Audio:',
                            item['video_info']):
                    checks[4] = True
                if video.video_type == VIDEO_TYPES.EPISODE:
                    sxe = '[. ][Ss]%02d[Ee]%02d[. ]' % (int(
                        video.season), int(video.episode))
                    if not re.search(sxe, item['name']):
                        if video.ep_airdate:
                            airdate_pattern = '[. ]%s[. ]%02d[. ]%02d[. ]' % (
                                video.ep_airdate.year, video.ep_airdate.month,
                                video.ep_airdate.day)
                            if not re.search(airdate_pattern, item['name']):
                                checks[5] = True

                if any(checks):
                    log_utils.log(
                        'Furk.net result excluded: %s - |%s|' %
                        (checks, item['name']), log_utils.LOGDEBUG)
                    continue

                match = re.search('(\d{3,})\s?x\s?(\d{3,})',
                                  item['video_info'])
                if match:
                    width, _ = match.groups()
                    quality = scraper_utils.width_get_quality(width)
                else:
                    if video.video_type == VIDEO_TYPES.MOVIE:
                        _, _, height, _ = scraper_utils.parse_movie_link(
                            item['name'])
                        quality = scraper_utils.height_get_quality(height)
                    elif video.video_type == VIDEO_TYPES.EPISODE:
                        _, _, _, height, _ = scraper_utils.parse_episode_link(
                            item['name'])
                        if int(height) > -1:
                            quality = scraper_utils.height_get_quality(height)
                        else:
                            quality = QUALITIES.HIGH
                    else:
                        quality = QUALITIES.HIGH

                stream_url = item['url_pls']
                host = self._get_direct_hostname(stream_url)
                hoster = {
                    'multi-part': False,
                    'class': self,
                    'views': None,
                    'url': stream_url,
                    'rating': None,
                    'host': host,
                    'quality': quality,
                    'direct': True
                }
                hoster['size'] = scraper_utils.format_size(
                    int(item['size']), 'B')
                hoster['extra'] = item['name']
                hosters.append(hoster)
        return hosters
    def get_sources(self, video):
        source_url = self.get_url(video)
        hosters = []
        if source_url and source_url != FORCE_NO_MATCH:
            url = urlparse.urljoin(self.base_url, source_url)
            html = self._http_get(url, cache_limit=.5)
            fragment = ''
            if video.video_type == VIDEO_TYPES.EPISODE:
                pattern = 'Season\s+%s\s+Serie\s+%s</h3>(.*?)</table>' % (video.season, video.episode)
                match = re.search(pattern, html, re.DOTALL)
                if match:
                    fragment = match.group(1)
            else:
                fragment = html

            if fragment:
                for match in re.finditer('data-width="([^"]+)"[^>]+>([^<]+)', fragment, re.DOTALL):
                    width, url = match.groups()
                    host = urlparse.urlsplit(url).hostname.replace('embed.', '')
                    url = url.replace('&amp;', '&')
                    hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': scraper_utils.width_get_quality(width), 'views': None, 'rating': None, 'url': url, 'direct': False}
                    hoster['quality'] = scraper_utils.get_quality(video, host, hoster['quality'])
                    hosters.append(hoster)
        return hosters