Skip to main content

mangalib-python-sdk

PyPI License: MIT Python versions CI

Async Python SDK for mangalib.me: title metadata, table of contents, translations, catalog search, chapter pages as images, and export to CBZ or PDF.

Like ranobelib-python-sdk, it talks to the undocumented but open JSON API behind the site (api.cdnlibs.org, shared by the whole lib.social network) instead of scraping HTML. The shared part (API client, request pacing, cache, titles, chapters, catalog) comes from libsocial-core, installed with it, so a process using both SDKs paces its requests to the API together.

Status: early. There is no login, so paid and early-access chapters can't be read: fetching one raises AuthRequiredError, and a whole-title download leaves them out.

Installation

uv add mangalib-python-sdk

or

pip install mangalib-python-sdk

PDF export needs the pdf extra (img2pdf): uv add "mangalib-python-sdk[pdf]" / pip install "mangalib-python-sdk[pdf]". Without it, "pdf" just isn't one of the export formats. Requires Python 3.11+.

Quickstart

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")
  • get_chapter() / get_chapters() / get_volume() / get_volumes() / download_title() return chapters with pages (Page: position, size, path on an image server).
  • ChapterBranch.is_open (from get_table_of_contents() / get_translations()) says whether a translation can be read without an account.
  • download_page() / download_pages() fall back from one image server to the next; see list_image_servers() and the API notes for why compress is tried first. Requests to an image host are paced across the process and retried on 429/5xx; concurrency= sets how many pages are fetched at once.
  • export() writes "cbz" (pages in order + ComicInfo.xml) or "pdf" (a page per image, an outline entry per chapter); mangalib.exporters.EXPORTERS lists what's available.
  • chapter_size() / volume_size() give the exact size of the page images, from HEAD requests; estimate_title_size() extrapolates from a sample of chapters.

Documentation

Full API reference: https://LLIJIYAPNIK.github.io/libsocial-sdk/. What the API returns for MangaLib, and what was checked: the "MangaLib" section of docs/api-notes.md. CHANGELOG.md lists what changed in each release.

License

MIT — see LICENSE.

Metadata

Release files for mangalib-python-sdk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mangalib-python-sdk 0.2.0
File Size Uploaded Provenance
mangalib_python_sdk-0.2.0.tar.gz 24.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mangalib-python-sdk 0.2.0
File Interpreter ABI Platform
mangalib_python_sdk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 54.8 kB

Release files / mangalib_python_sdk-0.2.0.tar.gz

Download URL mangalib_python_sdk-0.2.0.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
dd072cc1ba61ad25cd94ab59e23f960ac2ba0d9894365a5b21de10b7702f2e50
BLAKE2b-256 checksum
How to use checksums
d1644bbdd5329619f66b8d53be9b0a74598275d11725ebfcaf2832bc96084435
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mangalib_python_sdk-0.2.0-py3-none-any.whl

Download URL mangalib_python_sdk-0.2.0-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f8e5bbf12ff38c40a1766242376641f47f29ffdf8c52fc3bc3945f88c3fc0b1
BLAKE2b-256 checksum
How to use checksums
6abfc11f17d7502aa9f3d82f9b497766bdde4fff0569ee038aee63352109c726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for mangalib-python-sdk 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page