def browse(self, category, page=1): category = category.upper() if category.lower() in [ 'xxx', 'tv' ] else category.capitalize() url = f'{self.baseUrl}/cat/{category}/{page}/' response = self.requests.get(url, headers=self.headers) return parser.torrentParser(response, baseUrl=self.baseUrl, page=page)
def top(self, category=None): category = 'applications' if category and category.lower( ) == 'apps' else 'television' if category and category.lower( ) == 'tv' else category.lower() if category else None url = f"{self.baseUrl}/top-100{'-'+category if category else ''}" response = self.requests.get(url, headers=self.headers) return parser.torrentParser(response, baseUrl=self.baseUrl)
def search(self, query, page=1, category=None, sortBy=None, order='desc'): query = '+'.join(query.split()) category = category.upper() if category and category.lower() in [ 'xxx', 'tv' ] else category.capitalize() if category else None url = f"{self.baseUrl}/{'sort-' if sortBy else ''}{'category-' if category else ''}search/{query}/{category+'/' if category else ''}{sortBy.lower()+'/' if sortBy else ''}{order.lower()+'/' if sortBy else ''}{page}/" response = self.requests.get(url, headers=self.headers) return parser.torrentParser(response, baseUrl=self.baseUrl, page=page)
def popular(self, category, week=False): url = f"{self.baseUrl}/popular-{category.lower()}{'-week' if week else ''}" response = self.requests.get(url, headers=self.headers) return parser.torrentParser(response, baseUrl=self.baseUrl)
def trending(self, category=None, week=False): url = f"{self.baseUrl}/trending{'-week' if week and not category else ''}{'/w/'+category.lower()+'/' if week and category else '/d/'+category.lower()+'/' if not week and category else ''}" response = self.requests.get(url, headers=self.headers) return parser.torrentParser(response, baseUrl=self.baseUrl)