Tag

insert_link hentai.Tag

A dataclass that bundles related Tag properties and useful helper methods for interacting with tags. See also the documentation for dataclass on python's docs page. There are 7 different types of tags defined in the Hentai class as properties. Each and everyone one of them are objects of this Tag class:

Properties

insert_link self.id -> int

The ID of this Tag object.

            
                from hentai import Hentai

                doujin = Hentai(177013)

                # 12227
                # 17249
                for language in doujin.language:
                    print(language.id)
            
        
insert_link self.type -> str

The type of this Tag object.

            
                from hentai import Hentai

                doujin = Hentai(177013)

                # language
                # language
                for language in doujin.language:
                    print(language.type)
            
        
insert_link self.name -> str

The name of this Tag object.

            
                from hentai import Hentai

                doujin = Hentai(177013)

                # english
                # translated
                for language in doujin.language:
                    print(language.name)
            
        
insert_link self.url -> str

The API endpoint of this Tag object.

            
                from hentai import Hentai

                doujin = Hentai(177013)

                # https://nhentai.net/language/english/
                # https://nhentai.net/language/translated/
                for language in doujin.language:
                    print(language.url)
            
        
insert_link self.count -> int

The number of occurrences of this Tag object in the database.

            
                from hentai import Hentai

                doujin = Hentai(177013)

                # 69378
                # 109734
                for language in doujin.language:
                    print(language.count)
            
        

Methods

insert_link Tag.get(cls, tags: List[Tag], property_: str) -> str

Return a list of tags as comma-separated string.

            
                from hentai import Hentai, Tag

                doujin = Hentai(177013)

                # english, translated
                print(Tag.get(doujin.artist, property='name'))
            
        
insert_link Tag.list(option: Option) -> List[Tag]

Return a list of all tags where option is either

info Note
The category option, which also represents a tag-like object, is not implemented yet. Same goes for the search method.
            
                from hentai import Tag, Option

                # 009-1
                # 07-ghost
                # 08th ms team
                # ...
                for group in Tag.list(Option.Group):
                    print(group.name)
            
        
insert_link Tag.search(option: Option, property_: str, value) -> Tag

Returns the first tag object of type option whose property_ matches with value.

            
                from hentai import Tag, Option

                # ID=3981
                print(f"ID={Tag.search(Option.Artist, 'name', 'shindol').id}")