-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nyaasi): add static classes instead of object-based ones
- Loading branch information
1 parent
bbd129c
commit 2c3d3ea
Showing
13 changed files
with
346 additions
and
527 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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. | ||
""" | ||
known_trackers = [ | ||
"http://nyaa.tracker.wf:7777/announce", | ||
"udp://open.stealth.si:80/announce", | ||
"udp://tracker.opentrackr.org:1337/announce", | ||
"udp://exodus.desync.com:6969/announce", | ||
"udp://tracker.torrent.eu.org:451/announce", | ||
] | ||
|
||
magnet_link = f"magnet:?xt=urn:btih:{info_hash}&" + urlencode( | ||
{"dn": title}, quote_via=urllib.parse.quote | ||
) | ||
for tracker in known_trackers: | ||
magnet_link += f"&{urlencode({'tr': tracker})}" | ||
|
||
return magnet_link |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from nyaapy.anime_site import AnimeTorrentSite | ||
from nyaapy.torrent import TorrentSite | ||
|
||
|
||
class Nyaa(AnimeTorrentSite): | ||
SITE = TorrentSite.NYAASI | ||
URL = "https://nyaa.si" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from nyaapy.anime_site import AnimeTorrentSite | ||
from nyaapy.torrent import TorrentSite | ||
|
||
class SukebeiNyaa(AnimeTorrentSite): | ||
SITE = TorrentSite.SUKEBEINYAASI | ||
URL = "https://sukebei.nyaa.si" |
Oops, something went wrong.