Skip to content

Enums

Category

Bases: BaseStrEnum

Nyaa categories

ALL class-attribute instance-attribute

ALL = 'All'

ANIME class-attribute instance-attribute

ANIME = 'Anime'

ANIME_ENGLISH_TRANSLATED class-attribute instance-attribute

ANIME_ENGLISH_TRANSLATED = 'Anime - English-translated'

ANIME_MUSIC_VIDEO class-attribute instance-attribute

ANIME_MUSIC_VIDEO = 'Anime - Anime Music Video'

ANIME_NON_ENGLISH_TRANSLATED class-attribute instance-attribute

ANIME_NON_ENGLISH_TRANSLATED = 'Anime - Non-English-translated'

ANIME_RAW class-attribute instance-attribute

ANIME_RAW = 'Anime - Raw'

AUDIO class-attribute instance-attribute

AUDIO = 'Audio'

AUDIO_LOSSLESS class-attribute instance-attribute

AUDIO_LOSSLESS = 'Audio - Lossless'

AUDIO_LOSSY class-attribute instance-attribute

AUDIO_LOSSY = 'Audio - Lossy'

LITERATURE class-attribute instance-attribute

LITERATURE = 'Literature'

LITERATURE_ENGLISH_TRANSLATED class-attribute instance-attribute

LITERATURE_ENGLISH_TRANSLATED = 'Literature - English-translated'

LITERATURE_NON_ENGLISH_TRANSLATED class-attribute instance-attribute

LITERATURE_NON_ENGLISH_TRANSLATED = 'Literature - Non-English-translated'

LITERATURE_RAW class-attribute instance-attribute

LITERATURE_RAW = 'Literature - Raw'

LIVE_ACTION class-attribute instance-attribute

LIVE_ACTION = 'Live Action'

LIVE_ACTION_ENGLISH_TRANSLATED class-attribute instance-attribute

LIVE_ACTION_ENGLISH_TRANSLATED = 'Live Action - English-translated'

LIVE_ACTION_IDOL_PROMOTIONAL_VIDEO class-attribute instance-attribute

LIVE_ACTION_IDOL_PROMOTIONAL_VIDEO = 'Live Action - Idol/Promotional Video'

LIVE_ACTION_NON_ENGLISH_TRANSLATED class-attribute instance-attribute

LIVE_ACTION_NON_ENGLISH_TRANSLATED = 'Live Action - Non-English-translated'

LIVE_ACTION_RAW class-attribute instance-attribute

LIVE_ACTION_RAW = 'Live Action - Raw'

PICTURES class-attribute instance-attribute

PICTURES = 'Pictures'

PICTURES_GRAPHICS class-attribute instance-attribute

PICTURES_GRAPHICS = 'Pictures - Graphics'

PICTURES_PHOTOS class-attribute instance-attribute

PICTURES_PHOTOS = 'Pictures - Photos'

SOFTWARE class-attribute instance-attribute

SOFTWARE = 'Software'

SOFTWARE_APPLICATIONS class-attribute instance-attribute

SOFTWARE_APPLICATIONS = 'Software - Applications'

SOFTWARE_GAMES class-attribute instance-attribute

SOFTWARE_GAMES = 'Software - Games'

id property

Returns the ID of the category.

Examples:

>>> Category.ANIME_ENGLISH_TRANSLATED.id == "1_2"
True
>>> Category.ALL.id == "0_0"
True

parent property

parent: Self

Returns the parent category.

Examples:

>>> Category.ANIME_ENGLISH_TRANSLATED.parent is Category.ANIME
True
>>> Category.ANIME.parent is Category.ANIME
True

get classmethod

get(key: CategoryLiteral | str, default: CategoryLiteral | str = 'ALL') -> Self

Get the Category by its name, value, or id (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 Category corresponding to the key.

Source code in src/pynyaa/_enums.py
@classmethod
def get(cls, key: CategoryLiteral | str, default: CategoryLiteral | str = "ALL") -> Self:
    """
    Get the `Category` by its name, value, or id (case-insensitive).
    Return the default if the key is missing or invalid.

    Parameters
    ----------
    key : CategoryLiteral | str
        The key to retrieve.
    default : CategoryLiteral | str, optional
        The default value to return if the key is missing or invalid.

    Returns
    -------
    Category
        The `Category` corresponding to the key.
    """

    try:
        return cls(key)
    except ValueError:
        try:
            return cls(CATEGORY_ID_TO_NAME_MAP[key])  # type: ignore
        except KeyError:
            return cls(default)

SortBy

Bases: BaseStrEnum

COMMENTS class-attribute instance-attribute

COMMENTS = 'comments'

DATETIME class-attribute instance-attribute

DATETIME = 'id'

DOWNLOADS class-attribute instance-attribute

DOWNLOADS = 'downloads'

LEECHERS class-attribute instance-attribute

LEECHERS = 'leechers'

SEEDERS class-attribute instance-attribute

SEEDERS = 'seeders'

SIZE class-attribute instance-attribute

SIZE = 'size'

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 SortBy corresponding to the key.

Source code in src/pynyaa/_enums.py
@classmethod
def get(cls, 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
    ----------
    key : SortByLiteral | str
        The key to retrieve.
    default : SortByLiteral | str, optional
        The default value to return if the key is missing or invalid.

    Returns
    -------
    Category
        The `SortBy` corresponding to the key.
    """
    try:
        return cls(key)
    except ValueError:
        return cls(default)

Filter

Bases: IntEnum

Nyaa search filters

NO_FILTER class-attribute instance-attribute

NO_FILTER = 0

NO_REMAKES class-attribute instance-attribute

NO_REMAKES = 1

TRUSTED_ONLY class-attribute instance-attribute

TRUSTED_ONLY = 2