diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..f967aa5 --- /dev/null +++ b/404.html @@ -0,0 +1,460 @@ + + + +
+ + + + + + + + + + + + + + + + + + +
Nyaa
+
+
+Nyaa client.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
base_url |
+
+ str
+ |
+
+
+
+ The base URL of Nyaa. Default is |
+
+ 'https://nyaa.si/'
+ |
+
kwargs |
+
+ Any
+ |
+
+
+
+ Keyword arguments to pass to the underlying |
+
+ {}
+ |
+
src/pynyaa/_clients/_sync.py
base_url
+
+
+
+ property
+
+
+base_url: str
+
This is the base URL, used for constructing the full URL from relative URLs.
+
get
+
+
+get(page: int | str) -> NyaaTorrentPage
+
Retrieve information from a Nyaa torrent page.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
page |
+
+ int or str
+ |
+
+
+
+ The torrent page.
+This can either be a URL like |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ HTTPStatusError
+ |
+
+
+
+ Nyaa returned a non 2xx response. + |
+
Returns:
+Type | +Description | +
---|---|
+ NyaaTorrentPage
+ |
+
+
+
+ A NyaaTorrentPage object representing the retrieved data. + |
+
src/pynyaa/_clients/_sync.py
search
+
+
+search(query: str, *, category: Category = Category.ALL, filter: Filter = Filter.NO_FILTER, sort_by: SortBy = SortBy.DATETIME, reverse: bool = False) -> Generator[NyaaTorrentPage]
+
Search for torrents on Nyaa.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
query |
+
+ str
+ |
+
+
+
+ The search query. + |
+ + required + | +
category |
+
+ Category
+ |
+
+
+
+ The category to narrow down the search results. + |
+
+ ALL
+ |
+
filter |
+
+ Filter
+ |
+
+
+
+ Specifies the filter to apply to the search results. + |
+
+ NO_FILTER
+ |
+
sort_by |
+
+ SortBy
+ |
+
+
+
+ Defines how to sort the results. + |
+
+ DATETIME
+ |
+
reverse |
+
+ bool
+ |
+
+
+
+ Determines the order of the results: ascending if True, descending if False. + |
+
+ False
+ |
+
Raises:
+Type | +Description | +
---|---|
+ HTTPStatusError
+ |
+
+
+
+ Nyaa returned a non 2xx response. + |
+
Yields:
+Type | +Description | +
---|---|
+ NyaaTorrentPage
+ |
+
+
+
+ A NyaaTorrentPage object representing the retrieved data. + |
+
src/pynyaa/_clients/_sync.py
AsyncNyaa
+
+
+Async Nyaa client.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
base_url |
+
+ str
+ |
+
+
+
+ The base URL of Nyaa. Default is |
+
+ 'https://nyaa.si/'
+ |
+
kwargs |
+
+ Any
+ |
+
+
+
+ Keyword arguments to pass to the underlying |
+
+ {}
+ |
+
src/pynyaa/_clients/_async.py
base_url
+
+
+
+ property
+
+
+base_url: str
+
This is the base URL, used for constructing the full URL from relative URLs.
+
get
+
+
+
+ async
+
+
+get(page: int | str) -> NyaaTorrentPage
+
Retrieve information from a Nyaa torrent page.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
page |
+
+ int or str
+ |
+
+
+
+ The torrent page.
+This can either be a URL like |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ HTTPStatusError
+ |
+
+
+
+ Nyaa returned a non 2xx response. + |
+
Returns:
+Type | +Description | +
---|---|
+ NyaaTorrentPage
+ |
+
+
+
+ A NyaaTorrentPage object representing the retrieved data. + |
+
src/pynyaa/_clients/_async.py
search
+
+
+
+ async
+
+
+search(query: str, *, category: Category = Category.ALL, filter: Filter = Filter.NO_FILTER, sort_by: SortBy = SortBy.DATETIME, reverse: bool = False) -> AsyncGenerator[NyaaTorrentPage]
+
Search for torrents on Nyaa.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
query |
+
+ str
+ |
+
+
+
+ The search query. + |
+ + required + | +
category |
+
+ Category
+ |
+
+
+
+ The category to narrow down the search results. + |
+
+ ALL
+ |
+
filter |
+
+ Filter
+ |
+
+
+
+ Specifies the filter to apply to the search results. + |
+
+ NO_FILTER
+ |
+
sort_by |
+
+ SortBy
+ |
+
+
+
+ Defines how to sort the results. + |
+
+ DATETIME
+ |
+
reverse |
+
+ bool
+ |
+
+
+
+ Determines the order of the results: ascending if True, descending if False. + |
+
+ False
+ |
+
Raises:
+Type | +Description | +
---|---|
+ HTTPStatusError
+ |
+
+
+
+ Nyaa returned a non 2xx response. + |
+
Yields:
+Type | +Description | +
---|---|
+ NyaaTorrentPage
+ |
+
+
+
+ A NyaaTorrentPage object representing the retrieved data. + |
+
src/pynyaa/_clients/_async.py
Category
+
+
+
+ Bases: BaseStrEnum
Nyaa categories
+ + + + +
ANIME_ENGLISH_TRANSLATED
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
ANIME_MUSIC_VIDEO
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
ANIME_NON_ENGLISH_TRANSLATED
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
ANIME_RAW
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
AUDIO_LOSSLESS
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
AUDIO_LOSSY
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
LITERATURE
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
LITERATURE_ENGLISH_TRANSLATED
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
LITERATURE_NON_ENGLISH_TRANSLATED
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
LITERATURE_RAW
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
LIVE_ACTION
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
LIVE_ACTION_ENGLISH_TRANSLATED
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
LIVE_ACTION_IDOL_PROMOTIONAL_VIDEO
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
LIVE_ACTION_NON_ENGLISH_TRANSLATED
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
LIVE_ACTION_RAW
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
PICTURES
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
PICTURES_GRAPHICS
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
PICTURES_PHOTOS
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
SOFTWARE
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
SOFTWARE_APPLICATIONS
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
SOFTWARE_GAMES
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
id
+
+
+
+ property
+
+
+id: CategoryID
+
Returns the ID of the category.
+This ID corresponds to the category as seen in the URL
+https://nyaa.si/?f=0&c=1_2&q=
, where c=1_2
is the ID for Anime - English-translated
.
parent
+
+
+
+ property
+
+
+
get
+
+
+
+ classmethod
+
+
+get(key: CategoryLiteral | str, default: CategoryLiteral | str = 'ALL') -> Self
+
Get the Category
by its name or value (case-insensitive).
+Return the default if the key is missing or invalid.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
key |
+
+ CategoryLiteral | str
+ |
+
+
+
+ The key to retrieve. + |
+ + required + | +
default |
+
+ CategoryLiteral | str
+ |
+
+
+
+ The default value to return if the key is missing or invalid. + |
+
+ 'ALL'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Category
+ |
+
+
+
+ The |
+
src/pynyaa/_enums.py
SortBy
+
+
+
+ Bases: BaseStrEnum
COMMENTS
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
DOWNLOADS
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
LEECHERS
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
SEEDERS
+
+
+
+ class-attribute
+ instance-attribute
+
+
+
get
+
+
+
+ classmethod
+
+
+get(key: SortByLiteral | str, default: SortByLiteral | str = 'datetime') -> Self
+
Get the SortBy
by its name or value (case-insensitive).
+Return the default if the key is missing or invalid.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
key |
+
+ SortByLiteral | str
+ |
+
+
+
+ The key to retrieve. + |
+ + required + | +
default |
+
+ SortByLiteral | str
+ |
+
+
+
+ The default value to return if the key is missing or invalid. + |
+
+ 'datetime'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Category
+ |
+
+
+
+ The |
+
src/pynyaa/_enums.py
Filter
+
+
+
+ Bases: IntEnum
Nyaa search filters
+ + + + +
Submitter
+
+
+
+ Bases: ParentModel
Model representing the user who submitted the torrent.
+ + +pydantic.BaseModel
, so you get all of pydantic's fancy methodsExamples:
+>>> a = Submitter(name="John", url="https://nyaa.si/user/john", is_trusted=True, is_banned=False)
+>>> b = Submitter(name="John", url="https://nyaa.si/user/john", is_trusted=True, is_banned=False) # dupe
+>>> c = Submitter(name="Jane", url="https://nyaa.si/user/jane", is_trusted=False, is_banned=False)
+
+>>> print(a)
+John
+
+>>> a == b
+True
+
+>>> a == c
+False
+
+>>> set((a, b, c)) == {a, c} == {b, c} # dedupe
+True
+
is_banned
+
+
+
+ instance-attribute
+
+
+is_banned: bool
+
Indicates whether the user is banned or not.
+
is_trusted
+
+
+
+ instance-attribute
+
+
+is_trusted: bool
+
Indicates whether the user is trusted (green) or not.
+
name
+
+
+
+ instance-attribute
+
+
+name: str
+
Username of the submitter.
+
url
+
+
+
+ instance-attribute
+
+
+url: HttpUrl
+
Profile URL of the submitter.
+
NyaaTorrentPage
+
+
+
+ Bases: ParentModel
Model representing Nyaa's torrent page.
+ + +pydantic.BaseModel
, so you get all of pydantic's fancy methodsExamples:
+>>> from pynyaa import Nyaa
+>>> nyaa = Nyaa()
+>>> a = nyaa.get(1839783)
+>>> b = nyaa.get(1839783) # dupe
+>>> c = nyaa.get(1839609)
+
+>>> print(a)
+[SubsPlease] Hibike! Euphonium S3 - 13 (1080p) [230618C3].mkv
+
+>>> a == b
+True
+
+>>> a == c
+False
+
+>>> set((a, b, c)) == {a, c} == {b, c} # dedupe
+True
+
category
+
+
+
+ instance-attribute
+
+
+category: Category
+
Torrent category.
+
completed
+
+
+
+ instance-attribute
+
+
+completed: int
+
Number of completed downloads.
+
datetime
+
+
+
+ instance-attribute
+
+
+datetime: UTCDateTime
+
Date and time at which the torrent was submitted.
+
description
+
+
+
+ instance-attribute
+
+
+description: str | None
+
Torrent description.
+
id
+
+
+
+ instance-attribute
+
+
+id: int
+
Nyaa ID of the torrent (https://nyaa.si/view/{id}
).
information
+
+
+
+ instance-attribute
+
+
+information: str | None
+
Information about the torrent.
+
is_remake
+
+
+
+ instance-attribute
+
+
+is_remake: bool
+
Indicates whether the upload is a remake (red) or not.
+ + +An upload can be both trusted and a remake, in which case,
+the remake takes priority, that is, is_remake
will be True
+and is_trusted
will be False
.
+This is a current limitation that I don't know how to work around.
is_trusted
+
+
+
+ instance-attribute
+
+
+is_trusted: bool
+
Indicates whether the upload is trusted (green) or not.
+
leechers
+
+
+
+ instance-attribute
+
+
+leechers: int
+
Number of leechers.
+
magnet
+
+
+
+ instance-attribute
+
+
+magnet: MagnetUrl
+
Magnet link of the torrent.
+ + +The magnet link provided by Nyaa is different from the one
+you'll get if you simply generated it from the .torrent
file itself
+because Nyaa strips away all trackers except it's own
+and the ones listed here.
submitter
+
+
+
+ instance-attribute
+
+
+submitter: Submitter
+
User who submitted the torrent.
+
torrent
+
+
+
+ instance-attribute
+
+
+torrent: Torrent
+
A torf.Torrent
object
+representing the data stored in the .torrent
file.
torrent_file
+
+
+
+ instance-attribute
+
+
+torrent_file: HttpUrl
+
URL pointing to the .torrent
file (https://nyaa.si/download/123456.torrent
)
url
+
+
+
+ instance-attribute
+
+
+url: HttpUrl
+
URL to the Nyaa torrent page (https://nyaa.si/view/123456
).
CategoryID
+
+
+
+ module-attribute
+
+
+CategoryID = Literal['0_0', '1_0', '1_1', '1_2', '1_3', '1_4', '2_0', '2_1', '2_2', '3_0', '3_1', '3_2', '3_3', '4_0', '4_1', '4_2', '4_3', '4_4', '5_0', '5_1', '5_2', '6_0', '6_1', '6_2']
+
CategoryLiteral
+
+
+
+ module-attribute
+
+
+CategoryLiteral = Union[CategoryName, CategoryValue]
+
CategoryName
+
+
+
+ module-attribute
+
+
+CategoryName = Literal['ALL', 'ANIME', 'ANIME_MUSIC_VIDEO', 'ANIME_ENGLISH_TRANSLATED', 'ANIME_NON_ENGLISH_TRANSLATED', 'ANIME_RAW', 'AUDIO', 'AUDIO_LOSSLESS', 'AUDIO_LOSSY', 'LITERATURE', 'LITERATURE_ENGLISH_TRANSLATED', 'LITERATURE_NON_ENGLISH_TRANSLATED', 'LITERATURE_RAW', 'LIVE_ACTION', 'LIVE_ACTION_ENGLISH_TRANSLATED', 'LIVE_ACTION_IDOL_PROMOTIONAL_VIDEO', 'LIVE_ACTION_NON_ENGLISH_TRANSLATED', 'LIVE_ACTION_RAW', 'PICTURES', 'PICTURES_GRAPHICS', 'PICTURES_PHOTOS', 'SOFTWARE', 'SOFTWARE_APPLICATIONS', 'SOFTWARE_GAMES']
+
CategoryValue
+
+
+
+ module-attribute
+
+
+CategoryValue = Literal['All', 'Anime', 'Anime - Anime Music Video', 'Anime - English-translated', 'Anime - Non-English-translated', 'Anime - Raw', 'Audio', 'Audio - Lossless', 'Audio - Lossy', 'Literature', 'Literature - English-translated', 'Literature - Non-English-translated', 'Literature - Raw', 'Live Action', 'Live Action - English-translated', 'Live Action - Idol/Promotional Video', 'Live Action - Non-English-translated', 'Live Action - Raw', 'Pictures', 'Pictures - Graphics', 'Pictures - Photos', 'Software', 'Software - Applications', 'Software - Games']
+
MagnetUrl
+
+
+
+ module-attribute
+
+
+MagnetUrl = Annotated[AnyUrl, UrlConstraints(allowed_schemes=['magnet'])]
+
Url that only allows magnets.
+
SortByLiteral
+
+
+
+ module-attribute
+
+
+SortByLiteral = Literal['comments', 'size', 'id', 'datetime', 'seeders', 'leechers', 'downloads']
+
UTCDateTime
+
+
+
+ module-attribute
+
+
+UTCDateTime = Annotated[datetime, AfterValidator(lambda dt: astimezone(utc))]
+
datetime.datetime that's always in UTC.
+