From 2b9f90d86c1d693775e63a6242186eb526b3ba2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Salvador=20Piedra?= Date: Fri, 6 Oct 2017 20:35:24 +0200 Subject: [PATCH] Fixed #4 Need to apply the same fix to nyaa.pantsu --- NyaaPy/nyaa.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/NyaaPy/nyaa.py b/NyaaPy/nyaa.py index f27f708..5843968 100644 --- a/NyaaPy/nyaa.py +++ b/NyaaPy/nyaa.py @@ -4,13 +4,16 @@ import json import collections class Nyaa(): - def search(keyword): - nyaa_baseurl = "https://nyaa.si/?page=rss&c=1_0&f=0&q=" + def search(keyword, page): + if not page: + url = "https://nyaa.si/?page=rss&c=1_0&f=0&q={}".format(keyword) + else: + url = "https://nyaa.si/?page=rss&c=1_0&f=0&q={}&p={}".format(keyword, page) - request = requests.get(nyaa_baseurl + keyword) + request = requests.get(url) response = xmltodict.parse(request.text) - results = [] + results = [] try: if type(response['rss']['channel']['item']) is collections.OrderedDict: