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 1/3] 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: From cbf478a73a605de9a8a2415ad8789fd80c9d325c Mon Sep 17 00:00:00 2001 From: dgrossman Date: Fri, 13 Oct 2017 14:50:02 -0700 Subject: [PATCH 2/3] update dict key: 'title' -> 'name' --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6d9937a..c86d58a 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,12 @@ Install it using pip. if len(nyaa_query) > 0: for result in nyaa_query: - print(result['title']) + print(result['name']) else: print('Nothing here!') for new in nyaa_news: - print(new['title]) + print(new['name]) ``` ## Methods From 9a072227cec9f5d162beb723bab40b0ef948bbea Mon Sep 17 00:00:00 2001 From: dgrossman Date: Fri, 13 Oct 2017 14:53:46 -0700 Subject: [PATCH 3/3] accidentially a ' --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c86d58a..04f3121 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Install it using pip. print('Nothing here!') for new in nyaa_news: - print(new['name]) + print(new['name']) ``` ## Methods