Reference

The following section outlines the reference of myanimelistpy.

MyAnimeList

class myanimelist.MyAnimeList(client_id)

Methods

getAnimeList

getAnimeListInDict

getAnimeListInJSON

Parameters:
  • client_id (str) - MyAnimeList Client ID.

Methods

get_anime_list(anime_name, limit=100, offset=0, fields=None)

Returns a list of anime by name.

Parameters:
  • anime_name(str) - Name of the anime/series.

  • limit(Optional[int]) - The maximum size of the list. The default value is 100.

  • offset(Optional[int]) - The list offset. The default value is 0.

  • fields(Optional[List [str]]) - List of fields used to show more information about the anime. If is empty, the default fields are id, title and main_picture.

Raises:
  • ValueError - The ‘field’ is not a valid field!

Returns:

List of animes.

Return type:

List [Anime]

get_anime_list_in_dict(anime_name, limit=100, offset=0, fields=None)

Returns a list of dictionaries containing the anime by name.

Parameters:
  • anime_name(str) - Name of the anime/series.

  • limit(Optional[int]) - The maximum size of the list. The default value is 100.

  • offset(Optional[int]) - The list offset. The default value is 0.

  • fields(Optional[List [str]]) - List of fields used to show more information about the anime. If is empty, the default fields are id, title and main_picture.

Raises:
  • ValueError - The ‘field’ is not a valid field!

Returns:

List of animes in dict type.

Return type:

dict

get_anime_list_in_json(anime_name, limit=100, offset=0, fields=None)

Returns a JSON stringified containing the list of anime by name.

Parameters:
  • anime_name(str) - Name of the anime/series.

  • limit(Optional[int]) - The maximum size of the list. The default value is 100.

  • offset(Optional[int]) - The list offset. The default value is 0.

  • fields(Optional[List [str]]) - List of fields used to show more information about the anime. If is empty, the default fields are id, title and main_picture.

Raises:
  • ValueError - The ‘field’ is not a valid field!

Returns:

List of animes in JSON format.

Return type:

str

Services

Services that are used in the library.

Methods

validateFields

services.validate_fields(fields)

Validate the fields provided.

Parameters: - fields(List [str]) - List of fields.

Raises:
  • ValueError - The ‘field’ is not a valid field!

Returns:

If the fields are valid or not.

Return type:

bool

Models

Models are classes that are received from MyAnimeList and are not meant to be created by the user of the library.

Danger

The classes listed below are not intended to be created by users and are also read-only.

For example, this means that you should not make your own Anime instances nor should you modify the Anime instance yourself.

AlternativeTitles

class models.alternativeTitles.AlternativeTitles(synonyms, english, japanese)

Methods

get_synonyms()

get_english()

get_japanese()

Parameters:
  • synonyms (List [str]) - A list of title synonyms.

  • english (str) - English version of the title.

  • japanese (str) - Japanese version of the title.

Methods

get_synonyms()

List of synonyms.

Return type:

List [str]

get_english()

English version.

Return type:

str

get_japanese()

Japanese version.

Return type:

str

Anime

class models.anime.Anime(node, fields)

Methods

Methods

get_id()

get_title()

get_main_picture

get_start_date()

get_alternative_title()

get_synopsis()

get_end_date()

get_rank()

get_mean_score()

get_num_user_list()

get_popularity()

get_nsfw_classification()

get_num_scoring_users()

get_created_at()

get_genres()

get_media_type()

get_updated_at()

get_num_episodes()

get_status()

get_broadcast()

get_start_season()

get_avg_episode_duration_in_seconds()

get_source()

get_studios()

get_rating()

get_background()

get_pictures()

get_related_mangas()

get_related_animes()

get_statistics()

get_recommendations()

Parameters:
  • node (dict) - The JSON object anime.

  • fields (List [str]) - The fields used for the request.

Methods

get_id()

Anime ID.

Return type:

int

get_title()

Anime title.

Return type:

str

get_main_picture()

Anime main picture.

Return type:

Picture

get_alternative_title()

The alternative title of the anime.

Return type:

AlternativeTitles

get_start_date()

The anime start date. Format YYYY-mm-dd.

Return type:

str

get_end_date()

The anime end date. Format YYYY-mm-dd.

Return type:

str

get_synopsis()

Anime synopsis.

Return type:

str

get_mean_score()

Mean score.

Return type:

float

get_rank()

Anime rank.

Return type:

int

get_popularity()

Anime popularity.

Return type:

int

get_num_user_list()

The number of users who have the anime in their list.

Return type:

int

get_num_scoring_users()

