gchar.resources.pixiv¶
get_pixiv_posts¶
-
gchar.resources.pixiv.
get_pixiv_posts
(char: Union[str, gchar.games.base.character.Character], allow_fuzzy: bool = True, fuzzy_threshold: int = 70, **kwargs) → Optional[Tuple[int, int]][source]¶ Get the number of Pixiv posts for a given character.
- Parameters:
char (Union[str, Character]) – The character name or instance of Character class.
allow_fuzzy (bool) – Whether to allow fuzzy matching of character names.
fuzzy_threshold (int) – The threshold for fuzzy matching.
- Returns:
A tuple containing the number of all illustrations and R18 illustrations, or None if the character is unknown.
- Return type:
Optional[Tuple[int, int]]
- Raises:
ValueError – If the character is unknown.
- Examples::
>>> from gchar.resources.pixiv import get_pixiv_posts >>> >>> get_pixiv_posts('amiya') (14130, 1113) >>> get_pixiv_posts('surtr') (5579, 787)
get_pixiv_keywords¶
-
gchar.resources.pixiv.
get_pixiv_keywords
(char: Union[gchar.games.base.character.Character, str], simple: bool = False, use_english: bool = True, includes: Optional[List[str]] = None, exclude: Optional[List[str]] = None, allow_fuzzy: bool = True, fuzzy_threshold: int = 70, max_exclude: int = 20, max_pollution_ratio: float = 0.8, max_length: int = 256, **kwargs)[source]¶ Get the Pixiv search keywords for a specific character.
- Parameters:
char (Union[Character, str]) – The character instance or name.
simple (bool) – Whether to generate a simplified tag.
use_english (bool) – Whether to use English names in the tag.
includes (Optional[Union[Tuple[str], List[str], str]]) – The positive tags to include.
exclude (Optional[Union[Tuple[str], List[str], str]]) – The negative tags to exclude.
allow_fuzzy (bool) – Whether to allow fuzzy matching of character names.
fuzzy_threshold (int) – The threshold for fuzzy matching.
max_exclude (int) – The maximum number of excluded tags.
max_pollution_ratio (float) – The maximum pollution ratio for including tags.
max_length (int) – The maximum length of the generated tag.
- Returns:
The generated Pixiv search keywords.
- Return type:
str
- Raises:
ValueError – If the character is unknown.
- Examples::
>>> from gchar.resources.pixiv import get_pixiv_keywords >>> >>> get_pixiv_keywords('amiya') 'アークナイツ (amiya OR アーミヤ OR 阿米娅)' >>> get_pixiv_keywords('surtr') 'アークナイツ (surtr OR スルト OR 史尔特尔) -明日方舟スルト' >>> get_pixiv_keywords('dusk') # ケルシー and ドロシー way cause search noises 'アークナイツ (dusk OR シー OR 夕) -ケルシー -シージ -シーン -ドロシー -ルーシー -夕張 -夕日 -夕焼け'
PixivCharPool¶
-
class
gchar.resources.pixiv.
PixivCharPool
(chars: Iterable[gchar.games.base.character.Character], names_dict: Mapping[str, Tuple[int, float, List[Tuple[str, int]]]], names_alias: Mapping[Union[str, int], List[str]])[source]¶ -
get_simple_tag
(char: gchar.games.base.character.Character, base_tag: str, max_exclude: int = 20)[source]¶ Generate a simplified Pixiv search tag for a specific character.
- Parameters:
char (Character) – The character instance.
base_tag (str) – The base tag to append to the character name.
max_exclude (int) – The maximum number of excluded tags.
- Returns:
The generated simplified Pixiv search tag.
- Return type:
str
-
get_tag
(char: gchar.games.base.character.Character, use_english: bool = False, positive: Optional[List[str]] = None, negative: Optional[List[str]] = None, max_exclude_per_word: int = 20, max_exclude: int = 20, max_pollution_ratio: float = 0.8, max_length: int = 256)[source]¶ Generate a Pixiv search tag for a specific character.
- Parameters:
char (Union[Character, str]) – The character instance or name.
use_english (bool) – Whether to use English names in the tag.
positive (Optional[List[str]]) – The positive tags to include.
negative (Optional[List[str]) – The negative tags to exclude.
max_exclude_per_word (int) – The maximum number of excluded tags per word.
max_exclude (int) – The maximum number of excluded tags.
max_pollution_ratio (float) – The maximum pollution ratio for including tags.
max_length (int) – The maximum length of the generated tag.
- Returns:
The generated Pixiv search tag.
- Return type:
str
-