diff --git a/LICENSE.md b/LICENSE.md index 3d4a186..af46a89 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright 2017 Juanjo Salvador +Copyright 2024 Juanjo Salvador Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/nyaapy/anime_site.py b/nyaapy/anime_site.py index e94acbd..7cd8844 100644 --- a/nyaapy/anime_site.py +++ b/nyaapy/anime_site.py @@ -2,6 +2,7 @@ import requests from nyaapy import torrent from nyaapy.parser import parse_nyaa, parse_single, parse_nyaa_rss + class AnimeTorrentSite: SITE = torrent.TorrentSite.NYAASI URL = "https://nyaa.si" diff --git a/nyaapy/magnet.py b/nyaapy/magnet.py index f89849b..f529b2f 100644 --- a/nyaapy/magnet.py +++ b/nyaapy/magnet.py @@ -1,6 +1,7 @@ import urllib from urllib.parse import urlencode + def magnet_builder(info_hash, title): """ Generates a magnet link using the info_hash and title of a given file. @@ -19,4 +20,4 @@ def magnet_builder(info_hash, title): for tracker in known_trackers: magnet_link += f"&{urlencode({'tr': tracker})}" - return magnet_link \ No newline at end of file + return magnet_link diff --git a/nyaapy/nyaasi/nyaa.py b/nyaapy/nyaasi/nyaa.py index 76c24ec..ccf5b01 100644 --- a/nyaapy/nyaasi/nyaa.py +++ b/nyaapy/nyaasi/nyaa.py @@ -4,4 +4,4 @@ from nyaapy.torrent import TorrentSite class Nyaa(AnimeTorrentSite): SITE = TorrentSite.NYAASI - URL = "https://nyaa.si" \ No newline at end of file + URL = "https://nyaa.si" diff --git a/nyaapy/nyaasi/sukebei.py b/nyaapy/nyaasi/sukebei.py index 7f63b77..68bf16f 100644 --- a/nyaapy/nyaasi/sukebei.py +++ b/nyaapy/nyaasi/sukebei.py @@ -1,6 +1,7 @@ from nyaapy.anime_site import AnimeTorrentSite from nyaapy.torrent import TorrentSite + class SukebeiNyaa(AnimeTorrentSite): SITE = TorrentSite.SUKEBEINYAASI - URL = "https://sukebei.nyaa.si" \ No newline at end of file + URL = "https://sukebei.nyaa.si" diff --git a/nyaapy/parser.py b/nyaapy/parser.py index 93ddb7f..836ec1e 100644 --- a/nyaapy/parser.py +++ b/nyaapy/parser.py @@ -2,6 +2,7 @@ from lxml import etree from nyaapy.magnet import magnet_builder from nyaapy.torrent import TorrentSite + def nyaa_categories(b): c = b.replace("?c=", "") cats = c.split("_") diff --git a/nyaapy/torrent.py b/nyaapy/torrent.py index a5af209..3aca6f3 100644 --- a/nyaapy/torrent.py +++ b/nyaapy/torrent.py @@ -12,12 +12,14 @@ def json_to_class(data): else: return Torrent(data) + # This deals with converting the dict to an object class Torrent(object): def __init__(self, my_dict): for key in my_dict: setattr(self, key, my_dict[key]) + class TorrentSite(Enum): """ Contains torrent sites @@ -25,5 +27,5 @@ class TorrentSite(Enum): NYAASI = "https://nyaa.si" SUKEBEINYAASI = "https://sukebei.nyaa.si" - - NYAALAND = "https://nyaa.land" \ No newline at end of file + + NYAALAND = "https://nyaa.land" diff --git a/tests/integration/test_nyaasi.py b/tests/integration/test_nyaasi.py index e05b2ff..2b477a4 100644 --- a/tests/integration/test_nyaasi.py +++ b/tests/integration/test_nyaasi.py @@ -1,6 +1,7 @@ from nyaapy.nyaasi.nyaa import Nyaa from nyaapy.torrent import Torrent + def test_nyaa_last_uploads(): request = Nyaa.last_uploads(number_of_results=10) torrent = request[0] @@ -17,7 +18,7 @@ def test_nyaa_search(): def test_nyaa_get_single(): - request = Nyaa.get(view_id='1847113') + request = Nyaa.get(view_id="1847113") assert isinstance(request, Torrent) == True @@ -27,4 +28,4 @@ def test_nyaa_get_from_user(): torrent = request[0] assert isinstance(torrent, Torrent) == True - assert len(request) <= 75 \ No newline at end of file + assert len(request) <= 75