Skip to content

AniList: Anime

Kevin L edited this page Jan 3, 2023 · 5 revisions

Anime Overview

The following functions are supported by AnilistPython version 1.0.0 and higher.

  • Go to .get_anime() - search anime by name (online)
  • Go to .search_anime() - search anime by genre, year, and/or score
  • Go to .get_anime_with_id() - search anime by ID
  • Go to .get_anime_id() - get anime ID
  • Go to .print_anime_info() - print anime information

Retrieve by name (online)

  • Function: .get_anime()
  • Full Function: def get_anime(self, anime_name, count=3, deepsearch=False, manual_select=False) -> list:

AnilistPython offers the ability to retrieve anime information when given the name of the anime. The name of the anime does not have to be 100% accurate (AniList's search engine will automatically resolve this).

.get_anime() returns a list of dictionaries, with each dictionary containing an anime's information. The number of dictionaries returned from calling .get_anime() can be specified with the optional parameter count (details below). All dictionaries will have the same key values.

from AnilistPython import Anilist
anilist = Anilist()

ani_list = anilist.get_anime('Seraph of the End')

Parameter: count:int

  • The number of anime dictionaries to fetch. Default to 3.
# Results a list of three dictionaries 
anime_res = anilist.get_anime('Seraph of the End', count=3)

Parameter: deepsearch:bool

  • The function .get_anime() is currently supported by DeepSearch. DeepSearch is a built-in extension that helps AnilistPython to return more accurate search results. Although the DeepSearch module is favorable to use in most cases, it does, however, take around 15% more time to retrieve the information.
anime_res = anilist.get_anime('Seraph of the End', deepsearch=True)

Parameter: manual_select:bool

  • When set to True, it allows the user to manually select the results from .get_anime() to return through standard input. Default to False.
anime_res = anilist.get_anime('Seraph of the End', manual_select=True)

Retrieve by ID

  • Function: .get_anime_with_id()

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

from AnilistPython import Anilist
anilist = Anilist()

anime_dict = anilist.get_anime_with_id(126830) #Code Geass

Get Anime ID

  • Function: .get_anime_id()

The AnilistPython library also allows the user to retrieve anime ID from Anilist.co.

from AnilistPython import Anilist
anilist = Anilist()

anilist.get_anime_id('no game no life')

This will return the anime ID of No Game No Life formatted as an int from Anilist.


Print Anime 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_anime_info('no game no life')

Sample Output

╒═════════════════╤═════════════════════════════════════════════════════════════════════════════════════════╕
│ name_romaji     │ No Game No Life                                                                         │
│ name_english    │ No Game, No Life                                                                        │
│ starting_time   │ 4/9/2014                                                                                │
│ ending_time     │ 6/25/2014                                                                               │
│ cover_image     │ https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/nx19815-bIo51RMWWhLv.jpg │
│ banner_image    │ https://s4.anilist.co/file/anilistcdn/media/anime/banner/19815-BqbuD0wyBS3P.jpg         │
│ airing_format   │ TV                                                                                      │
│ airing_status   │ FINISHED                                                                                │
│ airing_episodes │ 12                                                                                      │
│ season          │ SPRING                                                                                  │
│ desc            │ <...> (run .get_anime() for full view)                                                  │
│ average_score   │ 78                                                                                      │
│ genres          │ Adventure, Comedy, Ecchi, Fantasy                                                       │
│ next_airing_ep  │ N/A                                                                                     │
│ is_adult        │ False                                                                                   │
│ popularity      │ 363239                                                                                  │
│ origin          │ JP                                                                                      │
│ duration        │ 24 minutes                                                                              │
│ updated_at      │ 2023-01-02 20:12:55                                                                     │
│ source          │ LIGHT_NOVEL                                                                             │
│ url             │ https://anilist.co/anime/19815                                                          │
╘═════════════════╧═════════════════════════════════════════════════════════════════════════════════════════╛

Anime Dict Keys

The following are keys from the anime dictionary retrieved.

#ANIME DICTIONARY KEYS
- name_romaji 
- name_english
- starting_time
- ending_time
- cover_image
- banner_image
- airing_format
- airing_status
- airing_episodes
- season
- desc
- average_score
- genres
- next_airing_ep 
Clone this wiki locally