3.2 KiB
jmcomic
Python API for JMComic(禁漫天堂)
Features
-
Bypasses Cloudflare anti-bot measures.
-
Multiple usage ways:
-
GitHub Actions: Requires only a GitHub account. (See tutorial → Tutorial - Download Album via GitHub Actions)
-
Command line: No need to write Python code, simple and easy to use. (See tutorial → Tutorial - Download Album via Command Line)
-
Python code: The most flexible and powerful way, requires some basic knowledge of Python programming.
-
-
Supports two client implementations: web-based and mobile-based. Switchable through configuration (mobile-based has better IP compatibility, web-based has higher efficiency).
-
Supports automatic request retry and domain switching mechanism.
-
Multi-threaded downloading (can be fine-tuned to one thread per image, highly efficient).
-
Highly configurable:
- Can be used without configuration, very convenient.
- Configuration can be generated from a configuration file, supports multiple file formats.
- Configuration options
include:
request domain
,client implementation
,number of chapters/images downloaded simultaneously
,image format conversion
,download path rules
,request metadata (headers, cookies, proxies)
, and more.
-
Highly extensible:
- Supports Plugin plugins for easy functionality extension and use of other plugins.
- Currently built-in
plugins:
login plugin
,hardware usage monitoring plugin
,only download new chapters plugin
,zip compression plugin
.
- Currently built-in
plugins:
- Supports custom callback functions before and after downloading album/chapter/images.
- Supports custom debug logging.
- Supports custom core
classes:
Downloader (responsible for scheduling)
,Option (responsible for configuration)
,Client (responsible for requests)
,entity classes
, and more.
- Supports Plugin plugins for easy functionality extension and use of other plugins.
Install
- Install via official pip source (recommended, and also used for updates):
pip install jmcomic -i https://pypi.org/project --upgrade
- Install via GitHub code:
pip install git+https://github.com/hect0x7/JMComic-Crawler-Python
Getting Started
1. Download album:
- Python code
import jmcomic
# Pass the ID of the album you want to download, and it will download all chapters of the album to your local machine.
jmcomic.download_album('422866')
- Command line
jmcomic 422866
2. Customize download behavior using an option:
For example, if you want to convert all downloaded images to the .jpg format, you can create a YAML file with the following content (refer to option file syntax):
download:
image:
suffix: .jpg # Don't forget the '.'
Then, use one of the following ways:
- Python code
from jmcomic import download_album, create_option
option = create_option('/path/to/your/optionfile')
download_album('422866', option)
- Command line
jmcomic 422866 --option="/path/to/your/optionfile"