Clients
Nyaa
Nyaa(base_url: str = 'https://nyaa.si/', client: Client | None = None)
Nyaa client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url |
str
|
The base URL of Nyaa. Default is |
'https://nyaa.si/'
|
client |
Client
|
An |
None
|
Source code in 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.
close
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. |
Source code in 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 |
False
|
Raises:
Type | Description |
---|---|
HTTPStatusError
|
Nyaa returned a non 2xx response. |
Yields:
Type | Description |
---|---|
NyaaTorrentPage
|
A NyaaTorrentPage object representing the retrieved data. |
Source code in src/pynyaa/_clients/_sync.py
AsyncNyaa
AsyncNyaa(base_url: str = 'https://nyaa.si/', client: AsyncClient | None = None)
Async Nyaa client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url |
str
|
The base URL of Nyaa. This is used for constructing the full URL from relative URLs. |
'https://nyaa.si/'
|
client |
Client
|
An |
None
|
Source code in 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.
close
async
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. |
Source code in 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 |
False
|
Raises:
Type | Description |
---|---|
HTTPStatusError
|
Nyaa returned a non 2xx response. |
Yields:
Type | Description |
---|---|
NyaaTorrentPage
|
A NyaaTorrentPage object representing the retrieved data. |