Skip to content

Latest commit

 

History

History
1261 lines (911 loc) · 30.2 KB

reference.rst

File metadata and controls

1261 lines (911 loc) · 30.2 KB

Reference

The following section outlines the reference of myanimelistpy.

MyAnimeList

Methods
:ref:`getAnimeList <getanimelist>`
:ref:`getAnimeListInDict <getanimelistindict>`
:ref:`getAnimeListInJSON <getanimelistinjson>`
Parameters:
  • client_id (str) - MyAnimeList Client ID.

Methods

.. method:: getAnimeList(anime_name, limit = 100, offset = 0, fields = [])

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:
Returns:
List of animes.
Return type:
List [:ref:`Anime <anime>`]
.. method:: getAnimeListInDict(anime_name, limit = 100, offset = 0, fields = [])

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:
Returns:
List of animes in dict type.
Return type:
dict
.. method:: getAnimeListInJSON(anime_name, limit = 100, offset = 0, fields = [])

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:
Returns:
List of animes in JSON format.
Return type:
str

Services

Services that are used in the library.

Methods
:ref:`validateFields <validatefields>`
.. method:: services.validateFields(fields)

Validate the fields provided.

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

Raises:
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 :ref:`Anime <anime>` instances nor should you modify the :ref:`Anime <anime>` instance yourself.

AlternativeTitles

Methods
:ref:`getSynonyms() <getSynonyms>`
:ref:`getEnglish() <getEnglish>`
:ref:`getJapanese() <getJapanese>`
Parameters:
  • synonyms (List [str]) - A list of title synonyms.
  • english (str) - English version of the title.
  • japanese (str) - Japanese version of the title.

Methods

.. method:: getSynonyms()

List of synonyms.

Return type:
List [str]
.. method:: getEnglish()

English version.

Return type:
str
.. method:: getJapanese()

Japanese version.

Return type:
str

Anime

Methods Methods
:ref:`getId() <getIdAnime>` :ref:`getTitle() <getTitleAnime>`
:ref:`getMainPicture <getMainPictureAnime>` :ref:`getStartDate() <getStartDate>`
:ref:`getAlternativeTitle() <getAlternativeTitle>` :ref:`getSynopsis() <getSynopsis>`
:ref:`getEndDate() <getEndDate>` :ref:`getRank() <getRank>`
:ref:`getMean() <getMean>` :ref:`getNumUserList() <getNumUserList>`
:ref:`getPopularity() <getPopularity>` :ref:`getNsfwClassification() <getNsfwClassification>`
:ref:`getNumScoringUsers() <getNumScoringUsers>` :ref:`getCreatedAt() <getCreatedAt>`
:ref:`getGenres() <getGenres>` :ref:`getMediaType() <getMediaType>`
:ref:`getUpdatedAt() <getUpdatedAt>` :ref:`getNumEpisodes() <getNumEpisodes>`
:ref:`getStatus() <getStatus>` :ref:`getBroadcast() <getBroadcast>`
:ref:`getStartSeason() <getStartSeason>` :ref:`getAvgEpisodeDurationInSeconds() <getAvgEpisodeDurationInSeconds>`
:ref:`getSource() <getSource>` :ref:`getStudios() <getStudios>`
:ref:`getRating() <getRating>` :ref:`getBackground() <getBackground>`
:ref:`getPictures() <getPictures>` :ref:`getRelatedMangas() <getRelatedMangas>`
:ref:`getRelatedAnimes() <getRelatedAnimes>` :ref:`getStatistics() <getStatistics>`
:ref:`getRecommendations() <getRecommendations>`  
Parameters:
  • node (dict) - The JSON object anime.
  • fields (List [str]) - The fields used for the request.

Methods

.. method:: getId()
    :noindex:

Anime ID.

Return type:
int
.. method:: getTitle()
    :noindex:

Anime title.

Return type:
str
.. method:: getMainPicture()
    :noindex:

Anime main picture.

Return type:
:ref:`Picture <picture>`
.. method:: getAlternativeTitle()

The alternative title of the anime.

Return type:
:ref:`AlternativeTitles <AlternativeTitles>`
.. method:: getStartDate()

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

Return type:
str
.. method:: getEndDate()

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

