simple search added to nyaa.pantsu.cat

This commit is contained in:
JuanjoSalvador
2017-10-14 13:00:24 +02:00
parent 00f1c4ee7f
commit 76f48b6cda

View File

@@ -5,13 +5,14 @@ from NyaaPy.utils import Utils as utils
class NyaaPantsu(): class NyaaPantsu():
''' '''
Return a list of dicts with the results of the query. Simple search.
Return a list of dicts with the results of the query.
''' '''
def search(keyword, category, subcategory, filters, page): def search(keyword, category, subcategory, filters, page):
if page > 0: if page > 0:
r = requests.get("http://nyaa.pantsu.cat/?f={}&c={}_{}&q={}&p={}".format(filters, category, subcategory, keyword, page)) r = requests.get("http://nyaa.pantsu.cat/search/{}?c={}_{}&q={}".format(page, category, subcategory, keyword))
else: else:
r = requests.get("http://nyaa.pantsu.cat/?f={}&c={}_{}&q={}".format(filters, category, subcategory, keyword)) r = requests.get("http://nyaa.pantsu.cat/search/?c={}_{}&q={}".format(category, subcategory, keyword))
soup = BeautifulSoup(r.text, 'html.parser') soup = BeautifulSoup(r.text, 'html.parser')
rows = soup.select('table tr') rows = soup.select('table tr')