Made few tests
This commit is contained in:
@@ -46,13 +46,11 @@ class Nyaa:
|
||||
def get(self, id):
|
||||
r = requests.get("{}/view/{}".format(self.URI, id))
|
||||
r.raise_for_status()
|
||||
# ! Description not working TODO
|
||||
# with open("test.html", "w") as f:
|
||||
# f.write(r.text)
|
||||
|
||||
return utils.parse_single(request_text=r.text)
|
||||
|
||||
def get_user(self, username):
|
||||
r = requests.get("{}/user/{}".format(self.URI, username))
|
||||
soup = BeautifulSoup(r.text, 'html.parser')
|
||||
r.raise_for_status()
|
||||
|
||||
return utils.parse_nyaa(soup.select('table tr'), limit=None)
|
||||
return utils.parse_nyaa(request_text=r.text, limit=None)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import re
|
||||
from lxml import etree
|
||||
from pprint import pprint
|
||||
|
||||
|
||||
def nyaa_categories(b):
|
||||
|
||||
@@ -1,22 +1,52 @@
|
||||
from NyaaPy import Pantsu, Nyaa
|
||||
from pprint import pprint
|
||||
from datetime import datetime
|
||||
|
||||
# pantsu = Pantsu()
|
||||
nyaa = Nyaa()
|
||||
|
||||
# Get fresh torrents
|
||||
print("Latest torrents:")
|
||||
latest_torrents = rnyaa.last_uploads(5)
|
||||
dt_latest_torrents_begin = datetime.now()
|
||||
latest_torrents = nyaa.last_uploads(100)
|
||||
dt_latest_torrents_end = datetime.now()
|
||||
|
||||
# I'd like to watch Tenki no ko, but not uploaded yet.
|
||||
print("Search results for Kimi no Na wa:")
|
||||
dt_search_begin = datetime.now()
|
||||
test_search = nyaa.search("Kimi no Na wa")
|
||||
pprint(test_search)
|
||||
dt_search_end = datetime.now()
|
||||
# pprint(test_search)
|
||||
|
||||
# Get first torrent from found torrents
|
||||
print("First result torrent info:")
|
||||
# print("First result torrent info:")
|
||||
dt_single_torrent_begin = datetime.now()
|
||||
single_torrent = nyaa.get(test_search[0]["id"])
|
||||
pprint(single_torrent)
|
||||
dt_single_torrent_end = datetime.now()
|
||||
#pprint(single_torrent)
|
||||
|
||||
dt_user_begin = datetime.now()
|
||||
user_torrents = nyaa.get_user("Lilith-Raws")
|
||||
dt_user_end = datetime.now()
|
||||
#pprint(user_torrents)
|
||||
|
||||
print(
|
||||
"Latest torrents time:",
|
||||
(dt_latest_torrents_end - dt_latest_torrents_begin).microseconds / 1000,
|
||||
"msec")
|
||||
print(
|
||||
"Test search time:",
|
||||
(dt_search_end - dt_search_begin).microseconds/ 1000,
|
||||
"msec"
|
||||
)
|
||||
print(
|
||||
"Single torrent time:",
|
||||
(dt_single_torrent_end - dt_single_torrent_begin).microseconds / 1000,
|
||||
"msec"
|
||||
)
|
||||
print(
|
||||
"Single user time:",
|
||||
(dt_user_end - dt_user_begin ).microseconds / 1000,
|
||||
"msec"
|
||||
)
|
||||
|
||||
"""
|
||||
print(pantsu.search(keyword='koe no katachi',
|
||||
|
||||
Reference in New Issue
Block a user