Clients
Nyaa
Nyaa(
*,
base_url: str = "https://nyaa.si/",
client: Client | None = None,
)
Client for interacting with Nyaa.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
Base URL of Nyaa. Used to construct full URLs from relative paths. |
'https://nyaa.si/'
|
client
|
Client
|
Custom |
None
|
Source code in src/pynyaa/_client.py
close
get
get(page: int | str) -> NyaaTorrentPage
Fetch metadata for a specific torrent page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int or str
|
Torrent ID or full URL (e.g., |
required |
Raises:
Type | Description |
---|---|
TorrentNotFoundError
|
If the torrent does not exist (HTTP 404). |
TypeError
|
If |
ValueError
|
If |
Returns:
Type | Description |
---|---|
NyaaTorrentPage
|
Parsed torrent metadata as a |
Source code in src/pynyaa/_client.py
search
search(
query: str,
/,
*,
category: ParentCategory | Category = ALL,
filter: Filter = NO_FILTER,
sort_by: SortBy = DATETIME,
order: Order = DESCENDING,
) -> Iterator[NyaaTorrentPage]
Search for torrents on Nyaa.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
Search query string. |
required |
category
|
ParentCategory | Category
|
Category or subcategory used to filter results. |
ALL
|
filter
|
Filter
|
Filter applied to the search results. |
NO_FILTER
|
sort_by
|
SortBy
|
Field used to sort the results. |
DATETIME
|
order
|
Order
|
Order of the results. |
DESCENDING
|
Yields:
Type | Description |
---|---|
NyaaTorrentPage
|
Parsed torrent metadata for each result. |
Source code in src/pynyaa/_client.py
AsyncNyaa
AsyncNyaa(
*,
base_url: str = "https://nyaa.si/",
client: AsyncClient | None = None,
)
Client for interacting with Nyaa.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
Base URL of Nyaa. Used to construct full URLs from relative paths. |
'https://nyaa.si/'
|
client
|
AsyncClient
|
Custom |
None
|
Source code in src/pynyaa/_aclient.py
close
async
get
async
get(page: int | str) -> NyaaTorrentPage
Fetch metadata for a specific torrent page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int or str
|
Torrent ID or full URL (e.g., |
required |
Raises:
Type | Description |
---|---|
TorrentNotFoundError
|
If the torrent does not exist (HTTP 404). |
TypeError
|
If |
ValueError
|
If |
Returns:
Type | Description |
---|---|
NyaaTorrentPage
|
Parsed torrent metadata as a |
Source code in src/pynyaa/_aclient.py
search
async
search(
query: str,
/,
*,
category: ParentCategory | Category = ALL,
filter: Filter = NO_FILTER,
sort_by: SortBy = DATETIME,
order: Order = DESCENDING,
) -> AsyncIterator[NyaaTorrentPage]
Search for torrents on Nyaa.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
Search query string. |
required |
category
|
ParentCategory | Category
|
Category or subcategory used to filter results. |
ALL
|
filter
|
Filter
|
Filter applied to the search results. |
NO_FILTER
|
sort_by
|
SortBy
|
Field used to sort the results. |
DATETIME
|
order
|
Order
|
Order of the results. |
DESCENDING
|
Yields:
Type | Description |
---|---|
NyaaTorrentPage
|
Parsed torrent metadata for each result. |