0
# JMComic
1
2
A comprehensive Python API for accessing and downloading content from JMComic (禁漫天堂), a digital comic platform. JMComic provides advanced features including Cloudflare anti-bot bypass mechanisms, multi-client architecture with automatic domain switching, extensive plugin system, and robust download management capabilities.
3
4
## Package Information
5
6
- **Package Name**: jmcomic
7
- **Language**: Python
8
- **Installation**: `pip install jmcomic`
9
10
## Core Imports
11
12
```python
13
import jmcomic
14
```
15
16
Common usage patterns:
17
18
```python
19
from jmcomic import download_album, download_photo, create_option
20
```
21
22
For advanced usage:
23
24
```python
25
from jmcomic import JmDownloader, JmOption, JmAlbumDetail, JmPhotoDetail
26
```
27
28
## Basic Usage
29
30
```python
31
import jmcomic
32
33
# Simple album download using default settings
34
album, downloader = jmcomic.download_album("123456")
35
36
# Download with custom configuration
37
option = jmcomic.create_option_by_file("config.yml")
38
album, downloader = jmcomic.download_album("123456", option=option)
39
40
# Download multiple albums
41
album_ids = ["123456", "789012", "345678"]
42
results = jmcomic.download_batch(jmcomic.download_album, album_ids)
43
44
# Create a downloader with custom options
45
downloader = jmcomic.new_downloader(option)
46
album = downloader.download_album("123456")
47
```
48
49
## Architecture
50
51
JMComic uses a modular, plugin-based architecture designed for extensibility and reliability:
52
53
- **Multi-Client System**: Web scraping client with Cloudflare bypass and mobile API client with encryption support
54
- **Plugin Framework**: 18+ built-in plugins for various use cases with extensible plugin system
55
- **Entity Model**: Structured data models for albums, photos, images, and search results
56
- **Configuration System**: Flexible YAML/JSON configuration with environment variable support
57
- **Download Management**: Multi-threaded downloads with resume capabilities and error recovery
58
59
This design enables reliable content downloading while providing extensive customization through plugins and configuration options.
60
61
## Capabilities
62
63
### Core Download API
64
65
High-level download functions for albums and photos with batch processing capabilities. These functions provide the main interface for downloading content with automatic retry and error handling.
66
67
```python { .api }
68
def download_album(jm_album_id, option=None, downloader=None, callback=None, check_exception=True): ...
69
def download_photo(jm_photo_id, option=None, downloader=None, callback=None, check_exception=True): ...
70
def download_batch(download_api, jm_id_iter, option=None, downloader=None): ...
71
def new_downloader(option=None, downloader=None): ...
72
```
73
74
[Core Download API](./core-download-api.md)
75
76
### Content Entities
77
78
Data models representing albums, photos, images, and search results with rich metadata and download capabilities. These entities provide structured access to content information and download operations.
79
80
```python { .api }
81
class JmAlbumDetail: ...
82
class JmPhotoDetail: ...
83
class JmImageDetail: ...
84
class JmSearchPage: ...
85
```
86
87
[Content Entities](./content-entities.md)
88
89
### Download System
90
91
Comprehensive download management with support for callbacks, progress tracking, and specialized download behaviors. Provides fine-grained control over the download process.
92
93
```python { .api }
94
class JmDownloader: ...
95
class DownloadCallback: ...
96
def catch_exception(func): ...
97
```
98
99
[Download System](./download-system.md)
100
101
### Configuration Management
102
103
Flexible configuration system supporting YAML/JSON files, environment variables, and programmatic configuration. Enables customization of download behavior, client settings, and plugin options.
104
105
```python { .api }
106
class JmOption: ...
107
class DirRule: ...
108
def create_option_by_file(filepath): ...
109
def create_option_by_env(env_name='JM_OPTION_PATH'): ...
110
def create_option_by_str(text, mode=None): ...
111
```
112
113
[Configuration Management](./configuration-management.md)
114
115
### Client System
116
117
Multi-client architecture with web scraping and mobile API clients, automatic domain switching, and retry mechanisms. Provides robust access to JMComic content with Cloudflare bypass capabilities.
118
119
```python { .api }
120
class JmHtmlClient: ...
121
class JmApiClient: ...
122
class JmcomicClient: ...
123
```
124
125
[Client System](./client-system.md)
126
127
### Plugin System
128
129
Extensible plugin framework with 18+ built-in plugins for various use cases including login, monitoring, notifications, content processing, and advanced download features.
130
131
```python { .api }
132
class JmOptionPlugin: ...
133
class JmLoginPlugin: ...
134
class ZipPlugin: ...
135
class FindUpdatePlugin: ...
136
```
137
138
[Plugin System](./plugin-system.md)
139
140
### Text and Data Processing
141
142
Specialized utilities for text processing, HTML parsing, image processing, and cryptographic operations. These tools support the core functionality with URL parsing, data extraction, and content processing.
143
144
```python { .api }
145
class JmcomicText: ...
146
class JmPageTool: ...
147
class JmImageTool: ...
148
class JmCryptoTool: ...
149
```
150
151
[Text and Data Processing](./text-data-processing.md)
152
153
### Exception Handling
154
155
Comprehensive exception hierarchy with context support for robust error handling and debugging. Provides specific error types for different failure scenarios.
156
157
```python { .api }
158
class JmcomicException: ...
159
class ResponseUnexpectedException: ...
160
class RegularNotMatchException: ...
161
class PartialDownloadFailedException: ...
162
```
163
164
[Exception Handling](./exception-handling.md)
165
166
### Command Line Interface
167
168
Command-line interface for interactive downloads and batch operations with environment variable support.
169
170
```python { .api }
171
class JmcomicUI: ...
172
def main(): ...
173
def get_env(name, default): ...
174
```
175
176
[Command Line Interface](./command-line-interface.md)