mangal
mangal copied to clipboard
π The most advanced (yet simple) cli manga downloader in the entire universe! Lua scrapers, export formats, anilist integration, fancy TUI and more!
Mangal 3 π
The most advanced CLI manga downloader in the entire universe!
https://user-images.githubusercontent.com/62389790/183284495-86140f8b-d543-4bc4-a413-37cb07c1552e.mov
Try it!
curl -sfL https://raw.githubusercontent.com/metafates/mangal/main/run | bash
Note This script does not install anything, it just downloads, verifies and runs Mangal.
Linux / macOS only
Table of contents
- Features
- Installation
- Usage
- Configuration
- Custom scrapers
- Anilist
Features
- Lua Scrapers!!! You can add any source you want by creating your own (or using someone's else) scraper with Lua 5.1. See mangal-scrapers repository
- Download & Read Manga - I mean, it would be strange if you couldn't, right?
- 4 Different export formats - PDF, CBZ, ZIP and plain images
- 3 Different modes - TUI, Mini and Inline
- Fast? - YES.
- Monolith - ZERO runtime dependencies. Even Lua is built in.
- Fancy - (οΎ>Ο<)οΎ :qο½₯::ο½₯οΎββ ,qο½₯:ο½₯οΎββ
- Cross-Platform - Linux, macOS, Windows. Sorry, *BSD users...
- Anilist integration - Track your manga progress on Anilist when reading with Mangal.
Installation
- Go (any OS)
- Arch
- Linux / macOS
- Windows
- Docker
- Manual
Go (Any OS)
Visit this link to install Go
go install -ldflags="-s -w" github.com/metafates/mangal@latest
Note
-ldflags="-s -w"
makes the binary smallerUse this method if others are not working for some reason. And please open an issue if so
Arch Linux
AUR package (by @balajsra)
Linux / macOS
Install using Homebrew
brew tap metafates/mangal
brew install mangal
Install using this bash script
curl -sfL https://raw.githubusercontent.com/metafates/mangal/main/install | bash
Windows
Install using Scoop
scoop bucket add metafates https://github.com/metafates/scoop-metafates
scoop install mangal
Docker
Install using... well, you know. (thanks to @ArabCoders for reference)
docker pull metafates/mangal
To run
docker run --rm -ti -e "TERM=xterm-256color" -v $(PWD)/mangal/downloads:/downloads -v $(PWD)/mangal/config:/config metafates/mangal
Manual
Pre-compiled
Download the pre-compiled binaries from the releases page and copy them to the desired location.
From source
You will need Go (and git)
git clone --depth 1 https://github.com/metafates/mangal.git
cd mangal
go install -ldflags="-s -w"
Usage
TUI
Just run mangal
and you're ready to go.
Mini
Mini mode tries to mimic ani-cli
To run: mangal mini

Inline
Inline mode is intended for use with other scripts.
Example of usage:
mangal inline --source Manganelo --query "death note" --manga first --chapters "@Vol.1 @" -d
This will download the first volume of "Death Note" from Mangalelo.
Type mangal help inline
for more information
Other
See mangal help
for more information
Configuration
Mangal uses TOML format for configuration under the mangal.toml
filename.
Config is expected to be at the OS default config directory.
For example, on Linux it would be ~/.config/mangal/mangal.toml
.
Use env variable MANGAL_CONFIG_PATH
to set custom config path.
See
mangal env
to show all available env variables.
Run mangal where
to show expected config paths
Run mangal config init
to generate a default config file
# mangal.toml
[downloader]
# Default source to use
# Will prompt to choose if empty
# Type `mangal sources` for available sources
default_source = ''
# Name template of the downloaded chapters
# Available variables:
# {index} - index of the chapters
# {padded-index} - same as index but padded with leading zeros
# {chapter} - name of the chapter
# {manga} - name of the manga
chapter_name_template = '[{padded-index}] {chapter}'
# Where to download manga
# Absolute or relative.
#
# You can also use home variable
# path = "~/..." or "$HOME/..."
path = '.'
# Use asynchronous downloader (faster)
# Do no turn it off unless you have some issues
async = true
# Create a subdirectory for each manga
create_manga_dir = true
# Stop downloading other chapters on error
stop_on_error = false
[formats]
# Default format to export chapters
# Available options are: pdf, zip, cbz, plain
use = 'pdf'
# Will skip images that can't be converted to the specified format
# Example: if you want to export to pdf, but some images are gifs, they will be skipped
skip_unsupported_images = true
[history]
# Save chapters to history when downloaded
save_on_download = false
# Save chapters to history on read
save_on_read = true
[icons]
# Icons variant.
# Available options are: emoji, kaomoji, plain, squares, nerd (nerd-font)
variant = 'plain'
[mangadex]
# Preferred language
language = 'en'
# Show nsfw manga/chapters
nsfw = false
# Show chapters that cannot be read (because they are hosted on a different site)
show_unavailable_chapters = false
[mini]
# Limit number of search page entries
search_limit = 20
[reader]
# Name of the app to use as a reader for each format.
# Will use default OS app if empty
pdf = '' # e.g. pdf = 'zathura'
cbz = ''
zip = ''
plain = ''
# Will open chapter in the browser instead of downloading it
read_in_browser = false
[installer]
# Custom scrapers repository (github only)
repo = 'mangal-scrapers'
# Custom scrapers repository owner
user = 'metafates'
# Custom scrapers repository branch
branch = 'main'
[logs]
# write logs?
write = false
# Available options are: (from less to most verbose)
# panic, fatal, error, warn, info, debug, trace
level = "info"
Custom scrapers
TLDR; To browse and install a custom scraper from mangal-scrapers repository run
mangal install
Mangal has a Lua5.1 VM built-in + some useful libraries, such as headless chrome, http client, html parser and so on...
Check the defined modules for more information.
For scraper examples, check the mangal-scrapers repository
Creating a custom scraper
- Create a new lua file in the
mangal where --sources
folder - Filename will be used as a source name
- Your script must contain 3 essential functions
-
SearchManga(query)
- must return a table of tables each having 2 fieldsname
andurl
-
MangaChapters(mangalUrl)
- must return a table of tables each having 2 fieldsname
andurl
(again) -
ChapterPages(chapterUrl)
- must return a table of tables each having 2 fieldsindex
(for ordering) andurl
(to download image)
-
-
That's it! You can test it by running
mangal run ...
where...
is a filename
New to Lua? Quick start guide
Anilist
Mangal also supports integration with anilist.
It will mark chapters as read on Anilsit when you read them inside mangal.
For more information see wiki
Maybe I'll add more sites in the future, like myanimelist. Open to suggestions!