The number of users who rated the anime.

Return type:

int

get_nsfw_classification()

Anime NSFW classification.

Return type:

int

get_genres()

The list of anime genres.

Return type:

List [Genre]

get_created_at()

Timestamp of anime creation in MyAnimeList database.

Return type:

str

get_updated_at()

Timestamp of anime update in MyAnimeList database.

Return type:

str

get_media_type()

Anime media type.

Return type:

str

get_status()

Airing status.

Return type:

str

get_num_episodes()

The total number of episodes of this series. If unknown, it is 0.

Return type:

int

get_start_season()

Anime start season.

Return type:

Season

get_broadcast()

Broadcast day of the week and start time (JST).

Return type:

Broadcast | None

get_source()

Original work.

Return type:

str

get_avg_episode_duration_in_seconds()

Average length of episode in seconds.

Return type:

int

get_rating()

Anime rating.

Return type:

str

get_studios()

List of studios that produced the anime.

Return type:

List [Studio]

get_pictures()

List of anime pictures.

Important

You cannot contain this field in a list.

Return type:

List [Picture] | None

get_background()

The API strips BBCode tags from the result.

Important

You cannot contain this field in a list.

Return type:

List [str] | None

List of related animes.

Important

You cannot contain this field in a list.

Return type:

List [RelatedNode] | None

List of related mangas.

Important

You cannot contain this field in a list.

Return type:

List [RelatedNode] | None

get_recommendations()

Summary of recommended anime for those who like this anime.

Important

You cannot contain this field in a list.

Return type:

List [Recommendation] | None

get_statistics()

Anime statistics on MyAnimeList.

Important

You cannot contain this field in a list.

Return type:

List [Statistics] | None

Broadcast

class models.broadcast.Broadcast(day_of_the_week, start_time)

Methods

get_day_of_the_week()

get_start_time()

Parameters:
  • day_of_the_week (DayWeekEnum) - Day of the week broadcast in Japan time.

  • start_time (str) - Time in hours format that is broadcasted.

Methods

get_day_of_the_week()

Broadcast day of the week.

Return type:

str

get_start_time()

Anime start time in JST.

Return type:

str

Genre

class models.genre.Genre(id, name)

Methods

get_id()

get_name()

Parameters:
  • id (int) - ID of the genre.

  • name (str) - Name of the genre.

Methods

get_id()

Genre ID.

Return type:

int

get_name()

Genre name.

Return type:

str

Node

class models.node.Node(id, title, main_picture)

Methods

get_id()

get_title()

get_main_picture()

Parameters:
  • id (int) -

  • title (str) -

  • main_picture () -

Methods

get_id()

Anime or manga ID.

Return type:

int

get_title()

Anime or manga title.

Return type:

str

get_main_picture()

Anime or manga main picture.

Return type:

Picture

Picture

class models.picture.Picture(large, medium)

Methods

get_large()

get_medium()

Parameters:
  • large (str) - The URI of an anime’s large picture.

  • medium (str) - The URI of an anime’s medium picture.

Methods

get_large()

Large size picture.

Return type:

str

get_medium()

Medium size picture.

Return type:

str

Recommendation

class models.recommendation.Recommendation(id, title, main_picture, num_recommendations)

Methods

get_id()

get_title()

get_main_picture()

get_num_recommendations()

Parameters:
  • id (int) - ID of the anime.

  • title (str) - Title of the anime.

  • main_picture (Picture) - Main picture of the anime.

  • num_recommendations (int) - Number of recommendations of the anime.

Methods

get_id()

Anime ID.

Return type:

int

get_title()

Anime title.

Return type:

str

get_main_picture()

Anime main picture.

Return type:

Picture

get_num_recommendations()

Number of recommendations.

Return type:

int

RelatedNode

class models.relatedNode.RelatedNode(id, title, main_picture, relation_type)

Methods

get_id()

get_title()

get_main_picture()

get_relation_type()

Parameters:
  • id (int) - ID of the anime or manga.

  • title (str) - Title of the anime or manga.

  • main_picture (Picture) - Main picture of the anime or manga.

  • relation_type (RelationTypeEnum) - Relation type of the anime or manga.

Methods

get_id()

Anime or manga ID.

Return type:

int

get_title()

Anime or manga title.

Return type:

str

get_main_picture()

Anime or manga main picture.

Return type:

Picture

get_relation_type()

Anime or manga relation type.

Return type:

str

Season

class models.season.Season(year, season)

Methods

get_year()

get_season()

Parameters:
  • year (int) - Year of season.

  • season (SeasonEnum) - Season name.

Methods

