Skip to content

Commit

Permalink
项目文档优化、文档网站重构并改用material主题。(hect0x7#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
hect0x7 authored Jun 14, 2024
1 parent 3c0a27b commit 826be95
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 162 deletions.
107 changes: 53 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,26 @@

## 项目介绍

本项目的核心功能是下载本子,基于此,设计了一套方便使用、便于扩展,能满足一些特殊下载需求的框架
本项目的核心功能是下载本子。

目前核心功能实现较为稳定,项目也处于维护阶段
基于此,设计了一套方便使用、便于扩展,能满足一些特殊下载需求的框架

除了下载功能以外,也实现了其他的一些禁漫接口,按需实现,具体如下
目前核心功能实现较为稳定,项目也处于维护阶段

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

- 登录
- 搜本
- 分类 (排行榜)
- 本子章节详情
- 搜索本子(支持所有搜索项)
- 图片下载解码
- 收藏夹
- 移动端接口加解密
- 分类/排行榜
- 本子/章节详情
- 个人收藏夹
- 接口加解密(APP的接口)

## 安装教程

> ⚠如果你没有安装过Python,需要先安装Python再执行下面的步骤,且版本需要>=3.7([点我去python官网下载](https://www.python.org/downloads/)
* 通过pip官方源安装(推荐,并且更新也是这个命令)

```shell
Expand All @@ -44,7 +46,9 @@
## 快速上手

### 1. 下载本子方法

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

```python
import jmcomic # 导入此模块,需要先安装.
jmcomic.download_album('422866') # 传入要下载的album的id,即可下载整个album到本地.
Expand All @@ -57,10 +61,10 @@ jmcomic.download_album('422866') # 传入要下载的album的id,即可下载
### 2. 使用option配置来下载本子

1. 首先,创建一个配置文件,假设文件名为 `option.yml`
该文件有特定的写法,你需要参考这个文档 → [option配置](./assets/docs/sources/option_file_syntax.md)
下面做一个演示,假设你需要把下载的图片转为png格式,你应该把以下内容写进`option.yml`

该文件有特定的写法,你需要参考这个文档 → [配置文件指南](./assets/docs/sources/option_file_syntax.md)

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

```yml
download:
Expand All @@ -69,67 +73,58 @@ download:
```
2. 第二步,运行下面的python代码
```python
import jmcomic

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



## 进阶使用

文档网站:[jmcomic.readthedocs.io](https://jmcomic.readthedocs.io/en/latest)

首先,就下载功能,jmcomic提供了很多配置项,大部分的下载需求你都可以通过上文介绍的配置文件来配置。
请查阅文档首页→[jmcomic.readthedocs.io](https://jmcomic.readthedocs.io/zh-cn/latest)

如果你不满足于下载,还有其他的使用需求,推荐你先看看以下文档:

* [jmcomic常用类和方法演示](assets/docs/sources/tutorial/0_demo.md)
* [option配置文件语法(包含插件配置)](./assets/docs/sources/option_file_syntax.md)
* [GitHub Actions使用教程](./assets/docs/sources/tutorial/1_github_actions.md)
* [命令行使用教程](assets/docs/sources/tutorial/2_command_line.md)
* [插件机制](assets/docs/sources/tutorial/6_plugin.md)
* [下载过滤器机制](assets/docs/sources/tutorial/5_filter.md)
(提示:jmcomic提供了很多下载配置项,大部分的下载需求你都可以尝试寻找相关配置项或插件来实现。)

## 项目特点

- **绕过Cloudflare的反爬虫**
- **实现禁漫APP接口最新的加解密算法 (1.6.3)**
- 用法多样:

- GitHub
Actions:网页上直接输入本子id就能下载([教程:使用GitHub Actions下载禁漫本子](./assets/docs/sources/tutorial/1_github_actions.md)
- 命令行:无需写Python代码,简单易用([教程:使用命令行下载禁漫本子](./assets/docs/sources/tutorial/2_command_line.md)
- Python代码:最本质、最强大的使用方式,需要你有一定的python编程基础
- GitHub
Actions:网页上直接输入本子id就能下载([教程:使用GitHub Actions下载禁漫本子](./assets/docs/sources/tutorial/1_github_actions.md)
- 命令行:无需写Python代码,简单易用([教程:使用命令行下载禁漫本子](./assets/docs/sources/tutorial/2_command_line.md)
- Python代码:最本质、最强大的使用方式,需要你有一定的python编程基础
- 支持**网页端****移动端**两种客户端实现,可通过配置切换(**移动端不限ip兼容性好,网页端限制ip地区但效率高**
- 支持**自动重试和域名切换**机制
- **多线程下载**(可细化到一图一线程,效率极高)
- **可配置性强**

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

- 支持自定义本子/章节/图片下载前后的回调函数
- 支持自定义类:`Downloader(负责调度)` `Option(负责配置)` `Client(负责请求)` `实体类`
- 支持自定义日志、异常监听器
- **支持Plugin插件,可以方便地扩展功能,以及使用别人的插件,目前内置插件有**
- `登录插件`
- `硬件占用监控插件`
- `只下载新章插件`
- `压缩文件插件`
- `下载特定后缀图片插件`
- `发送QQ邮件插件`
- `日志主题过滤插件`
- `自动使用浏览器cookies插件`
- `jpg图片合成为一个pdf插件`
- `导出收藏夹为csv文件插件`
- 支持自定义本子/章节/图片下载前后的回调函数
- 支持自定义类:`Downloader(负责调度)` `Option(负责配置)` `Client(负责请求)` `实体类`
- 支持自定义日志、异常监听器
- **支持Plugin插件,可以方便地扩展功能,以及使用别人的插件,目前内置插件有**
- `登录插件`
- `硬件占用监控插件`
- `只下载新章插件`
- `压缩文件插件`
- `下载特定后缀图片插件`
- `发送QQ邮件插件`
- `日志主题过滤插件`
- `自动使用浏览器cookies插件`
- `jpg图片合成为一个pdf插件`
- `导出收藏夹为csv文件插件`

## 使用小说明

Expand All @@ -141,18 +136,22 @@ jmcomic.download_album(422866, option)
* .github:GitHub Actions配置文件
* assets:存放一些非代码的资源文件

* docs:项目文档
* option:存放配置文件

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

* jmcomic:`jmcomic`模块

* jmcomic:`jmcomic`模块
* tests:测试目录,存放测试代码,使用unittest
* usage:用法目录,存放示例/使用代码

## 感谢以下项目

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

[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=tonquer&repo=JMComic-qt)](https://github.com/tonquer/JMComic-qt)
<a href="https://github.com/tonquer/JMComic-qt">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github-readme-stats.vercel.app/api/pin/?username=tonquer&repo=JMComic-qt&theme=radical" />
<source media="(prefers-color-scheme: light)" srcset="https://github-readme-stats.vercel.app/api/pin/?username=tonquer&repo=JMComic-qt" />
<img alt="Repo Card" src="https://github-readme-stats.vercel.app/api/pin/?username=tonquer&repo=JMComic-qt" />
</picture>
</a>
50 changes: 45 additions & 5 deletions assets/docs/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
repo_url: https://github.com/hect0x7/JMComic-Crawler-Python
site_name: jmcomic

theme:
name: readthedocs
highlightjs: true
palette:
- media: "(prefers-color-scheme)"
toggle:
icon: material/brightness-auto
name: 切换到浅色主题
- media: "(prefers-color-scheme: light)"
scheme: default
primary: indigo
accent: indigo
toggle:
icon: material/brightness-7
name: 切换到深色主题
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: indigo
accent: indigo
toggle:
icon: material/brightness-4
name: 主题跟随系统
name: material
features:
- navigation.sections
- content.code.copy
- content.code.select
- search.suggest
- search.highlight
- search.share
- navigation.tabs
- navigation.top
plugins:
- search
- mkdocstrings:
Expand All @@ -14,8 +43,19 @@ plugins:


markdown_extensions:
- markdown_include.include:
base_path: .
- admonition
- attr_list
- toc:
permalink: true
- pymdownx.highlight
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences

docs_dir: sources
107 changes: 22 additions & 85 deletions assets/docs/sources/index.md
Original file line number Diff line number Diff line change
@@ -1,102 +1,39 @@
# jmcomic
首页
=====================================

Python API for JMComic(禁漫天堂)

## Features

- Bypasses Cloudflare anti-bot measures.
- Multiple usage ways:
> jmcomic库封装了一套可用于爬取禁漫的Python API.
>
> 你可以通过简单的几行Python代码,访问禁漫的接口,以及下载禁漫的本子。
>
> [查看项目更新计划](TODO.md)
- GitHub Actions: Requires only a GitHub account. (See
tutorial → [Tutorial - Download Album via GitHub Actions](./tutorial/1_github_actions.md))
- Command line: No need to write Python code, simple and easy to use. (See
tutorial → [Tutorial - Download Album via Command Line](./tutorial/2_command_line.md))
- 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:
- [快速上手(GitHub README)](https://github.com/hect0x7/JMComic-Crawler-Python/tree/master?tab=readme-ov-file#%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B)
- [常用类和方法演示](tutorial/0_common_usage)
- [option配置以及插件写法](./option_file_syntax.md)

- Supports Plugin 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`, `image suffix filter plugin` `send qq email plugin` `logging topic filter plugin` `auto set browser cookies plugin`.
- Supports custom callback functions before and after downloading album/chapter/images.
- Supports custom logging.
- Supports custom core
classes: `Downloader (responsible for scheduling)`, `Option (responsible for configuration)`, `Client (responsible for requests)`, `entity classes`,
and more.

## Install

- Install via official pip source (recommended, and also used for updates):
## 特殊用法教程
- [GitHub Actions使用教程](./tutorial/1_github_actions.md)
- [命令行使用教程](tutorial/2_command_line.md)
- [导出收藏夹教程](tutorial/10_export_favorites.md)

```
pip install jmcomic -i https://pypi.org/project --upgrade
```

- Install via GitHub code:

```
pip install git+https://github.com/hect0x7/JMComic-Crawler-Python
```
## 核心机制
- [下载过滤器机制](tutorial/5_filter.md)
- [插件机制](tutorial/6_plugin.md)

## Getting Started

### 1. Download album:

- Python code
## 自定义
- [下载文件夹名](tutorial/9_custom_download_dir_name.md)
- [日志](tutorial/9_custom_download_dir_name.md)
- [模块](tutorial/4_module_custom.md)

```python
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](./option_file_syntax.md)):

```yml
download:
image:
suffix: .jpg # Don't forget the '.'
```
Then, use one of the following ways:
* Python code
```python
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"
```

## Acknowledgement

### Image Segmentation Algorithm Code + JMComic Mobile API

[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=tonquer&repo=JMComic-qt)](https://github.com/tonquer/JMComic-qt)
Loading

0 comments on commit 826be95

Please sign in to comment.