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

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.

get classmethod

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

Get the Category by its name (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 (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.
    """
    match key:
        case str():
            for category in cls:
                if (category.value.casefold() == key.casefold()) or (category.name.casefold() == key.casefold()):
                    return category
            else:
                return cls(default)
        case _:
            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