Skip to main content

Python API for JMComic

简体中文 • English • 日本語 • 한국어

提供 Python API 访问禁漫天堂(网页端 & 移动端),集成 GitHub Actions 下载器🚀

GitHub Stars Forks GitHub latest releases PyPI - Downloads Licence Used by

本项目封装了一套可用于爬取JM的Python API.

你可以通过简单的几行Python代码,实现下载JM上的本子到本地,并且是处理好的图片。

🧭 快速指路

友情提示:珍爱JM,为了减轻JM的服务器压力,请不要一次性爬取太多本子,西门🙏🙏🙏.

introduction.jpg

项目介绍

本项目的核心功能是下载本子。

基于此,设计了一套方便使用、便于扩展,能满足一些特殊下载需求的框架。

目前核心功能实现较为稳定,项目也处于维护阶段。

除了下载功能以外,也实现了其他的一些禁漫接口,按需实现。目前已有功能:

  • 登录
  • 搜索本子(支持所有搜索项)
  • 获取本子评论(包括回评、剧透标识)
  • 分类/排行榜
  • 获取本子/章节详情
  • 图片下载解码
  • 个人收藏夹
  • 接口加解密(APP的接口)

安装教程

⚠如果你没有安装过 Python,需要先前往 Python 官网下载 再执行以下步骤。 推荐使用 Python 3.14

  • 通过pip官方源安装(推荐,并且更新也是这个命令)

    pip install jmcomic -U
    
  • 通过源代码安装

    pip install git+https://github.com/hect0x7/JMComic-Crawler-Python
    

快速上手

1. 下载本子方法

只需要使用如下代码,就可以下载本子JM123的所有章节的图片:

import jmcomic  # 导入此模块,需要先安装.
jmcomic.download_album('123')  # 传入要下载的album的id,即可下载整个album到本地.

# 也可以使用 Async API (详见教程: https://jmcomic.readthedocs.io/zh-cn/latest/tutorial/14_async_usage/)
import asyncio
asyncio.run(jmcomic.download_album_async('123'))

上面的 download_album方法还有一个参数option,可用于控制下载配置,配置包括禁漫域名、网络代理、图片格式转换、插件等等。

你可能需要这些配置项。推荐使用配置文件创建option,用option下载本子,见下章:

2. 使用option配置来下载本子

  1. 首先,创建一个配置文件,假设文件名为 option.yml

    该文件有特定的写法,你需要参考这个文档 → 配置文件指南

    下面做一个演示,假设你需要把下载的图片转为png格式,你应该把以下内容写进option.yml

download:
  image:
    suffix: .png # 该配置用于把下载的图片转为png格式
  1. 第二步,运行下面的python代码
import jmcomic

# 创建配置对象
option = jmcomic.create_option_by_file('你的配置文件路径,例如 D:/option.yml')
# 使用option对象来下载本子
jmcomic.download_album(123, option)
# 等价写法: option.download_album(123)

3. 使用命令行

[!TIP] 如果只想下载本子,使用命令行会比上述方式更加简单直接

例如,在windows上,直接按下 win+R 键,输入jmcomic xxx就可以下载本子。

示例:下载本子123的命令

jmcomic 123

同时下载本子123, 章节456的命令

jmcomic 123 p456

命令行模式也支持自定义option,你可以使用环境变量或者命令行参数:

a. 通过命令行 --option 参数指定option文件路径

jmcomic 123 --option="D:/a.yml"

b. 命令行不改,而是配置环境变量 JM_OPTION_PATH 为option文件路径(推荐)

[!TIP] 请自行google配置环境变量的方式,或使用powershell命令: setx JM_OPTION_PATH "D:/a.yml" 重启后生效

另外,jmcomic 还提供了一个美观的进度条能力,默认是开启的,但是需要你手动安装一个额外依赖 pip install rich。效果如下:

jmcomic 命令行下载进度