get_year()

Year of season.

Return type:

int

get_season()

Season name.

Return type:

str

Statistics

class models.statistics.Statistics(num_list_users, status)

Methods

getNumUserLis()

get_status()

Parameters:
  • num_list_users (int) - Number of users who added the anime to their list.

  • status (StatisticsStatus) - Users list status.

Methods

getNumUserLis()

The number of users who have the anime in their list.

Return type:

int

get_status()

Anime status in the users list.

Return type:

StatisticsStatus

StatisticsStatus

class models.statisticsStatus.StatisticsStatus(watching, completed, on_hold, dropped, plan_to_watch)

Methods

get_num_watching()

get_num_completed()

get_num_on_hold()

get_num_dropped()

get_num_plan_to_watch()

Parameters:
  • watching (int) - Number of users who are watching.

  • completed (int) - Number of users who completed.

  • on_hold (int) - Number of users who are on hold.

  • dropped (int) - Number of users who dropped.

  • plan_to_watch (int) - Number of users who are plan to watch.

Methods

get_num_watching()

The number of users who are watching the anime.

Return type:

int

get_num_completed()

The number of users who are completed the anime.

Return type:

int

get_num_on_hold()

The number of users who are waiting for the anime.

Return type:

int

get_num_dropped()

The number of users who are dropped the anime.

Return type:

int

get_num_plan_to_watch()

The number of users who plan to watch the anime.

Return type:

int

Studio

class models.studio.Studio(id, name)

Methods

get_id()

get_name()

Parameters:
  • id (int) - ID of the Anime Studio.

  • name (str) - Name of the Anime Studio.

Methods

get_id()

Studio ID.

Return type:

int

get_name()

Studio name.

Return type:

str

Enumerations

The library provides some enumerations to avoid the API from being stringly typed in case the strings change in the future.

All enumerations are subclasses of enum.Enum.

Warning

The enumerations listed below are not intended to be used by users and are also read-only.

AiringStatusEnum

enum enums.airingStatusEnum.AiringStatusEnum

Key

Value

finished_airing

Finished airing

currently_airing

Currently airing

not_yet_aired

Not yet aired

DayWeekEnum

enum enums.dayWeekEnum.DayWeekEnum

Key

Value

sunday

0

monday

1

tuesday

2

wednesday

3

thursday

4

friday

5

saturday

6

FieldsEnum

enum enums.fieldsEnum.FieldsEnum

Key

Value

Key

Value

id

0

media_type

16

title

1

status

17

main_picture

2

num_episodes

18

alternative_title

3

start_season

19

start_date

4

broadcast

20

end_date

5

source

21

synopsis

6

average_episode_duration

22

mean

7

rating

23

rank

8

studios

24

popularity

9

pictures

25

num_list_users

10

background

26

num_scoring_users

11

related_anime

27

nsfw

12

related_manga

28

genres

13

recommendations

29

created_at

14

statistics

30

updated_at

15

Note

The keys pictures, background, related_anime, related_manga, recommendations, and statistics cannot be in the fields parameter of get_anime_list(), get_anime_list_in_dict() and get_anime_list_in_json() methods.

MediaTypeEnum

enum enums.mediaTypeEnum.MediaTypeEnum

Key

Value

unknown

0

tv

1

ova

2

movie

3

special

4

ona

5

music

6

NsfwEnum

enum enums.nsfwEnum.NsfwEnum

Key

Value

white

This work is safe for work

gray

This work may be not safe for work

black

This work is not safe for work

RatingEnum

enum enums.ratingEnum.RatingEnum

Key

Value

g

All Age

pg

Children

pg_13

Teens 13 and Older

r

17+ (violence & profanity)

r_plus

Profanity & Mild Nudity

rx

Hentai

RelationTypeEnum

enum enums.relationTypeEnum.RelationTypeEnum

Key

Value

sequel

Sequel

prequel

Prequel

alternative_setting

Alternative Setting

alternative_version

Alternative Version

side_story

Side Story

parent_story

Parent Story

summary

Summary

full_story

Full Story

SeasonEnum

enum enums.seasonEnum.SeasonEnum

Key

Value

winter

Winter

spring

Spring

summer

Summer

fall

Fall

SourceEnum

enum enums.sourceEnum.SourceEnum

Key

Value

other

Other

original

Original

manga

Manga

four_koma_manga

4 Koma manga

web_manga

Web manga

digital_manga

Digital manga

novel

Novel

light_novel

Light novel

visual_novel

Visual novel

game

Game

card_game

Card game

book

Book

picture_book

Picture book

radio

Radio

music

Music