Made few tests

This commit is contained in:
Ferenc Nánási
2020-01-22 19:07:38 +01:00
parent 95b967b940
commit bf01a922f0
3 changed files with 39 additions and 12 deletions

View File

@@ -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',