Return type:
str
.. method:: getSynopsis()

Anime synopsis.

Return type:
str
.. method:: getMean()

Mean score.

Return type:
float
.. method:: getRank()

Anime rank.

Return type:
int
.. method:: getPopularity()

Anime popularity.

Return type:
int
.. method:: getNumUserList()

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

Return type:
int
.. method:: getNumScoringUsers()

The number of users who rated the anime.

Return type:
int
.. method:: getNsfwClassification()

Anime NSFW classification.

Return type:
int
.. method:: getGenres()

The list of anime genres.

Return type:
List [:ref:`Genre <genre>`]
.. method:: getCreatedAt()

Timestamp of anime creation in MyAnimeList database.

Return type:
str
.. method:: getUpdatedAt()

Timestamp of anime update in MyAnimeList database.

Return type:
str
.. method:: getMediaType()

Anime media type.

Return type:
str
.. method:: getStatus()

Airing status.

Return type:
str
.. method:: getNumEpisodes()

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

Return type:
int
.. method:: getStartSeason()

Anime start season.

Return type:
:ref:`Season <Season>`
.. method:: getBroadcast()

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

Return type:
:ref:`Broadcast <broadcast>` | None
.. method:: getSource()

Original work.

Return type:
str
.. method:: getAvgEpisodeDurationInSeconds()

Average length of episode in seconds.

Return type:
int
.. method:: getRating()

Anime rating.

Return type:
str
.. method:: getStudios()

List of studios that produced the anime.

Return type:
List [:ref:`Studio <studio>`]
.. method:: getPictures()

List of anime pictures.

Important

You cannot contain this field in a list.

Return type:
List [:ref:`Picture <picture>`] | None
.. method:: getBackground()

The API strips BBCode tags from the result.

Important

You cannot contain this field in a list.

Return type:
List [str] | None
.. method:: getRelatedAnimes()

List of related animes.

Important

You cannot contain this field in a list.

Return type:
List [:ref:`RelatedNode <relatedNode>`] | None
.. method:: getRelatedMangas()

List of related mangas.

Important

You cannot contain this field in a list.

Return type:
List [:ref:`RelatedNode <relatedNode>`] | None
.. method:: getRecommendations()

Summary of recommended anime for those who like this anime.

Important

You cannot contain this field in a list.

Return type:
List [:ref:`Recommendation <recommendation>`] | None
.. method:: getStatistics()

Anime statistics on MyAnimeList.

Important

You cannot contain this field in a list.

Return type:
List [:ref:`Statistics <statistics>`] | None

Broadcast

Methods
:ref:`getDayOfTheWeek() <getDayOfTheWeek>`
:ref:`getStartTime() <getStartTime>`
Parameters:

Methods

.. method:: getDayOfTheWeek()

Broadcast day of the week.

Return type:
str
.. method:: getStartTime()

Anime start time in JST.

Return type:
str

Genre

Methods
:ref:`getId() <getIdGenre>`
:ref:`getName() <getNameGenre>`
Parameters:
  • id (int) - ID of the genre.
  • name (str) - Name of the genre.

Methods

.. method:: getId()

Genre ID.

Return type:
int
.. method:: getName()

Genre name.

Return type:
str

Node

Methods
:ref:`getId() <getIdNode>`
:ref:`getTitle() <getTitle>`
:ref:`getMainPicture() <getMainPicture>`
Parameters:
  • id (int) -
  • title (str) -
  • main_picture () -

Methods

.. method:: getId()
    :noindex:

Anime or manga ID.

Return type:
int
.. method:: getTitle()

Anime or manga title.

Return type:
str
.. method:: getMainPicture()

Anime or manga main picture.

Return type:
:ref:`Picture <picture>`

Picture

Methods
:ref:`getLarge() <getLarge>`
:ref:`getMedium() <getMedium>`
Parameters:
  • large (str) - The URI of an anime's large picture.
  • medium (str) - The URI of an anime's medium picture.

Methods

.. method:: getLarge()

Large size picture.

Return type:
str
.. method:: getMedium()

Medium size picture.

Return type:
str

Recommendation

