Skip to content

AniList: Character

Kevin L edited this page Jan 3, 2023 · 1 revision

Character Overview

The following functions are supported by AnilistPython version 0.1.1.

  • .get_character() - search character by name
  • .get_character_with_id() - search character by ID
  • .get_character_id() - get character ID
  • .print_anime_info() - print character information

Retrieve by name

  • Function: .get_character()

AnilistPython offers the ability to retrieve the character information when given the name of the character. The name of the character does not have to be exactly accurate (the search engine will automatically resolve this).

from AnilistPython import Anilist
anilist = Anilist()

# returns a dictionary containing the info about Emilia-tan 
anime_dict = anilist.get_character("Emilia") 

Manually Select Result: The function .get_character() allows to user to select which of the top three search results should be retrieved. (manual_select is set to False by default)

anime_dict = anilist.get_character("Emilia", manual_select=True)

Retrieve by ID

  • Function: .get_character_with_id()

AnilistPython can also retrieve character data given the ID of the anime from Anilist.co

from AnilistPython import Anilist
anilist = Anilist()

# returns a dictionary containing the info about Misaka Mikoto (ID:13701) from Railgun
anime_dict = anilist.get_character_with_id(13701) 

Get Character ID

  • Function: .get_character_id() The AnilistPython library also allows the user to retrieve character ID from Anilist.co.
from AnilistPython import Anilist
anilist = Anilist()

# returns character Milim's ID on Anilist
anilist.get_character_id('Milim')

Print Character Info

  • Function: .print_anime_info() This feature automatically formats the data retrieved from the anime and displays this information in the terminal.
from AnilistPython import Anilist
anilist = Anilist()

anilist.print_character_info("Kirito")

Sample Output

=========================================== CHARACTER INFO ===========================================
First Name: Kazuto
Last Name: Kirigaya
Japanese Name: 桐ヶ谷和人
Description: 
Height: 172 cm
Weapon(s) of choice: Anneal Blade (1st Level), Queen's Knightblade (9th Level), Elucidator (50th level) and Dark Repulser (forged by Lisbeth)
Kirito is the main protagonist of the series. He is a "solo" player, a player who hasn't joined a guild and usually works alone. He is also one of the ... 
Image: https://s4.anilist.co/file/anilistcdn/character/large/b36765-BnLbXg0Tzzh9.png

Character Dict Keys

The following are keys from the anime dictionary retrieved.

#CHARACTER DICTIONARY KEYS
- first_name 
- last_name
- native_name    
- desc 
- image
Clone this wiki locally