Tag
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
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)
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)
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)
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)
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
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'))
Tag.list(option: Option) -> List[Tag]
Return a list of all tags where option
is either
from hentai import Tag, Option
# 009-1
# 07-ghost
# 08th ms team
# ...
for group in Tag.list(Option.Group):
print(group.name)
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}")