def get_sources(self, video): source_url = self.get_url(video) hosters = [] norm_title = scraper_utils.normalize_title(video.title) if source_url and source_url != FORCE_NO_MATCH: source_url = urlparse.urljoin(self.base_url, source_url) for line in self._get_files(source_url, cache_limit=24): if not line['directory']: match = {} if video.video_type == VIDEO_TYPES.MOVIE: meta = scraper_utils.parse_movie_link(line['link']) if norm_title in scraper_utils.normalize_title(meta['title']): match = line elif self.__episode_match(line, video): match = line meta = scraper_utils.parse_episode_link(line['link']) if match: if meta['dubbed']: continue stream_url = match['url'] + '|User-Agent=%s' % (scraper_utils.get_ua()) stream_url = stream_url.replace(self.base_url, '') quality = scraper_utils.height_get_quality(meta['height']) hoster = {'multi-part': False, 'host': self._get_direct_hostname(stream_url), 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': True} if 'format' in meta: hoster['format'] = meta['format'] if 'size' in match: hoster['size'] = scraper_utils.format_size(int(match['size'])) 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 for stream in self.__get_videos(source_url, video): if video.video_type == VIDEO_TYPES.EPISODE and not scraper_utils.release_check( video, stream['name']): continue 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': stream['quality'], 'direct': True } if 'size' in stream: hoster['size'] = scraper_utils.format_size(stream['size']) if 'name' in stream: hoster['extra'] = stream['name'] hosters.append(hoster) return hosters
def get_sources(self, video): source_url = self.get_url(video) hosters = [] norm_title = scraper_utils.normalize_title(video.title) if source_url and source_url != FORCE_NO_MATCH: source_url = urlparse.urljoin(self.base_url2, source_url) for line in self._get_files(source_url, cache_limit=24): if not line['directory']: match = {} if video.video_type == VIDEO_TYPES.MOVIE: match_title, _match_year, height, extra = scraper_utils.parse_movie_link(line['link']) if norm_title in scraper_utils.normalize_title(match_title): match = line else: _show_title, season, episode, height, extra = scraper_utils.parse_episode_link(line['link']) if int(video.season) == int(season) and int(video.episode) == int(episode): match = line if 'dubbed' in extra.lower(): continue if match: stream_url = match['url'] + '|User-Agent=%s' % (scraper_utils.get_ua()) hoster = {'multi-part': False, 'host': self._get_direct_hostname(stream_url), 'class': self, 'quality': scraper_utils.height_get_quality(height), 'views': None, 'rating': None, 'url': stream_url, 'direct': True} if 'x265' in extra: hoster['format'] = 'x265' if 'size' in match: hoster['size'] = scraper_utils.format_size(int(match['size'])) hosters.append(hoster) return hosters
def get_sources(self, video): source_url = self.get_url(video) hosters = [] norm_title = scraper_utils.normalize_title(video.title) if source_url and source_url != FORCE_NO_MATCH: source_url = urlparse.urljoin(self.base_url, source_url) for line in self.__get_files(source_url, cache_limit=24): if not line['directory']: match = {} if video.video_type == VIDEO_TYPES.MOVIE: match_title, _match_year, height, extra = scraper_utils.parse_movie_link(line['link']) if norm_title in scraper_utils.normalize_title(match_title): match = line else: _show_title, season, episode, height, extra = scraper_utils.parse_episode_link(line['link']) if int(video.season) == int(season) and int(video.episode) == int(episode): match = line if 'dubbed' in extra.lower(): continue if match: stream_url = match['url'] + '|User-Agent=%s' % (scraper_utils.get_ua()) hoster = {'multi-part': False, 'host': self._get_direct_hostname(stream_url), 'class': self, 'quality': scraper_utils.height_get_quality(height), 'views': None, 'rating': None, 'url': stream_url, 'direct': True} if 'x265' in extra: hoster['format'] = 'x265' if 'size' in match: hoster['size'] = scraper_utils.format_size(int(match['size'])) hosters.append(hoster) return hosters
def __get_movie_sources(self, source_url): hosters = [] query = urlparse.parse_qs(urlparse.urlparse(source_url).query) if 'movie_id' in query: movie_id = query['movie_id'] else: movie_id = self.__get_movie_id(source_url) if movie_id: details_url = MOVIE_DETAILS_URL % (movie_id[0]) details_url = urlparse.urljoin(self.movie_base_url, details_url) detail_data = self._json_get(details_url, cache_limit=24) try: torrents = detail_data['data']['movie']['torrents'] except KeyError: torrents = [] try: hashes = [torrent['hash'].lower() for torrent in torrents] except KeyError: hashes = [] hash_data = self.__get_hash_data(hashes) for torrent in torrents: hash_id = torrent['hash'].lower() try: status = hash_data['hashes'][hash_id]['status'] except KeyError: status = '' if status.lower() == 'finished': stream_url = 'hash_id=%s' % (hash_id) host = self._get_direct_hostname(stream_url) quality = QUALITY_MAP.get(torrent['quality'], QUALITIES.HD720) hoster = {'multi-part': False, 'class': self, 'views': None, 'url': stream_url, 'rating': None, 'host': host, 'quality': quality, 'direct': True} if 'size_bytes' in torrent: hoster['size'] = scraper_utils.format_size(torrent['size_bytes'], 'B') if torrent['quality'] == '3D': hoster['3D'] = True 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: page_url = urlparse.urljoin(self.base_url, source_url) html = self._http_get(page_url, cache_limit=.25) for item in dom_parser.parse_dom(html, 'div', {'class': 'stream-table__row'}): stream_url = dom_parser.parse_dom(item, 'a', ret='href') match = re.search('Views:\s*(?:</span>)?\s*(\d+)', item, re.I) if match: views = match.group(1) else: views = None match = re.search('Size:\s*(?:</span>)?\s*(\d+)', item, re.I) if match: size = int(match.group(1)) * 1024 * 1024 else: size = None if stream_url: stream_url = stream_url[0] match = re.search('/redirect/(.*)', stream_url) if match: stream_url = base64.decodestring(urllib.unquote(match.group(1))) host = urlparse.urlparse(stream_url).hostname if host: quality = scraper_utils.get_quality(video, host, QUALITIES.HIGH) hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': views, 'rating': None, 'url': stream_url, 'direct': False} if size is not None: hoster['size'] = scraper_utils.format_size(size, 'B') hosters.append(hoster) return hosters
def get_sources(self, video): hosters = [] source_url = self.get_url(video) if source_url and source_url != FORCE_NO_MATCH: norm_title = scraper_utils.normalize_title(video.title) for stream in self.__get_videos(source_url, video): if video.video_type == VIDEO_TYPES.EPISODE and not self.__match_episode( video, norm_title, stream['name']): continue host = self._get_direct_hostname(stream['url']) hoster = { 'multi-part': False, 'class': self, 'views': None, 'url': stream['url'], 'rating': None, 'host': host, 'quality': stream['quality'], 'direct': True } if 'size' in stream: hoster['size'] = scraper_utils.format_size(stream['size']) if 'name' in stream: hoster['extra'] = stream['name'] hosters.append(hoster) return hosters
def get_sources(self, video): source_url = self.get_url(video) hosters = [] if not source_url or source_url == FORCE_NO_MATCH: return hosters page_url = scraper_utils.urljoin(self.base_url, source_url) html = self._http_get(page_url, cache_limit=1) for _attrs, item in dom_parser2.parse_dom(html, 'a', {'class': 'full-torrent1'}): stream_url = dom_parser2.parse_dom(item, 'span', req='onclick') host = dom_parser2.parse_dom(item, 'div', {'class': 'small_server'}) match = re.search('Views:\s*(?:</[^>]*>)?\s*(\d+)', item, re.I) views = match.group(1) if match else None match = re.search('Size:\s*(?:</[^>]*>)?\s*(\d+)', item, re.I) size = int(match.group(1)) * 1024 * 1024 if match else None if not stream_url or not host: continue stream_url = stream_url[0].attrs['onclick'] host = host[0].content.lower() host = host.replace('stream server: ', '') match = re.search("'(/redirect/[^']+)", stream_url) if match: stream_url = match.group(1) quality = scraper_utils.get_quality(video, host, QUALITIES.HIGH) hoster = {'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': views, 'rating': None, 'url': stream_url, 'direct': False} if size is not None: hoster['size'] = scraper_utils.format_size(size, 'B') hosters.append(hoster) return hosters
def get_sources(self, video): hosters = [] source_url = self.get_url(video) if source_url and source_url != FORCE_NO_MATCH: query = urlparse.parse_qs(source_url) if 'hash' in query: data = {'hash': query['hash'][0]} url = urlparse.urljoin(self.base_url, '/torrent/browse') js_data = self._http_get(url, data=data, cache_limit=1) if 'data' in js_data and 'content' in js_data['data']: videos = self.__get_videos(js_data['data']['content'], video) for video in videos: host = self._get_direct_hostname(video['url']) hoster = { 'multi-part': False, 'class': self, 'views': None, 'url': video['url'], 'rating': None, 'host': host, 'quality': video['quality'], 'direct': True } if 'size' in video: hoster['size'] = scraper_utils.format_size( video['size']) if 'name' in video: hoster['extra'] = video['name'] 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
def __get_videos(self, content): videos = [] for key in content: item = content[key] if item['type'].lower() == 'dir': videos += self.__get_videos(item['children']) else: if item['ext'].upper() in VIDEO_EXT: label = '(%s) %s' % (scraper_utils.format_size(item['size'], 'B'), item['name']) video = {'label': label, 'url': item['url']} videos.append(video) if 'transcoded' in item and item['transcoded']: transcode = item['transcoded'] if 'size' in transcode: label = '(%s) (Transcode) %s' % (scraper_utils.format_size(transcode['size'], 'B'), item['name']) else: label = '(Transcode) %s' % (item['name']) video = {'label': label, 'url': transcode['url']} videos.append(video) return videos
def __get_videos(self, content): videos = [] for key in content: item = content[key] if item['type'].lower() == 'dir': videos += self.__get_videos(item['children']) else: if item['ext'].upper() in VIDEO_EXT: label = '(%s) %s' % (scraper_utils.format_size( item['size'], 'B'), item['name']) video = {'label': label, 'url': item['url']} videos.append(video) if 'transcoded' in item and item['transcoded']: transcode = item['transcoded'] if 'size' in transcode: label = '(%s) (Transcode) %s' % ( scraper_utils.format_size( transcode['size'], 'B'), item['name']) else: label = '(Transcode) %s' % (item['name']) video = {'label': label, 'url': transcode['url']} videos.append(video) return videos
def get_sources(self, video): hosters = [] source_url = self.get_url(video) if not source_url or source_url == FORCE_NO_MATCH: return hosters headers = { 'User-Agent': scraper_utils.get_ua(), 'Referer': self.base_url + source_url } if video.video_type == VIDEO_TYPES.MOVIE: meta = scraper_utils.parse_movie_link(source_url) stream_url = source_url + scraper_utils.append_headers(headers) quality = scraper_utils.height_get_quality(meta['height']) hoster = { 'multi-part': False, 'host': scraper_utils.get_direct_hostname(self, stream_url), 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': True } if 'format' in meta: hoster['format'] = meta['format'] hosters.append(hoster) else: for episode in self.__match_episode(source_url, video): meta = scraper_utils.parse_episode_link(episode['title']) stream_url = episode['url'] + scraper_utils.append_headers( headers) stream_url = stream_url.replace(self.base_url, '') quality = scraper_utils.height_get_quality(meta['height']) hoster = { 'multi-part': False, 'host': scraper_utils.get_direct_hostname(self, stream_url), 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': True } if 'format' in meta: hoster['format'] = meta['format'] if 'size' in episode: hoster['size'] = scraper_utils.format_size( int(episode['size'])) 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 for stream in self.__get_videos(source_url, video): if video.video_type == VIDEO_TYPES.EPISODE and not scraper_utils.release_check(video, stream['name']): continue 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': stream['quality'], 'direct': True} if 'size' in stream: hoster['size'] = scraper_utils.format_size(stream['size']) if 'name' in stream: hoster['extra'] = stream['name'] hosters.append(hoster) return hosters
def __get_movie_sources(self, source_url): hosters = [] query = urlparse.parse_qs(urlparse.urlparse(source_url).query) if 'movie_id' in query: movie_id = query['movie_id'] else: movie_id = self.__get_movie_id(source_url) if movie_id: details_url = MOVIE_DETAILS_URL % (movie_id[0]) details_url = urlparse.urljoin(self.movie_base_url, details_url) detail_data = self._json_get(details_url, cache_limit=24) try: torrents = detail_data['data']['movie']['torrents'] except KeyError: torrents = [] try: hashes = [torrent['hash'].lower() for torrent in torrents] except KeyError: hashes = [] hash_data = self.__get_hash_data(hashes) for torrent in torrents: hash_id = torrent['hash'].lower() try: status = hash_data['hashes'][hash_id]['status'] except KeyError: status = '' if status.lower() == 'finished': stream_url = 'hash_id=%s' % (hash_id) host = self._get_direct_hostname(stream_url) quality = QUALITY_MAP.get(torrent['quality'], QUALITIES.HD720) hoster = { 'multi-part': False, 'class': self, 'views': None, 'url': stream_url, 'rating': None, 'host': host, 'quality': quality, 'direct': True } if 'size_bytes' in torrent: hoster['size'] = scraper_utils.format_size( torrent['size_bytes'], 'B') if torrent['quality'] == '3D': hoster['3D'] = True hosters.append(hoster) return hosters
def get_sources(self, video): hosters = [] source_url = self.get_url(video) if source_url and source_url != FORCE_NO_MATCH: norm_title = scraper_utils.normalize_title(video.title) for stream in self.__get_videos(source_url, video): if video.video_type == VIDEO_TYPES.EPISODE and not self.__match_episode(video, norm_title, stream['name'], 'dummy'): continue host = self._get_direct_hostname(stream['url']) hoster = {'multi-part': False, 'class': self, 'views': None, 'url': stream['url'], 'rating': None, 'host': host, 'quality': stream['quality'], 'direct': True} if 'size' in stream: hoster['size'] = scraper_utils.format_size(stream['size']) if 'name' in stream: hoster['extra'] = stream['name'] hosters.append(hoster) return hosters
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_sources(self, video): hosters = [] source_url = self.get_url(video) if source_url and source_url != FORCE_NO_MATCH: if video.video_type == VIDEO_TYPES.MOVIE: _title, _year, height, extra = scraper_utils.parse_movie_link( source_url) stream_url = self.base_url + source_url + '|User-Agent=%s' % ( scraper_utils.get_ua()) hoster = { 'multi-part': False, 'host': self._get_direct_hostname(stream_url), 'class': self, 'quality': scraper_utils.height_get_quality(height), 'views': None, 'rating': None, 'url': stream_url, 'direct': True } if 'x265' in extra: hoster['format'] = 'x265' hosters.append(hoster) else: for episode in self.__match_episode(source_url, video): _show_title, _season, _episode, height, extra = scraper_utils.parse_episode_link( episode['title']) stream_url = urlparse.urljoin( self.base_url, episode['url']) + '|User-Agent=%s' % ( scraper_utils.get_ua()) hoster = { 'multi-part': False, 'host': self._get_direct_hostname(stream_url), 'class': self, 'quality': scraper_utils.height_get_quality(height), 'views': None, 'rating': None, 'url': stream_url, 'direct': True } if 'x265' in extra: hoster['format'] = 'x265' if 'size' in episode: hoster['size'] = scraper_utils.format_size( int(episode['size'])) 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: page_url = urlparse.urljoin(self.base_url, source_url) html = self._http_get(page_url, cache_limit=.25) for item in dom_parser.parse_dom(html, 'div', {'class': 'stream-table__row'}): stream_url = dom_parser.parse_dom(item, 'a', ret='href') match = re.search('<span[^>]*>\s*Views:\s*</span>\s*(\d+)', item, re.I) if match: views = match.group(1) else: views = None match = re.search('<span[^>]*>\s*Size:\s*</span>\s*(\d+)', item, re.I) if match: size = int(match.group(1)) * 1024 * 1024 else: size = None if stream_url: stream_url = stream_url[0] if 'webtracker' in stream_url: continue host = urlparse.urlparse(stream_url).hostname quality = scraper_utils.get_quality( video, host, QUALITIES.HIGH) hoster = { 'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': views, 'rating': None, 'url': stream_url, 'direct': False } if size is not None: hoster['size'] = scraper_utils.format_size(size, 'B') hosters.append(hoster) return hosters
def get_sources(self, video): hosters = [] source_url = self.get_url(video) if source_url and source_url != FORCE_NO_MATCH: if video.video_type == VIDEO_TYPES.MOVIE: _title, _year, height, extra = scraper_utils.parse_movie_link(source_url) stream_url = self.base_url + source_url + '|User-Agent=%s' % (scraper_utils.get_ua()) hoster = {'multi-part': False, 'host': self._get_direct_hostname(stream_url), 'class': self, 'quality': scraper_utils.height_get_quality(height), 'views': None, 'rating': None, 'url': stream_url, 'direct': True} if 'x265' in extra: hoster['format'] = 'x265' hosters.append(hoster) else: for episode in self.__match_episode(source_url, video): _show_title, _season, _episode, height, extra = scraper_utils.parse_episode_link(episode['title']) stream_url = urlparse.urljoin(self.base_url, episode['url']) + '|User-Agent=%s' % (scraper_utils.get_ua()) hoster = {'multi-part': False, 'host': self._get_direct_hostname(stream_url), 'class': self, 'quality': scraper_utils.height_get_quality(height), 'views': None, 'rating': None, 'url': stream_url, 'direct': True} if 'x265' in extra: hoster['format'] = 'x265' if 'size' in episode: hoster['size'] = scraper_utils.format_size(int(episode['size'])) hosters.append(hoster) return hosters
def get_sources(self, video): hosters = [] source_url = self.get_url(video) if source_url and source_url != FORCE_NO_MATCH: query = urlparse.parse_qs(source_url) if 'hash' in query: data = {'hash': query['hash'][0]} url = urlparse.urljoin(self.base_url, '/torrent/browse') js_data = self._http_get(url, data=data, cache_limit=1) if 'data' in js_data and 'content' in js_data['data']: videos = self.__get_videos(js_data['data']['content'], video) for video in videos: host = self._get_direct_hostname(video['url']) hoster = {'multi-part': False, 'class': self, 'views': None, 'url': video['url'], 'rating': None, 'host': host, 'quality': video['quality'], 'direct': True} if 'size' in video: hoster['size'] = scraper_utils.format_size(video['size']) if 'name' in video: hoster['extra'] = video['name'] hosters.append(hoster) return hosters
def get_sources(self, video): source_url = self.get_url(video) hosters = [] norm_title = scraper_utils.normalize_title(video.title) if source_url and source_url != FORCE_NO_MATCH: source_url = urlparse.urljoin(self.base_url, source_url) for line in self.__get_files(source_url, cache_limit=24): if not line["directory"]: match = {} if video.video_type == VIDEO_TYPES.MOVIE: match_title, _match_year, height, extra = scraper_utils.parse_movie_link(line["link"]) if norm_title in scraper_utils.normalize_title(match_title): match = line else: _show_title, season, episode, height, extra = scraper_utils.parse_episode_link(line["link"]) if int(video.season) == int(season) and int(video.episode) == int(episode): match = line if "dubbed" in extra.lower(): continue if match: stream_url = match["url"] + "|User-Agent=%s" % (scraper_utils.get_ua()) hoster = { "multi-part": False, "host": self._get_direct_hostname(stream_url), "class": self, "quality": scraper_utils.height_get_quality(height), "views": None, "rating": None, "url": stream_url, "direct": True, } if "x265" in extra: hoster["format"] = "x265" if "size" in match: hoster["size"] = scraper_utils.format_size(int(match["size"])) hosters.append(hoster) return hosters
def get_sources(self, video): hosters = [] source_url = self.get_url(video) if source_url and source_url != FORCE_NO_MATCH: if video.video_type == VIDEO_TYPES.MOVIE: meta = scraper_utils.parse_movie_link(source_url) stream_url = source_url + '|User-Agent=%s' % (scraper_utils.get_ua()) quality = scraper_utils.height_get_quality(meta['height']) hoster = {'multi-part': False, 'host': self._get_direct_hostname(stream_url), 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': True} if 'format' in meta: hoster['format'] = meta['format'] hosters.append(hoster) else: for episode in self.__match_episode(source_url, video): meta = scraper_utils.parse_episode_link(episode['title']) stream_url = episode['url'] + '|User-Agent=%s' % (scraper_utils.get_ua()) stream_url = stream_url.replace(self.base_url, '') quality = scraper_utils.height_get_quality(meta['height']) hoster = {'multi-part': False, 'host': self._get_direct_hostname(stream_url), 'class': self, 'quality': quality, 'views': None, 'rating': None, 'url': stream_url, 'direct': True} if 'format' in meta: hoster['format'] = meta['format'] if 'size' in episode: hoster['size'] = scraper_utils.format_size(int(episode['size'])) 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: page_url = urlparse.urljoin(self.base_url, source_url) html = self._http_get(page_url, cache_limit=1) for item in dom_parser.parse_dom(html, "a", {"class": "full-torrent1"}): stream_url = dom_parser.parse_dom(item, "span", ret="onclick") host = dom_parser.parse_dom(item, "div", {"class": "small_server"}) match = re.search("Views:\s*(?:</[^>]*>)?\s*(\d+)", item, re.I) views = match.group(1) if match else None match = re.search("Size:\s*(?:</[^>]*>)?\s*(\d+)", item, re.I) size = int(match.group(1)) * 1024 * 1024 if match else None if stream_url and host: stream_url = stream_url[0] host = host[0].lower() host = host.replace("stream server: ", "") match = re.search("'(/redirect/[^']+)", stream_url) if match: stream_url = match.group(1) quality = scraper_utils.get_quality(video, host, QUALITIES.HIGH) hoster = { "multi-part": False, "host": host, "class": self, "quality": quality, "views": views, "rating": None, "url": stream_url, "direct": False, } if size is not None: hoster["size"] = scraper_utils.format_size(size, "B") hosters.append(hoster) return hosters
def get_sources(self, video): source_url = self.get_url(video) hosters = [] if not source_url or source_url == FORCE_NO_MATCH: return hosters page_url = scraper_utils.urljoin(self.base_url, source_url) html = self._http_get(page_url, cache_limit=1) for _attrs, item in dom_parser2.parse_dom(html, 'a', {'class': 'full-torrent1'}): stream_url = dom_parser2.parse_dom(item, 'span', req='onclick') host = dom_parser2.parse_dom(item, 'div', {'class': 'small_server'}) match = re.search('Views:\s*(?:</[^>]*>)?\s*(\d+)', item, re.I) views = match.group(1) if match else None match = re.search('Size:\s*(?:</[^>]*>)?\s*(\d+)', item, re.I) size = int(match.group(1)) * 1024 * 1024 if match else None if not stream_url or not host: continue stream_url = stream_url[0].attrs['onclick'] host = host[0].content.lower() host = host.replace('stream server: ', '') match = re.search("'(/redirect/[^']+)", stream_url) if match: stream_url = match.group(1) quality = scraper_utils.get_quality(video, host, QUALITIES.HIGH) hoster = { 'multi-part': False, 'host': host, 'class': self, 'quality': quality, 'views': views, 'rating': None, 'url': stream_url, 'direct': False } if size is not None: hoster['size'] = scraper_utils.format_size(size, 'B') 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 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