Added support for Sukebei at Nyaa.si
This commit is contained in:
@@ -3,6 +3,8 @@ from bs4 import BeautifulSoup
|
||||
from NyaaPy.utils import Utils as utils
|
||||
|
||||
class Nyaa:
|
||||
URI = "http://nyaa.si"
|
||||
|
||||
def search(keyword, **kwargs):
|
||||
category = kwargs.get('category', 0)
|
||||
subcategory = kwargs.get('subcategory', 0)
|
||||
@@ -10,9 +12,9 @@ class Nyaa:
|
||||
page = kwargs.get('page', 0)
|
||||
|
||||
if page > 0:
|
||||
r = requests.get("{}/?f={}&c={}_{}&q={}&p={}".format("http://nyaa.si", filters, category, subcategory, keyword, page))
|
||||
r = requests.get("{}/?f={}&c={}_{}&q={}&p={}".format(Nyaa.URI, filters, category, subcategory, keyword, page))
|
||||
else:
|
||||
r = requests.get("{}/?f={}&c={}_{}&q={}".format("http://nyaa.si", filters, category, subcategory, keyword))
|
||||
r = requests.get("{}/?f={}&c={}_{}&q={}".format(Nyaa.URI, filters, category, subcategory, keyword))
|
||||
|
||||
soup = BeautifulSoup(r.text, 'html.parser')
|
||||
rows = soup.select('table tr')
|
||||
@@ -20,20 +22,20 @@ class Nyaa:
|
||||
return utils.parse_nyaa(rows, limit=None)
|
||||
|
||||
def get(id):
|
||||
r = requests.get("http://nyaa.si/view/{}".format(id))
|
||||
r = requests.get("{}/view/{}".format(Nyaa.URI, id))
|
||||
soup = BeautifulSoup(r.text, 'html.parser')
|
||||
content = soup.findAll("div", { "class": "panel", "id": None})
|
||||
|
||||
return utils.parse_single(content)
|
||||
|
||||
def get_user(username):
|
||||
r = requests.get("http://nyaa.si/user/{}".format(username))
|
||||
r = requests.get("{}/user/{}".format(Nyaa.URI, username))
|
||||
soup = BeautifulSoup(r.text, 'html.parser')
|
||||
|
||||
return utils.parse_nyaa(soup.select('table tr'), limit=None)
|
||||
|
||||
def news(number_of_results):
|
||||
r = requests.get("http://nyaa.si/")
|
||||
r = requests.get(Nyaa.URI)
|
||||
soup = BeautifulSoup(r.text, 'html.parser')
|
||||
rows = soup.select('table tr')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user