mangalib-python-sdk
Асинхронный Python SDK для mangalib.me: метаданные тайтлов, главы, переводы, каталог и изображения страниц.
Установка
Установите пакет из PyPI. Нужен Python 3.11 или новее.
$ uv add mangalib-python-sdk # или $ pip install mangalib-python-sdk
Быстрый старт
from mangalib import Catalog, MangaLib
async with MangaLib("https://mangalib.me/ru/manga/7965--chainsaw-man") as lib:
info = await lib.get_info()
toc = await lib.get_table_of_contents()
# Chapter 1 has two translations: pick one (see get_translations()).
translations = await lib.get_translations(volume=1, number="1")
chapter = await lib.get_chapter(volume=1, number="1", branch_id=translations[0].branch_id)
for page in chapter.pages:
print(page.number, page.width, page.height)
images = await lib.download_pages(chapter) # list[bytes], in reading order
# One chapter, several, a volume, or the whole title, into one file.
await lib.export([chapter], fmt="cbz", path="chainsaw-man-1.cbz")
volumes = await lib.download_title(translation_index=0, on_chapter=print)
await lib.export(volumes, fmt="pdf", path="chainsaw-man.pdf", on_chapter=print)
size = await lib.estimate_title_size() # bytes of page images, from a sample
async with Catalog() as catalog:
page = await catalog.list_titles(query="chainsaw")