committed by
GitHub
parent
9cb2403b0c
commit
2b9f90d86c
@@ -4,13 +4,16 @@ import json
|
|||||||
import collections
|
import collections
|
||||||
|
|
||||||
class Nyaa():
|
class Nyaa():
|
||||||
def search(keyword):
|
def search(keyword, page):
|
||||||
nyaa_baseurl = "https://nyaa.si/?page=rss&c=1_0&f=0&q="
|
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)
|
response = xmltodict.parse(request.text)
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if type(response['rss']['channel']['item']) is collections.OrderedDict:
|
if type(response['rss']['channel']['item']) is collections.OrderedDict:
|
||||||
|
|||||||
Reference in New Issue
Block a user