API Reference

The following sections lines out the Manga class, as well as how to fetch one from the API.

Manga

class aiomangadex.Manga

Represents part of result of https://mangadex.org/api/manga/{id}

id

Manga id

Type:int
cover_url

URL to manga cover

Type:string
description
Type:str
rating
Type:dict
alt_names
Type:List[ str ]
title
Type:str
artist
Type:str
author
Type:str
status
Type:int
genres
Type:List[ str ]
last_chapter
Type:int
lang_name
Type:str
lang_flag
Type:str
hentai
Type:bool
Type:dict
chapters
Type:ChapterList
session
Type:aiohttp.ClientSession

Warning

Some of the chapter data is not included in the initial fetch, meaning you’ll have to fetch the missing things in aiomangadex.Chapter.

Chapter

class aiomangadex.Chapter

Representation of the chapter model

id

ID of the chapter

Type:int
manga_id

ID of the chapter’s manga

Type:int
volume

Which volume the chapter is in

Type:int
hash

Chapter hash used in the img links

Type:str
chapter

Chapter Number

Type:float
title

Chapter Title

Type:str
lang_code

Language of the translation

Type:str
lang_name

Language of the translation

Type:str
group_id

Scanlation Group 1

Type:int
group_name

Scanlation Group 1

Type:str
group_id_2

Scanlation Group

Type:int
group_name_2

Scanlation Group

Type:str
group_id_3

Scanlation Group

Type:int
group_name_3

Scanlation Group

Type:str
timestamp
Type:int
comments

Amount of comments

Type:int
server

Server chapter is hosted on, used for the img urls

Type:str
page_array

Array with links to the pages

Type:List[str]
long_strip

Whether Chapter is in strip format

Type:bool
status

Status

Type:str
Links to the pages.
This is not provided by the api, but put together by the library.
Type:List[str]
session

The session passed initially, or the one created by the library if None was passed.

Type:aiohttp.ClientSession

Warning

If this wasn’t fetched through fetch_chapter() it is missing some information coming from another API endpoint, like the links to the pages. This is fetched automatically if you use download_pages() or download_all_pages(). To just fetch the missing data, use fetch_pages()

download_all_pages(data_saver: bool = True)

Used to download all pages.

Warning

Fast because it runs all download simultaneously. Keep this in mind if you use it often, as you might get banned.

Parameters:data_saver (bool) – Whether to use the data-saver obtion or not.
Returns:List of downloaded pages.
Return type:List [ io.BytesIO ]
download_page(page: int, data_saver: bool = True)
Parameters:
  • page (int) – Index of page to download
  • data_saver (bool, optional) – Whether to use the mangadex datasaver mode for images. Defaults to True.
Returns:

A buffer with the image.

Return type:

io.BytesIO

ChapterList

class aiomangadex.ChapterList

A class used for managing and filtering a Manga Instance’s chapters.

filter_chapter_number(*numbers) → aiomangadex.chapter.ChapterList

Filter by chapter number, connected by logical OR. Returns a ChapterList of the chapters with according chapter numbers.

Returns:ChapterList
filter_id(*ids) → aiomangadex.chapter.ChapterList

Filter by id, connected by logical OR. Returns ChapterList of chapters with corresponding ids.

Returns:ChapterList
filter_language(*lang) → aiomangadex.chapter.ChapterList

Filter by languages, connected by logical OR. Returns a ChapterList of the chapters with corresponding languages.

Returns:ChapterList
filter_title(*titles, difference_cutoff: float = 0.8) → aiomangadex.chapter.ChapterList

Filter by titles, connected by logical OR. Returns a ChapterList of the chapters with corresponding titles.

Returns:ChapterList

Fetching

aiomangadex.fetch_manga(manga_id: int, session: aiohttp.client.ClientSession = None) → aiomangadex.manga.Manga

Used to fetch a manga object by id. :param manga_id: manga id, as in the url :type manga_id: int :param session: It is recommended to create your own Session, especially if you intend to fetch more than one manga. :type session: Optional[ aiohttp.ClientSession ]

Returns:Manga Instance
Return type:manga ( aiomangadex.Manga )
aiomangadex.fetch_chapter(chapter_id: int, session: aiohttp.client.ClientSession = None)
Parameters:
  • chapter_id (int) – hh
  • session (int) – hi
Returns:

Chapter

Return type:

Chapter