详细开启方法参考文档:启用美观的下载进度条

4. 查看本子详情(jmv 命令)

[!NOTE] jmv 命令用于快速查看本子详情,不做下载。

适用场景:在某些网站上看到一串神秘车号,想快速看看具体是啥本子。此时只需copy原文本,按下 win+R,输入jmv [粘贴内容]即可

支持从任意文本中提取数字作为车号,方便直接粘贴各种格式的车号。

示例:

# 直接输入车号
jmv 350234

# 从混合文本中提取数字(提取出 350234)
jmv 350谁还没看过234

# 指定option文件(也支持环境变量,用法同上)
jmv 350234 --option="D:/a.yml"

# -y 参数:执行完毕后直接退出,无需按回车确认
jmv 350234 -y

输出效果:

🔍 正在查询 禁漫车号 - [350234] 的详情...

──────────────────────────────────────────────────
  📖 标题:  xxx
  🆔 ID:    JM350234
  🔗 链接:  https://18comic.vip/album/350234/
  ✍️ 作者:  Author1, Author2
──────────────────────────────────────────────────
  📅 发布日期:  2022-06-15
  📅 更新日期:  2023-01-01
  📄 总页数:    50
  👀 观看:      2M
  ❤️ 点赞:     77K
  💬 评论:      9801
──────────────────────────────────────────────────
  🏷️ 标签:  标签1, 标签2, ...
  🎭 人物:  角色A, 角色B, ...
  📚 作品:  作品1, 作品2, ...
──────────────────────────────────────────────────
  📑 章节 (2):
     第1話  上  (id: 350234)
     第2話  下  (id: 350235)
──────────────────────────────────────────────────

[运行结束] 请按回车键关闭窗口... (下次运行可附加 -y 参数跳过确认)

进阶使用

请查阅文档首页 → jmcomic.readthedocs.io

或者查看github仓库的文档 → github-repo-docs

(提示:jmcomic提供了很多下载配置项,大部分的下载需求你都可以尝试寻找相关配置项或插件来实现。)

项目特点

  • 绕过Cloudflare的反爬虫

  • 实现禁漫APP接口最新的加解密算法 (1.6.3)

  • 支持Async和Sync两套 API

  • 用法多样:

  • 支持网页端和移动端两种客户端实现,可通过配置切换(移动端不限ip兼容性好,网页端限制ip地区但效率高)

  • 支持自动重试和域名切换机制

  • 支持按下载任务维度结构化收集日志

  • 可配置性强

    • 不配置也能使用,十分方便
    • 配置可以从配置文件生成,支持多种文件格式
    • 配置点有:请求域名 客户端实现 是否使用磁盘缓存 同时下载的章节/图片数量 图片格式转换 下载路径规则 请求元信息(headers,cookies,proxies) 中文繁/简转换 等
  • 可扩展性强

    • 支持自定义本子/章节/图片下载前后事件的回调函数
    • 支持自定义类:Downloader(负责调度) Option(负责配置) Client(负责请求) 实体类等
    • 支持自定义日志、异常监听器
    • 支持 Plugin 扩展,目前内置 21 个实用插件,包括:美观下载进度条、图片合并 PDF、一图流长图拼接、生成zip/7z压缩包、浏览器 Cookie 获取、订阅更新、收藏夹导出、封面下载等。

使用小说明

  • 推荐使用 Python 3.14,目前 CI 只覆盖 Python 3.10 及以上版本。

    [!NOTE] Python 3.9 及更早版本均已结束官方支持 (EOL),使用3.9及以下随时有可能遇到第三方库不兼容的问题。Python 3.9 仍保留安装兼容,但不再纳入 CI。

  • 个人项目,文档和示例会有不及时之处,可以Issue提问。

项目文件夹介绍

  • .github:GitHub Actions配置文件

  • assets:存放一些非代码的资源文件

    • docs:项目文档
    • option:存放配置文件
  • src:存放源代码

    • jmcomic:jmcomic模块
  • tests:测试目录,存放测试代码,使用unittest

  • usage:用法目录,存放示例/使用代码

