Clients
Nyaa
Nyaa client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url |
str
|
The base URL of Nyaa. Default is |
'https://nyaa.si/'
|
cache |
bool
|
Whether to enable caching. Default is |
True
|
kwargs |
Any
|
Keyword arguments to pass to the underlying |
{}
|
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.
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 | None = None, filter: Filter | None = None) -> Generator[NyaaTorrentPage]
Search for torrents on Nyaa.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
The search query string. |
required |
category |
Category
|
The category to filter the search. If None, searches all categories. |
None
|
filter |
Filter
|
The filter to apply to the search results. If None, no filter is applied. |
None
|
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
Async Nyaa client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url |
str
|
The base URL of Nyaa. Default is |
'https://nyaa.si/'
|
cache |
bool
|
Whether to enable caching. Default is |
True
|
kwargs |
Any
|
Keyword arguments to pass to the underlying |
{}
|
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.
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 | None = None, filter: Filter | None = None) -> AsyncGenerator[NyaaTorrentPage]
Search for torrents on Nyaa.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
The search query string. |
required |
category |
Category
|
The category to filter the search. If None, searches all categories. |
None
|
filter |
Filter
|
The filter to apply to the search results. If None, no filter is applied. |
None
|
Raises:
Type | Description |
---|---|
HTTPStatusError
|
Nyaa returned a non 2xx response. |
Yields:
Type | Description |
---|---|
NyaaTorrentPage
|
A NyaaTorrentPage object representing the retrieved data. |