Skip to content

Commit 4eeee1e

Browse files
authored
v2.3.10: 搭建readthedocs文档网站并迁移所有文档,新增插件—下载图片后缀过滤器,优化代码。(#152)
1 parent 6ab3bc4 commit 4eeee1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+741
-739
lines changed
File renamed without changes.

.github/workflows/download.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
paths:
77
- '.github/workflows/download.yml' # 工作流定义
88
- 'usage/workflow_download.py' # 下载脚本
9-
- 'assets/config/option_workflow_download.yml' # 配置文件
9+
- 'assets/option/option_workflow_download.yml' # 配置文件
1010

1111
jobs:
1212
crawler:

.github/workflows/release_auto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
id: tb
2424
run: |
2525
commit_message=$(git log --format=%B -n 1 ${{ github.sha }})
26-
python release.py "$commit_message"
26+
python .github/release.py "$commit_message"
2727
2828
- name: Create Release
2929
uses: softprops/action-gh-release@v1

.github/workflows/test_api.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ on:
1010
- 'src/**/*.py'
1111
- 'tests/**/*.py'
1212
- '.github/workflows/test_api.yml'
13-
- 'assets/config/option_test_api.yml'
13+
- 'assets/option/option_test_api.yml'
1414

1515
jobs:
1616
test: # This code is based on https://github.com/gaogaotiantian/viztracer/blob/master/.github/workflows/python-package.yml
1717
strategy:
1818
matrix:
19-
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]
19+
python-version: ['3.7', '3.8', '3.11', '3.12']
2020
os: [ ubuntu-latest ]
2121
runs-on: ${{ matrix.os }}
2222
timeout-minutes: 5
2323
env:
2424
# 配置文件路径
25-
JM_OPTION_PATH_TEST: ./assets/config/option_test_api.yml
25+
JM_OPTION_PATH_TEST: ./assets/option/option_test_api.yml
2626

2727
steps:
2828
- name: Checkout repository

.github/workflows/test_html.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ on:
1010
- 'src/**/*.py'
1111
- 'tests/**/*.py'
1212
- '.github/workflows/test_html.yml'
13-
- 'assets/config/option_test_html.yml'
13+
- 'assets/option/option_test_html.yml'
1414

1515
jobs:
1616
test: # This code is based on https://github.com/gaogaotiantian/viztracer/blob/master/.github/workflows/python-package.yml
1717
strategy:
1818
matrix:
19-
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]
19+
python-version: ['3.7', '3.8', '3.11', '3.12']
2020
os: [ ubuntu-latest ]
2121
runs-on: ${{ matrix.os }}
2222
timeout-minutes: 5
2323
env:
2424
# 配置文件路径
25-
JM_OPTION_PATH_TEST: ./assets/config/option_test_html.yml
25+
JM_OPTION_PATH_TEST: ./assets/option/option_test_html.yml
2626

2727
steps:
2828
- name: Checkout repository

.readthedocs.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Required
2+
version: 2
3+
4+
# Set the OS, Python version and other tools you might need
5+
build:
6+
os: ubuntu-22.04
7+
tools:
8+
python: "3.12"
9+
mkdocs:
10+
configuration: assets/docs/mkdocs.yml
11+
12+
# Optionally declare the Python requirements required to build your docs
13+
python:
14+
install:
15+
- requirements: assets/docs/requirements.txt

README.md

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
```shell
1414
pip install jmcomic -i https://pypi.org/project --upgrade
1515
```
16-
* 本地安装
16+
* 通过源代码安装
1717

1818
```shell
19-
pip install -e ./
19+
pip install git+https://github.com/hect0x7/JMComic-Crawler-Python
2020
```
2121

2222
## 快速上手
@@ -26,63 +26,52 @@
2626
```python
2727
import jmcomic # 导入此模块,需要先安装.
2828
jmcomic.download_album('422866') # 传入要下载的album的id,即可下载整个album到本地.
29-
# 上面的这行代码,还有一个可选参数option: JmOption,表示配置项,
30-
# 配置项的作用是告诉程序下载时候的一些选择,
31-
# 比如,要下载到哪个文件夹,使用怎样的路径组织规则(比如[/作者/本子id/图片] 或者 [/作者/本子名称/图片]).
32-
# 如果没有配置,则会使用 JmOption.default(),下载的路径是[当前工作文件夹/本子名称/图片].
33-
# 如果你想要配置,请参考文件 assets/config/常用配置介绍.yml
3429
```
3530

3631
* v2.2.9: 新增命令行调用方式,上述的代码可以转为一行命令
3732

3833
```bash
3934
# 下载album_id为422866的本子
4035
$ jmcomic 422866
41-
# 更多用法请参考文件 usage/usage_cl.py (命令行使用介绍)
4236
```
4337

