gchar.resources.sites

list_available_sites

gchar.resources.sites.list_available_sites() → List[str][source]

List the available supported image website names.

Returns:

The list of supported website names.

Return type:

List[str]

Examples::
>>> from gchar.resources.sites import list_available_sites
>>>
>>> list_available_sites()
['anime_pictures', 'atfbooru', 'danbooru', 'hypnohub', 'konachan', 'konachan_net', 'lolibooru', 'rule34', 'safebooru', 'sankaku', 'xbooru', 'yande', 'zerochan']

list_site_tags

gchar.resources.sites.list_site_tags(ch: Union[gchar.games.base.character.Character, str], site: str, sure_only: bool = False, with_posts: bool = False, allow_fuzzy: bool = False, **kwargs) → Union[List[str], List[Tuple[str, int]]][source]

List the tags for a character and site.

Parameters:
  • ch (Union[Character, str]) – The character instance or name.

  • site (str) – The name of the site.

  • sure_only (bool) – Whether to include only sure tags.

  • with_posts (bool) – Whether to include the number of posts for each tag.

  • allow_fuzzy (bool) – Whether to allow fuzzy matching of character names.

  • kwargs – Additional arguments for character retrieval.

Returns:

The list of tags for the character and site.

Return type:

Union[List[str], List[Tuple[str, int]]]

Examples::
>>> from gchar.resources.sites import list_site_tags
>>>
>>> list_site_tags('amiya', 'danbooru')
['amiya_(arknights)', 'amiya_(guard)_(arknights)', 'amiya_(newsgirl)_(arknights)', 'amiya_(fresh_fastener)_(arknights)', 'amiya_(planter)_(arknights)', 'amiya_(guard)_(touch_the_stars)_(arknights)']
>>> list_site_tags('surtr', 'danbooru')
['surtr_(arknights)', 'surtr_(colorful_wonderland)_(arknights)', 'surtr_(liberte_echec)_(arknights)']
>>> list_site_tags('surtr', 'danbooru', with_posts=True)
[('surtr_(arknights)', 2666), ('surtr_(colorful_wonderland)_(arknights)', 483), ('surtr_(liberte_echec)_(arknights)', 306)]
>>> list_site_tags('surtr', 'zerochan')
['Surtr (Arknights)']
>>> list_site_tags('surtr', 'anime_pictures')
['surtr (arknights)', 'surtr (liberte echec) (arknights)', 'surtr (colorful wonderland) (arknights)']
>>> list_site_tags('surtr', 'anime_pictures', with_posts=True)
[('surtr (arknights)', 471), ('surtr (liberte echec) (arknights)', 75), ('surtr (colorful wonderland) (arknights)', 49)]

get_site_tag

gchar.resources.sites.get_site_tag(ch: Union[gchar.games.base.character.Character, str], site: str, sure_only: bool = False, with_posts: bool = False, allow_fuzzy: bool = False, **kwargs) → Optional[Union[str, Tuple[str, int]]][source]

Get a single tag for a character and site.

Parameters:
  • ch (Union[Character, str]) – The character instance or name.

  • site (str) – The name of the site.

  • sure_only (bool) – Whether to include only sure tags.

  • with_posts (bool) – Whether to include the number of posts for the tag.

  • allow_fuzzy (bool) – Whether to allow fuzzy matching of character names.

  • kwargs – Additional arguments for character retrieval.

Returns:

The tag for the character and site.

Return type:

Union[str, Tuple[str, int], None]

Examples:
>>> from gchar.resources.sites import get_site_tag
>>>
>>> get_site_tag('amiya', 'danbooru')
'amiya_(arknights)'
>>> get_site_tag('surtr', 'danbooru')
'surtr_(arknights)'
>>> get_site_tag('surtr', 'danbooru', with_posts=True)
('surtr_(arknights)', 2666)
>>> get_site_tag('surtr', 'zerochan')
'Surtr (Arknights)'
>>> get_site_tag('surtr', 'anime_pictures')
'surtr (arknights)'
>>> get_site_tag('surtr', 'anime_pictures', with_posts=True)
('surtr (arknights)', 471)