def last_uploads(self, number_of_results): r = requests.get(self.SITE.value) r.raise_for_status() return utils.parse_nyaa(r.text, limit=number_of_results + 1, site=self.SITE)
def search(self, keyword, **kwargs): url = self.URL user = kwargs.get('user', None) category = kwargs.get('category', 0) subcategory = kwargs.get('subcategory', 0) filters = kwargs.get('filters', 0) page = kwargs.get('page', 0) if user: user_uri = f"user/{user}" else: user_uri = "" if page > 0: r = requests.get("{}/{}?f={}&c={}_{}&q={}&p={}".format( url, user_uri, filters, category, subcategory, keyword, page)) else: r = requests.get("{}/{}?f={}&c={}_{}&q={}".format( url, user_uri, filters, category, subcategory, keyword)) r.raise_for_status() json_data = utils.parse_nyaa(request_text=r.text, limit=None, site=self.SITE) return torrent.json_to_class(json_data)
def get_user(self, username): r = requests.get(f'{self.URL}/user/{username}') r.raise_for_status() json_data = utils.parse_nyaa(request_text=r.text, limit=None, site=self.SITE) return torrent.json_to_class(json_data)
def last_uploads(self, number_of_results): r = requests.get(self.SITE.value) r.raise_for_status() with open("test.html", "w") as f: f.write(r.text) return utils.parse_nyaa(request_text=r.text, limit=number_of_results + 1, site=self.SITE)
def last_uploads(self, number_of_results): r = requests.get(self.URL) # If anything up with nyaa servers let the user know. r.raise_for_status() json_data = utils.parse_nyaa(request_text=r.text, limit=number_of_results + 1, site=self.SITE) return torrent.json_to_class(json_data)
def search(self, keyword, **kwargs): uri = self.SITE.value category = kwargs.get('category', 0) subcategory = kwargs.get('subcategory', 0) filters = kwargs.get('filters', 0) page = kwargs.get('page', 0) if page > 0: r = requests.get("{}/?f={}&c={}_{}&q={}&p={}".format( uri, filters, category, subcategory, keyword, page)) else: r = requests.get("{}/?f={}&c={}_{}&q={}".format( uri, filters, category, subcategory, keyword)) r.raise_for_status() return utils.parse_nyaa(r.text, limit=None, site=self.SITE)
def search(self, keyword, **kwargs): category = kwargs.get('category', 0) subcategory = kwargs.get('subcategory', 0) filters = kwargs.get('filters', 0) page = kwargs.get('page', 0) if page > 0: r = requests.get("{}/?f={}&c={}_{}&q={}&p={}".format( "http://sukebei.nyaa.si", filters, category, subcategory, keyword, page)) else: r = requests.get("{}/?f={}&c={}_{}&q={}".format( "http://sukebei.nyaa.si", filters, category, subcategory, keyword)) soup = BeautifulSoup(r.text, 'html.parser') rows = soup.select('table tr') return utils.parse_nyaa(rows, limit=None)
def search(self, keyword, **kwargs): user = kwargs.get('user', None) category = kwargs.get('category', 0) subcategory = kwargs.get('subcategory', 0) filters = kwargs.get('filters', 0) page = kwargs.get('page', 0) if user: user_uri = "user/{}".format(user) else: user_uri = "" if page > 0: r = requests.get("{}/{}?f={}&c={}_{}&q={}&p={}".format( self.URI, user_uri, filters, category, subcategory, keyword, page)) else: r = requests.get("{}/{}?f={}&c={}_{}&q={}".format( self.URI, user_uri, filters, category, subcategory, keyword)) soup = BeautifulSoup(r.text, 'html.parser') rows = soup.select('table tr') return utils.parse_nyaa(rows, limit=None)
def get_user(self, username): r = requests.get("http://sukebei.nyaa.si/user/{}".format(username)) soup = BeautifulSoup(r.text, 'html.parser') return utils.parse_nyaa(soup.select('table tr'), limit=None)
def get_user(self, username): r = requests.get("{}/user/{}".format(self.URI, username)) soup = BeautifulSoup(r.text, 'html.parser') return utils.parse_nyaa(soup.select('table tr'), limit=None)
def last_uploads(self, number_of_results): r = requests.get(self.URI) soup = BeautifulSoup(r.text, 'html.parser') rows = soup.select('table tr') return utils.parse_nyaa(table_rows=rows, limit=number_of_results + 1)
def get_user(self, username): r = requests.get("{}/user/{}".format(self.SITE.value, username)) r.raise_for_status() return utils.parse_nyaa(r.text, limit=None, site=self.SITE)