44-
## 进阶使用
45-
46-
进阶使用可以参考本repo下usage文件夹内的示例代码文件,下面是各个文件的作用,你可以挑感兴趣的阅读:
47-
48-
- API上手介绍: `getting_started.py`
49-
- 命令行使用介绍: `usage_cl.py`
50-
- 配置客户端的实现(网页端、移动端): `usage_configure_client_impl.py`
51-
- 使用API实现简单功能: `usage_simple.py`
52-
- 演示jmcomic模块的可自定义功能点: `usage_custom.py`
53-
- 使用API的Filter过滤功能: `usage_feature_filter.py`
54-
- 演示jmcomic模块的Plugin插件体系: `usage_feature_plugin.py`
55-
- 演示一个综合使用实例: `usage_advanced.py`
56-
- 包括6个功能需求的介绍、实现方案和完整运行日志
57-
- 实现方案非常简洁,充分jmcomic的便利性,以及强大的插件扩展机制
58-
59-
以及一些趣味用法:
60-
61-
- 测试你的ip可以访问哪些禁漫域名: `pick_domain.py`
62-
- 基于GitHub Actions下载本子: `workflow_download.py`
63-
6438
## 项目特点
6539

6640
- **绕过Cloudflare的反爬虫**
67-
- 支持使用**命令行**下载本子,无需写Python代码,简单易用
68-
- 支持使用**GitHub Actions**下载本子,网页上直接输入本子id就能下载([教程:使用GitHub Actions下载禁漫本子](./assets/docs/教程:使用GitHub%20Actions下载禁漫本子.md)
41+
- 用法多样:
42+
43+
- GitHub Actions:网页上直接输入本子id就能下载([教程:使用GitHub Actions下载禁漫本子](./assets/docs/sources/tutorial/1_github_actions.md)
44+
- 命令行:无需写Python代码,简单易用([教程:使用命令行下载禁漫本子](./assets/docs/sources/tutorial/2_command_line.md)
45+
- Python代码:最直接的使用方式,需要你有一定的python编程基础
6946
- 支持**网页端****移动端**两种客户端实现,可通过配置切换(**移动端不限ip兼容性好,网页端限制ip地区但效率高**
7047
- 支持**自动重试和域名切换**机制
7148
- **多线程下载**(可细化到一图一线程,效率极高)
72-
- 跟进了JM最新的图片分割算法(2023-02-08)
7349
- **可配置性强**
7450

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

8056
- **支持Plugin插件,可以方便地扩展功能,以及使用别人的插件**
81-
- 目前内置支持的插件有:`登录插件` `硬件占用监控插件` `只下载新章插件` `压缩文件插件`
57+
- 目前内置支持的插件有:`登录插件` `硬件占用监控插件` `只下载新章插件` `压缩文件插件` `下载特定后缀图片插件`
8258
- 支持自定义本子/章节/图片下载前后的回调函数
8359
- 支持自定义debug日志
8460
- 支持自定义类:`Downloader(负责调度)` `Option(负责配置)` `Client(负责请求)` `实体类`
8561

62+
## 进阶使用
63+
64+
进阶使用请查阅文档:[文档](https://jmcomic.readthedocs.io/en/latest)
65+
66+
下面列出一些常用的文档链接:
67+
68+
* [option配置文件语法](./assets/docs/sources/option_file_syntax.md)
69+
* [常用类和方法演示(下载本子、获取实体类、搜索本子)](assets/docs/sources/tutorial/3_demo.md)
70+
* [命令行使用教程](assets/docs/sources/tutorial/2_command_line.md)
71+
* [GitHub Actions使用教程](./assets/docs/sources/tutorial/1_github_actions.md)
72+
* [插件机制](assets/docs/sources/tutorial/6_plugin.md)
73+
* [下载过滤器机制](assets/docs/sources/tutorial/5_filter.md)
74+
8675
## 使用小说明
8776

8877
* Python >= 3.7
@@ -97,8 +86,8 @@ $ jmcomic 422866
9786
* src:存放源代码
9887

9988
* jmcomic:`jmcomic`模块
100-
* tests:测试目录,存放测试代码,使用unittest
101-
* usage:用法目录,存放示例/使用代码
89+
* tests:测试目录,存放测试代码,使用unittest
90+
* usage:用法目录,存放示例/使用代码
10291

10392
## 感谢以下项目
10493

assets/config/option_plugin.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

assets/docs/mkdocs.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
site_name: jmcomic
2+
theme:
3+
name: readthedocs
4+
highlightjs: true
5+
plugins:
6+
- search
7+
- mkdocstrings:
8+
custom_templates: templates
9+
handlers:
10+
# See: https://mkdocstrings.github.io/python/usage/
11+
python:
12+
paths: [ '../../src/' ]
13+
options:
14+
docstring_style: sphinx
15+
16+
17+
markdown_extensions:
18+
- markdown_include.include:
19+
base_path: .
20+
- admonition
21+
22+
docs_dir: sources

assets/docs/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mkdocs
2+
mkdocstrings[python]
3+
markdown-include
4+
mkdocs-material

0 commit comments

Comments
 (0)