感谢以下项目

图片分割算法代码+禁漫移动端API

Repo Card

used by 项目

使用 jmcomic 的项目

Star History

jmcomic 生态 Star History

Metadata

Release files for jmcomic 2.7.7

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

Source distribution (sdist)

Source distribution for jmcomic 2.7.7
File Size Uploaded
jmcomic-2.7.7.tar.gz 118.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jmcomic 2.7.7
File Interpreter ABI Platform
jmcomic-2.7.7-py3-none-any.whl Python 3 none any Details

Total release size: 240.8 kB

Release files / jmcomic-2.7.7.tar.gz

Download URL jmcomic-2.7.7.tar.gz
Size 118.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b5294f2589cd01b8f14aaeb0f8ab34c7c8160a8c7f51f50daefb9355dabc3751
BLAKE2b-256 checksum
How to use checksums
55af075bf9796605ad8e6b21631746f91e4a9e19fdf90b2f49d638d9cfe43427
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

Release files / jmcomic-2.7.7-py3-none-any.whl

Download URL jmcomic-2.7.7-py3-none-any.whl
Size 122.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
733706391cd9977fa2a2cdb35f51fd754d48162c25cbbfd8b0d1005d164a9dd8
BLAKE2b-256 checksum
How to use checksums
cb92941f422545145573ffe036fb26edac2974e4cea5810869da5a0ddde3c9af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.7.7 This release

2 release files

2.7.6

2 release files

2.7.5

2 release files

2.7.4

2 release files

2.7.3

2 release files

2.7.2

2 release files

2.7.1

2 release files

2.7.0

2 release files

2.6.20

2 release files

2.6.17

2 release files

2.6.16

2 release files

2.6.15

2 release files

2.6.14

2 release files

2.6.12

2 release files

2.6.10

2 release files

2.6.9

2 release files

2.6.7

2 release files

2.6.6

2 release files

2.6.5

2 release files

2.6.4

2 release files

2.6.3

2 release files

2.6.2

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.39

2 release files

2.5.38

2 release files

2.5.37

2 release files

2.5.36

2 release files

2.5.32

2 release files

2.5.30

2 release files

2.5.29

2 release files

2.5.27

2 release files

2.5.26

2 release files

2.5.25

2 release files

2.5.24

2 release files

2.5.23

2 release files

2.5.22

2 release files

2.5.20

2 release files

2.5.19

2 release files

2.5.18

2 release files

2.5.17

2 release files

2.5.15

2 release files

2.5.14

2 release files

2.5.12

2 release files

2.5.11

2 release files

2.5.9

2 release files

2.5.8

2 release files

2.5.7

2 release files

2.5.6

2 release files

2.5.5

2 release files

2.5.4

2 release files

2.5.3

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.12

2 release files

2.4.11

2 release files

2.4.10

2 release files

2.4.9

2 release files

2.4.7

2 release files

2.4.6

2 release files

2.4.5

2 release files

2.4.4

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.3.16

2 release files

2.3.14

2 release files

2.3.12

2 release files

2.3.11

2 release files

2.3.10

2 release files

2.3.9

2 release files

2.3.8

2 release files

2.3.7

2 release files

2.3.6

2 release files

2.3.5

2 release files

2.3.4

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.2.11

2 release files

2.2.10

2 release files

2.2.9

2 release files

2.2.8

2 release files

2.2.7

2 release files

2.2.6

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.21

2 release files

2.1.19

2 release files

2.1.17

2 release files

2.1.16

2 release files

2.1.15

2 release files

2.1.14

2 release files

2.1.13

2 release files

2.1.12

2 release files

2.1.11

2 release files

2.1.9

2 release files

2.1.8

2 release files

2.1.7

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.9

2 release files

2.0.8

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

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