Methods
:ref:`getId() <getIdRecommendation>`
:ref:`getTitle() <getTitleRecommendation>`
:ref:`getMainPicture() <getMainPictureRecommendation>`
:ref:`getNumRecommendations() <getNumRecommendations>`
Parameters:
  • id (int) - ID of the anime.
  • title (str) - Title of the anime.
  • main_picture (:ref:`Picture <picture>`) - Main picture of the anime.
  • num_recommendations (int) - Number of recommendations of the anime.

Methods

.. method:: getId()
    :noindex:

Anime ID.

Return type:
int
.. method:: getTitle()
    :noindex:

Anime title.

Return type:
str
.. method:: getMainPicture()
    :noindex:

Anime main picture.

Return type:
:ref:`Picture <picture>`
.. method:: getNumRecommendations()

Number of recommendations.

Return type:
int

RelatedNode

Methods
:ref:`getId() <getIdRelatedNode>`
:ref:`getTitle() <getTitleRelatedNode>`
:ref:`getMainPicture() <getMainPictureRelatedNode>`
:ref:`getRelationType() <getRelationType>`
Parameters:

Methods

.. method:: getId()
    :noindex:

Anime or manga ID.

Return type:
int
.. method:: getTitle()
    :noindex:

Anime or manga title.

Return type:
str
.. method:: getMainPicture()
    :noindex:

Anime or manga main picture.

Return type:
:ref:`Picture <picture>`
.. method:: getRelationType()

Anime or manga relation type.

Return type:
str

Season

Methods
:ref:`getYear() <getYear>`
:ref:`getSeason() <getSeason>`
Parameters:

Methods

.. method:: getYear()

Year of season.

Return type:
int
.. method:: getSeason()

Season name.

Return type:
str

Statistics

Methods
:ref:`getNumUserLis() <getNumUserLis>`
:ref:`getStatus() <getStatusStatistics>`
Parameters:

Methods

.. method:: getNumUserLis()

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

Return type:
int
.. method:: getStatus()
    :noindex:

Anime status in the users list.

Return type:
:ref:`StatisticsStatus <StatisticsStatus>`

StatisticsStatus

Methods
:ref:`getNumWatching() <getNumWatching>`
:ref:`getNumCompleted() <getNumCompleted>`
:ref:`getNumOnHold() <getNumOnHold>`
:ref:`getNumDropped() <getNumDropped>`
:ref:`getNumPlanToWatch() <getNumPlanToWatch>`
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

.. method:: getNumWatching()

The number of users who are watching the anime.

Return type:
int
.. method:: getNumCompleted()

The number of users who are completed the anime.

Return type:
int
.. method:: getNumOnHold()

The number of users who are waiting for the anime.

Return type:
int
.. method:: getNumDropped()

The number of users who are dropped the anime.

Return type:
int
.. method:: getNumPlanToWatch()

The number of users who plan to watch the anime.

Return type:
int

Studio

Methods
:ref:`getId() <getIdStudio>`
:ref:`getName() <getNameStudio>`
Parameters:
  • id (int) - ID of the Anime Studio.
  • name (str) - Name of the Anime Studio.

Methods

.. method:: getId()
    :noindex:

Studio ID.

Return type:
int
.. method:: getName()
    :noindex:

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

.. c:enum:: enums.airingStatusEnum.AiringStatusEnum

Key Value
finished_airing Finished airing
currently_airing Currently airing
not_yet_aired Not yet aired

DayWeekEnum

.. c:enum:: enums.dayWeekEnum.DayWeekEnum

Key Value
sunday 0
monday 1
tuesday 2
wednesday 3
thursday 4
friday 5
saturday 6

FieldsEnum

.. c: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 :ref:`getAnimeList() <getAnimeList>`, :ref:`getAnimeListInDict() <getAnimeListInDict>` and :ref:`getAnimeListInJSON() <getAnimeListInJSON>` methods.

MediaTypeEnum

.. c:enum:: enums.mediaTypeEnum.MediaTypeEnum

Key Value
unknown 0
tv 1
ova 2
movie 3
special 4
ona 5
music 6

NsfwEnum

.. c: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

.. c: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

.. c: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

.. c:enum:: enums.seasonEnum.SeasonEnum

Key Value
winter Winter
spring Spring
summer Summer
fall Fall

SourceEnum

.. c: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