JikanPy Reference Docs¶
Jikan¶
-
class
jikanpy.
Jikan
(selected_base: Optional[str] = None, session: Optional[requests.sessions.Session] = None)¶ Synchronous Jikan wrapper for the jikan.moe unofficial MyAnimeList API.
Note that the API has a limit of 30 requests/minute and 2 requests/second; this module does not make any effort to prevent abuse of that limit, so use it responsibly.
- Usage Example:
from jikanpy import Jikan jikan = Jikan()
-
base
¶ The base URL of the Jikan API being accessed.
-
session
¶ The Requests session.
-
__init__
(selected_base: Optional[str] = None, session: Optional[requests.sessions.Session] = None) → None¶ Constructs the Jikan object.
Parameters: - selected_base (str, optional) – Base url of Jikan API. Defaults to the official Jikan API URL.
- session (requests.Session, optional) – to a new Requests session object.
Returns: Instance of Jikan.
Return type: Examples
>>> jikan_1 = Jikan() >>> jikan_2 = Jikan(selected_base='http://localhost:8000/v4') >>> jikan_3 = jikan = Jikan(session=requests.Session())
-
anime
(id: int, extension: Optional[str] = None, page: Optional[int] = None) → Dict[str, Any]¶ Gets information on an anime.
Parameters: - id (
int
) – ID of the anime to get the information of. - extension (
str
, optional) – Special information (via URL param) to get of the anime. Possible values are in the Jikan API documentation. Defaults to None. - page (
int
, optional) – Page number of the results. Defaults to None.
Returns: Dictionary containing information about the anime.
Return type: Dict
Examples
>>> jikan.anime(14719) >>> jikan.anime(14719, extension='episodes') >>> jikan.anime(14719, extension='episodes', page=2) >>> jikan.anime(14719, extension='news')
- id (
-
anime_episode_by_id
(anime_id: int, episode_id: int) → Dict[str, Any]¶ Gets episode by anime ID and episode ID.
Parameters: - anime_id (
int
) – ID of the anime to get the episode of. - episode_id (
int
) – ID of the episode to get.
Returns: Dictionary containing information about the episode.
Return type: Dict
Examples
>>> jikan.anime_episode_by_id(anime_id=1, episode_id=1)
- anime_id (
-
characters
(id: int, extension: Optional[str] = None) → Dict[str, Any]¶ Gets information on a character.
Parameters: - id (
int
) – ID of the character to get the information of. - extension (
str
, optional) – Special information (via URL param) to get of the character. Possible values are in the Jikan API documentation. Defaults to None.
Returns: Dictionary containing information about the character.
Return type: Dict
Examples
>>> jikan.characters(6356)
- id (
-
clubs
(id: int, extension: Optional[str] = None) → Dict[str, Any]¶ Gets information on a club.
Parameters: - id (
int
) – ID of the club to get the information of. - extension (
str
, optional) – Special information (via URL param) to get of the club. Possible values are in the Jikan API documentation. Defaults to None.
Returns: Dictionary containing information about the club.
Return type: Dict
Examples
>>> jikan.clubs(379)
- id (
-
genres
(type: str, filter: Optional[str] = None) → Dict[str, Any]¶ Gets anime or manga by genre.
Parameters: - type (
str
) – Type to get items from. Possible values are anime and manga. - filter (
str
, optional) – Filter genres by “genres”, “explicit_genres”, “themes”, or “demographics”. Defaults to None.
Returns: Dictionary containing MAL genres and search URLs
Return type: Dict
Examples
>>> jikan.genres(type='anime') >>> jikan.genres(type='manga', filter='themes')
- type (
-
magazine
(magazine_id: int, page: Optional[int] = None) → Dict[str, Any]¶ Deprecated: Gets Magazine information by ID.
-
manga
(id: int, extension: Optional[str] = None, page: Optional[int] = None) → Dict[str, Any]¶ Gets information on a manga.
Parameters: - id (
int
) – ID of the manga to get the information of. - extension (
str
, optional) – Special information (via URL param) to get of the manga. Possible values are in the Jikan API documentation. Defaults to None. - page (
int
, optional) – Page number of the results. Defaults to None.
Returns: Dictionary containing information about the manga.
Return type: Dict
Examples
>>> jikan.manga(1630)
- id (
-
meta
(request: str, type: Optional[str] = None, period: Optional[str] = None, offset: Optional[int] = None) → Dict[str, Any]¶ Deprecated: Gets meta information.
-
people
(id: int, extension: Optional[str] = None) → Dict[str, Any]¶ Gets information on a person.
Parameters: - id (
int
) – ID of the person to get the information of. - extension (
str
, optional) – Special information (via URL param) to get of the person. Possible values are in the Jikan API documentation. Defaults to None.
Returns: Dictionary containing information about the person.
Return type: Dict
Examples
>>> jikan.people(2) >>> jikan.people(2, extension='pictures') >>> jikan.people(2, extension='pictures', parameters={'limit': 10} )
- id (
-
producers
(id: int, extension: Optional[str] = None) → Dict[str, Any]¶ Gets anime by the producer/studio/licensor.
Parameters: - id (
int
, optional) – Producer ID from MyAnimeList. - extension (
str
, optional) – Special information (via URL param) to get of the producer. Possible values are in the Jikan API documentation. Defaults to None.
Returns: Dictionary containing producer information
Return type: Dict
Examples
>>> jikan.producers(id=4) >>> jikan.producers(id=4, extension='full') >>> jikan.producers(id=4, extension='external')
- id (
-
random
(type: str) → Dict[str, Any]¶ Gets a random type resource.
Parameters: type ( str
) – Type of resource to get. Available types are: anime, manga, characters, people, users.Returns: Dictionary containing resource information. Return type: Dict Examples
>>> jikan.random(type='anime') >>> jikan.random(type='characters') >>> jikan.random(type='users')
-
recommendations
(type: str, page: Optional[int] = None) → Dict[str, Any]¶ Gets recommendations for type resource.
Parameters: - type (
str
) – Type of of resource to get. Available types are: anime and manga. - page (
int
, optional) – Page number of the results. Defaults to None.
Returns: Dictionary containing resource information.
Return type: Dict
Examples
>>> jikan.recommendations(type='anime') >>> jikan.recommendations(type='manga', page=2)
- type (
-
reviews
(type: str, page: Optional[int] = None) → Dict[str, Any]¶ Gets reviews for type resource.
Parameters: - type (
str
) – Type of of resource to get. Available types are: anime and manga. - page (
int
, optional) – Page number of the results. Defaults to None.
Returns: Dictionary containing resource information.
Return type: Dict
Examples
>>> jikan.reviews(type='anime') >>> jikan.reviews(type='manga', page=2)
- type (
-
schedules
(day: Optional[str] = None, page: Optional[int] = None, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ Gets anime scheduled.
Parameters: - day (
str
, optional) – Day of the week to get the scheduled anime. Defaults to None. - page (
int
, optional) – Page number of the results. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Defaults to None.
Returns: Dictionary containing anime scheduled.
Return type: Dict
Examples
>>> jikan.schedules() >>> jikan.schedules(day='monday')
- day (
-
search
(search_type: str, query: str, page: Optional[int] = None, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ Searches for a query on MyAnimeList.
Parameters: - search_type (
str
) – Where to search. Possible values are anime, characters, clubs, magazines, manga, people, producers, and users. - query (
str
) – Query to search for. - page (
int
, optional) – – Page number of the results. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Check API doc for information on the parameters each search endpoint accepts. Defaults to None.
Returns: Dictionary containing search results.
Return type: Dict
Examples
>>> jikan.search('anime', 'Jojo') >>> jikan.search('anime', 'Jojo', page=2) >>> jikan.search('anime', 'Jojo', parameters={'type': 'tv'}) >>> jikan.search( 'anime', 'Jojo', page=2, parameters={'genre': 37, 'type': 'tv'} )
- search_type (
-
season_history
() → Dict[str, Any]¶ Gets all the years and their respective season names from MyAnimeList.
Returns: Dictionary containing all the years and season names. Return type: Dict Examples
>>> jikan.season_history()
-
seasons
(year: Optional[int] = None, season: Optional[str] = None, extension: Optional[str] = None, page: Optional[int] = None, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ - Gets information on anime of the specific season or the current seasaon if
- no parameters are specified.
Parameters: - year (
int
, optional) – Year to get anime of. Defaults to None. - season (
str
, optional) – Season to get anime of. Possible values are winter, spring, summer, and fall. Defaults to None. - extension (
str
, optional) – Special information (via URL param) to get of the season. Possible values are in the Jikan API documentation. Note: getSeasonsList is unsupported here, instead use season_history. Defaults to None. - page (
int
, optional) – Page number of the results. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Defaults to None.
Returns: Dictionary containing information on anime of the season.
Return type: Dict
Examples
>>> jikan.seasons() >>> jikan.seasons(year=2018, season='winter') >>> jikan.seasons(year=2016, season='spring') >>> jikan.seasons(extension='now') >>> jikan.seasons(extension='upcoming') >>> jikan.seasons( year=2021, season='winter', page=2, parameters={'filter': 'tv'} )
-
top
(type: str, page: Optional[int] = None, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ Gets top items on MyAnimeList.
Parameters: - type (
str
) – Type to get top items from. Possible values are anime, manga, people, characters, and reviews. - page (
int
, optional) – Page number of the results. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Defaults to None.
Returns: Dictionary containing top items on MyAnimeList.
Return type: Dict
Examples
>>> jikan.top(type='manga') >>> jikan.top(type='anime', page=2)
- type (
-
user_by_id
(user_id: int) → Dict[str, Any]¶ Gets user name and url from MAL ID
Parameters: user_id ( int
) – MyAnimeList user IDReturns: Dictionary containing information about the user ID Return type: Dict Examples
>>> jikan.user_by_id(user_id=1)
-
static
user_list
(id: int, extension: Optional[str] = None) → Dict[str, Any]¶ Deprecated: Gets user list information.
-
users
(username: str, extension: Optional[str] = None, page: Optional[int] = None, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ Gets information about the user.
Parameters: - username (
str
) – MyAnimeList username. - extension (
str
, optional) – Special information (via URL param) to get of the producer. Possible values are in the Jikan API documentation. Defaults to None. - page (
int
, optional) – Page number of the results. Check API doc for information on which extensions accept paging. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Defaults to None.
Returns: Dictionary containing information about the user.
Return type: Dict
Examples
>>> jikan.users(username='Xinil') >>> jikan.users(username='Xinil', extension='full') >>> jikan.users(username='Xinil', extension='friends', page=2) >>> jikan.users(username='Xinil', extension='history', parameters={'type': 'anime'})
- username (
-
watch
(extension: str, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ Gets information about recent activity of type resource.
Parameters: - extension (
str
, optional) – Special information (via URL param) to get of the producer. Possible values are in the Jikan API documentation. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Defaults to None.
Returns: Dictionary containing information about recent/popular episodes or promos
Return type: Dict
Examples
>>> jikan.watch(extension='episodes') >>> jikan.watch(extension='episodes/popular') >>> jikan.watch(extension='promos') >>> jikan.watch(extension='promos/popular', parameters={'limit': 10})
- extension (
AioJikan¶
-
class
jikanpy.
AioJikan
(selected_base: Optional[str] = None, session: Optional[aiohttp.client.ClientSession] = None)¶ Asynchronous Jikan wrapper for the jikan.moe unofficial MyAnimeList API.
Note that the API has a limit of 30 requests/minute and 2 requests/second; this module does not make any effort to prevent abuse of that limit, so use it responsibly.
- Usage Example:
import asyncio from jikanpy import AioJikan async def main(): async with AioJikan() as aio_jikan: pass # You can also construct AioJikan like below, but make sure to close # the object aio_jikan_2 = AioJikan() await aio_jikan_2.close() asyncio.run(main())
-
base
¶ The base URL of the Jikan API being accessed.
-
session
¶ The aiohttp session.
-
__init__
(selected_base: Optional[str] = None, session: Optional[aiohttp.client.ClientSession] = None) → None¶ Constructs the AioJikan object.
Parameters: - selected_base (str, optional) – Base url of Jikan API. Defaults to the official Jikan API URL.
- session (aiohttp.ClientSession, optional) – Defaults to a new aiohttp session object.
Returns: Instance of AioJikan.
Return type: Examples
>>> aio_jikan_1 = AioJikan() >>> aio_jikan_2 = AioJikan(selected_base='http://localhost:8000/v4') >>> aio_jikan_3 = AioJikan( session=aiohttp.ClientSession(headers={'x-test': 'true'}) )
-
anime
(id: int, extension: Optional[str] = None, page: Optional[int] = None) → Dict[str, Any]¶ Gets information on an anime.
Parameters: - id (
int
) – ID of the anime to get the information of. - extension (
str
, optional) – Special information (via URL param) to get of the anime. Possible values are in the Jikan API documentation. Defaults to None. - page (
int
, optional) – to None.
Returns: Dictionary containing information about the anime.
Return type: Dict[str, Any]
Examples
>>> await jikan.anime(14719) >>> await jikan.anime(14719, extension='episodes') >>> await jikan.anime(14719, extension='episodes', page=2) >>> await jikan.anime(14719, extension='news')
- id (
-
anime_episode_by_id
(anime_id: int, episode_id: int) → Dict[str, Any]¶ Gets episode by anime ID and episode ID.
Parameters: - anime_id (
int
) – ID of the anime to get the episode of. - episode_id (
int
) – ID of the episode to get.
Returns: Dictionary containing information about the episode.
Return type: Dict
Examples
>>> await jikan.anime_episode_by_id(anime_id=1, episode_id=1)
- anime_id (
-
characters
(id: int, extension: Optional[str] = None) → Dict[str, Any]¶ Gets information on a character.
Parameters: - id (
int
) – ID of the character to get the information of. - extension (
str
, optional) – Special information (via URL param) to get of the character. Possible values are in the Jikan API documentation. Defaults to None.
Returns: Dictionary containing information about the character.
Return type: Dict
Examples
>>> await jikan.characters(6356)
- id (
-
close
() → None¶ Close AioHTTP session
-
clubs
(id: int, extension: Optional[str] = None) → Dict[str, Any]¶ Gets information on a club.
Parameters: - id (
int
) – ID of the club to get the information of. - extension (
str
, optional) – Special information (via URL param) to get of the club. Possible values are in the Jikan API documentation. Defaults to None.
Returns: Dictionary containing information about the club.
Return type: Dict
Examples
>>> await jikan.clubs(379)
- id (
-
genres
(type: str, filter: Optional[str] = None) → Dict[str, Any]¶ Gets anime or manga by genre.
Parameters: - type (
str
) – Type to get items from. Possible values are anime and manga. - filter (
str
, optional) – Filter genres by “genres”, “explicit_genres”, “themes”, or “demographics”. Defaults to None.
Returns: Dictionary containing MAL genres and search URLs
Return type: Dict
Examples
>>> await jikan.genres(type='anime') >>> await jikan.genres(type='manga', filter='themes')
- type (
-
magazine
(magazine_id: int, page: Optional[int] = None) → Dict[str, Any]¶ Deprecated: Gets Magazine information by ID.
-
manga
(id: int, extension: Optional[str] = None, page: Optional[int] = None) → Dict[str, Any]¶ Gets information on a manga.
Parameters: - id (
int
) – ID of the manga to get the information of. - extension (
str
, optional) – Special information to get of the manga. Possible values are in the Jikan API documentation. Defaults to None. - page (
int
, optional) – to None.
Returns: Dictionary containing information about the manga.
Return type: Dict
Examples
>>> await jikan.manga(1630)
- id (
-
meta
(request: str, type: Optional[str] = None, period: Optional[str] = None, offset: Optional[int] = None) → Dict[str, Any]¶ Deprecated: Gets meta information.
-
people
(id: int, extension: Optional[str] = None) → Dict[str, Any]¶ Gets information on a person.
Parameters: - id (
int
) – ID of the person to get the information of. - extension (
str
, optional) – Special information (via URL param) to get of the person. Possible values are in the Jikan API documentation. Defaults to None.
Returns: Dictionary containing information about the person.
Return type: Dict
Examples
>>> await jikan.people(2) >>> await jikan.people(2, extension='pictures') >>> await jikan.people(2, extension='pictures', parameters={'limit': 10} )
- id (
-
producers
(id: int, extension: Optional[str] = None) → Dict[str, Any]¶ Gets anime by the producer/studio/licensor.
Parameters: - id (
int
, optional) – Producer ID from MyAnimeList. - extension (
str
, optional) – Special information (via URL param) to get of the producer. Possible values are in the Jikan API documentation. Defaults to None.
Returns: Dictionary containing producer information
Return type: Dict
Examples
>>> await jikan.producers(producer_id=4) >>> await jikan.producers(id=4, extension='full') >>> await jikan.producers(id=4, extension='external')
- id (
-
random
(type: str) → Dict[str, Any]¶ Gets a random type resource.
Parameters: type ( str
) – Type of resource to get. Available types are: anime, manga, characters, people, users.Returns: Dictionary containing resource information. Return type: Dict Examples
>>> await jikan.random(type='anime') >>> await jikan.random(type='characters') >>> await jikan.random(type='users')
-
recommendations
(type: str, page: Optional[int] = None) → Dict[str, Any]¶ Gets recommendations for type resource.
Parameters: - type (
str
) – Type of of resource to get. Available types are: anime and manga. - page (
int
, optional) – Page number of the results. Defaults to None.
Returns: Dictionary containing resource information.
Return type: Dict
Examples
>>> await jikan.recommendations(type='anime') >>> await jikan.recommendations(type='manga', page=2)
- type (
-
reviews
(type: str, page: Optional[int] = None) → Dict[str, Any]¶ Gets reviews for type resource.
Parameters: - type (
str
) – Type of of resource to get. Available types are: anime and manga. - page (
int
, optional) – Page number of the results. Defaults to None.
Returns: Dictionary containing resource information.
Return type: Dict
Examples
>>> await jikan.reviews(type='anime') >>> await jikan.reviews(type='manga', page=2)
- type (
-
schedules
(day: Optional[str] = None, page: Optional[int] = None, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ Gets anime scheduled.
Parameters: - day (
str
, optional) – Day of the week to get the scheduled anime. Defaults to None. - page (
int
, optional) – Page number of the results. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Defaults to None.
Returns: Dictionary containing anime scheduled.
Return type: Dict
Examples
>>> await jikan.schedules() >>> await jikan.schedules(day='monday')
- day (
-
search
(search_type: str, query: str, page: Optional[int] = None, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ Searches for a query on MyAnimeList.
Parameters: - search_type (
str
) – Where to search. Possible values are anime, characters, clubs, magazines, manga, people, producers, and users. - query (
str
) – Query to search for. - page (
int
, optional) – Page number of the results. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Check API doc for information on the parameters each search endpoint accepts. Defaults to None.
Returns: Dictionary containing search results.
Return type: Dict
Examples
>>> await jikan.search('anime', 'Jojo') >>> await jikan.search('anime', 'Jojo', page=2) >>> await jikan.search('anime', 'Jojo', parameters={'type': 'tv'}) >>> await jikan.search( 'anime', 'Jojo', page=2, parameters={'genre': 37, 'type': 'tv'} )
- search_type (
-
season_history
() → Dict[str, Any]¶ Gets all the years and their respective season names from MyAnimeList.
Returns: Dictionary containing all the years and season names. Return type: Dict Examples
>>> await jikan.season_history()
-
seasons
(year: Optional[int] = None, season: Optional[str] = None, extension: Optional[str] = None, page: Optional[int] = None, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ - Gets information on anime of the specific season or the current seasaon if
- no parameters are specified.
Parameters: - year (
int
, optional) – Year to get anime of. Defaults to None. - season (
str
, optional) – Season to get anime of. Possible values are winter, spring, summer, and fall. Defaults to None. - extension (
str
, optional) – Special information (via URL param) to get of the season. Possible values are in the Jikan API documentation. Note: getSeasonsList is unsupported here, instead use season_history. Defaults to None. - page (
int
, optional) – Page number of the results. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Defaults to None.
Returns: Dictionary containing information on anime of the season.
Return type: Dict
Examples
>>> jikan.seasons() >>> jikan.seasons(year=2018, season='winter') >>> jikan.seasons(year=2016, season='spring') >>> jikan.seasons(extension='now') >>> jikan.seasons(extension='upcoming') >>> jikan.seasons( year=2021, season='winter', page=2, parameters={'filter': 'tv'} )
-
top
(type: str, page: Optional[int] = None, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ Gets top items on MyAnimeList.
Parameters: - type (
str
) – Type to get top items from. Possible values are anime, manga, people, characters, and reviews. - page (
int
, optional) – Page number of the results. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Defaults to None.
Returns: Dictionary containing top items on MyAnimeList.
Return type: Dict
Examples
>>> await jikan.top(type='manga') >>> await jikan.top(type='anime', page=2)
- type (
-
user_by_id
(user_id: int) → Dict[str, Any]¶ Gets user name and url from MAL ID
Parameters: user_id ( int
) – MyAnimeList user IDReturns: Dictionary containing information about the user ID Return type: Dict Examples
>>> await jikan.user_by_id(user_id=1)
-
user_list
(id: int, extension: Optional[str] = None) → Dict[str, Any]¶ Deprecated: Gets user list information.
-
users
(username: str, extension: Optional[str] = None, page: Optional[int] = None, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ Gets information about the user.
Parameters: - username (
str
) – MyAnimeList username. - extension (
str
, optional) – Special information (via URL param) to get of the producer. Possible values are in the Jikan API documentation. Defaults to None. - page (
int
, optional) – Page number of the results. Check API doc for information on which extensions accept paging. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Defaults to None.
Returns: Dictionary containing information about the user.
Return type: Dict
Examples
>>> await jikan.users(username='Xinil') >>> await jikan.users(username='Xinil', extension='full') >>> await jikan.users(username='Xinil', extension='friends', page=2) >>> await jikan.users(username='Xinil', extension='history', parameters={'type': 'anime'})
- username (
-
watch
(extension: str, parameters: Optional[Dict[str, Any]] = None) → Dict[str, Any]¶ Gets information about recent activity of type resource.
Parameters: - extension (
str
, optional) – Special information (via URL param) to get of the producer. Possible values are in the Jikan API documentation. Defaults to None. - parameters (
dict
, optional) – Dictionary containing key,value pairs for ?key=value in url query. Defaults to None.
Returns: Dictionary containing information about recent/popular episodes or promos
Return type: Dict
Examples
>>> await jikan.watch(extension='episodes') >>> await jikan.watch(extension='episodes/popular') >>> await jikan.watch(extension='promos') >>> await jikan.watch(extension='promos/popular', parameters={'limit': 10})
- extension (