Metadata-Version: 2.5
Name: getjmanga
Version: 0.0.0
Summary: Retrieve and save images from japanese web comic sites
Project-URL: Documentation, https://eggplants.github.io/getjmanga/
Project-URL: Issues, https://github.com/eggplants/getjmanga/issues
Project-URL: Repository, https://github.com/eggplants/getjmanga
Author-email: eggplants <w10776e8w@yahoo.co.jp>
License: MIT
License-File: LICENSE.txt
Keywords: cli,comici,downloader,gigaviewer,japanese,manga,manga-downloader,piccoma,scraping
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: beautifulsoup4>=4.12
Requires-Dist: cryptography>=43
Requires-Dist: pathvalidate>=3.2
Requires-Dist: pillow>=10.4
Requires-Dist: requests>=2.32
Requires-Dist: rich>=13.7
Description-Content-Type: text/markdown

# getjmanga

[![PyPI](
  <https://img.shields.io/pypi/v/getjmanga?color=blue>
  )](
  <https://pypi.org/project/getjmanga/>
) [![CI](
  <https://github.com/eggplants/getjmanga/actions/workflows/ci.yml/badge.svg>
  )](
  <https://github.com/eggplants/getjmanga/actions/workflows/ci.yml>
)

[![ghcr size](
  <https://ghcr-badge.egpl.dev/eggplants/getjmanga/size>
)](
  <https://github.com/eggplants/getjmanga/pkgs/container/getjmanga>
)

Retrieve and save images from japanese web comic sites.

_Note: Redistribution of downloaded image data is prohibited. Please keep it to private use._

## Supported sites

See [docs/SUPPORTED_SITES.md](docs/SUPPORTED_SITES.md).

## Installation

```bash
# mise via github release
mise use -g github:eggplants/getjmanga

# mise via pipx
mise use -g pipx:getjmanga

# pipx
pipx install getjmanga

# pip
pip install getjmanga
```

### Docker

```bash
docker pull ghcr.io/eggplants/getjmanga

docker run --rm -v "$PWD:/work" -w /work \
  ghcr.io/eggplants/getjmanga https://takecomic.jp/episodes/74f33031e13cd
```

## CLI

```shellsession
# one episode
jm https://takecomic.jp/episodes/74f33031e13cd https://piccoma.com/web/viewer/8195/1185884

# episodes in bulk
jm -b https://shonenjumpplus.com/episode/13932016480028799982

# login
jm -u you@example.com https://piccoma.com/web/viewer/8195/1185884
```

| Option | Description |
| --- | --- |
| `-b`, `--bulk` | follow every next episode |
| `-d DIR`, `--savedir DIR` | directory to save into (default: `.`) |
| `-f`, `--first` | download only the first page |
| `-o`, `--overwrite` | download again if it exists |
| `-m`, `--metadata` | save episode metadata as `metadata.json` |
| `-u ID`, `--username ID` | id or email address to log in with |
| `-p PW`, `--password PW` | password (prompted for if `-u` is given without it) |
| `-e NAME`, `--extractor NAME` | use this extractor instead of picking one by the url's host |
| `-c FILE`, `--config FILE` | config file holding site credentials (default: `~/.config/getjmanga/config.toml`) |
| `-q`, `--quiet` | disable console output |
| `--list-extractors` | list every extractor, its URL shapes and its hosts |

### Configuration

```toml
# site.<host>
[site."shonenjumpplus.com"]
username = "you@example.com"
password = "..."

# site.<extractor>
[site.comici-plus]
username = "comici-id"
password = "..."

[site.piccoma]
username = "you@example.com"
# no password: it is prompted for once per run
```

## Library

```python
from getjmanga import Downloader, find_extractor

url = "https://takecomic.jp/episodes/74f33031e13cd"
extractor = find_extractor(url)()      # -> Comici
result = Downloader(extractor, "out").download(url)
print(result.status, result.save_dir, result.episode.next_url)
```

An extractor on its own reads without writing anything:

```python
from getjmanga import Comici

comici = Comici()
for url in comici.series_urls("https://takecomic.jp/series/b167ea507d35f"):
    episode = comici.episode(url)
    print(episode.episode_title, len(episode.pages), episode.readable)
```

### Writing an extractor

See [docs/ADD_SITE.md](docs/ADD_SITE.md).

## License

[MIT License](
  <https://github.com/eggplants/getjmanga/blob/master/LICENSE.txt>
)
