Skip to content

Commit

Permalink
[v2.1.14]: 适配GitHub Actions脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
hect0x7 committed Aug 22, 2023
1 parent fb609f9 commit 277bc6d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jmcomic.download_album('422866') # 传入要下载的album的id,即可下载
## 项目特点

- **绕过Cloudflare的反爬虫**
- 支持使用**Github Actions**下载漫画,不会编程都能用([教程:使用Github Actions下载禁漫本子](./assets/docs/教程:使用Github%20Actions下载禁漫本子.md)
- 支持使用**GitHub Actions**下载漫画,不会编程都能用([教程:使用GitHub Actions下载禁漫本子](./assets/docs/教程:使用GitHub%20Actions下载禁漫本子.md)
- **可配置性强**
- 不配置也能使用,十分方便
- 配置可以从**配置文件**生成,支持多种文件格式,无需写Python代码
Expand Down
2 changes: 1 addition & 1 deletion assets/config/option_test.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Github Actions 测试用
# GitHub Actions 测试用
version: '2.0'
7 changes: 1 addition & 6 deletions assets/config/option_workflow_download.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Github Actions 下载脚本配置
# GitHub Actions 下载脚本配置
version: '2.0'

dir_rule:
base_dir: /home/runner/work/jmcomic/download/
rule: Bd_Aauthor_Atitle_Pindex

client:
domain:
- 18comic.vip
- 18comic.org
10 changes: 5 additions & 5 deletions assets/docs/教程:使用Github Actions下载禁漫本子.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 教程:使用Github Actions下载禁漫本子
# 教程:使用GitHub Actions下载禁漫本子

一共需要三步:

1. fork一份我的代码仓库。
2. 填写你需要下载的本子id。
3. 等待Github Actions下载完成,下载成品zip文件。
3. 等待GitHub Actions下载完成,下载成品zip文件。

下面截图解析这三步的详细过程。

Expand Down Expand Up @@ -48,9 +48,9 @@

上面有注释,把你要下载的本子的id填入,一行一个,id前面可以带`JM`

填完点提交,会自动触发Github Actions下载这些本子。
填完点提交,会自动触发GitHub Actions下载这些本子。

## 3. 等待Github Actions下载完成,下载成品zip文件
## 3. 等待GitHub Actions下载完成,下载成品zip文件

来到Actions页面,选择最新的一次记录,等待它完成。

Expand All @@ -60,7 +60,7 @@

![4](./images/4.png)

如果你发现Github Actions显示❌,表明出现了问题,运行失败。
如果你发现GitHub Actions显示❌,表明出现了问题,运行失败。


下面是问题的排查步骤:
Expand Down
6 changes: 3 additions & 3 deletions usage/workflow_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_option():

# 检查环境变量中是否有禁漫的用户名和密码,如果有则登录
# 禁漫的大部分本子,下载是不需要登录的,少部分敏感题材需要登录
# 如果你希望以登录状态下载本子,你需要自己配置一下Github Actions的 `secrets`
# 如果你希望以登录状态下载本子,你需要自己配置一下GitHub Actions的 `secrets`
# 配置的方式很简单,网页上点一点就可以了
# 具体做法请去看官方教程:https://docs.github.com/en/actions/security-guides/encrypted-secrets

Expand All @@ -58,7 +58,7 @@ def get_option():


def hook_debug(option):
from jmcomic import JmHtmlClient, workspace, mkdir_if_not_exists
from jmcomic import JmHtmlClient, workspace, mkdir_if_not_exists, JmModuleConfig

jm_download_dir = get_env('JM_DOWNLOAD_DIR') or workspace()
mkdir_if_not_exists(jm_download_dir)
Expand All @@ -75,7 +75,7 @@ def raise_request_error(cls, resp, msg=None):

return super().raise_request_error(resp, msg)

option.jm_client_impl_mapping['html'] = RaiseErrorAwareClient
JmModuleConfig.CLASS_CLIENT_IMPL['html'] = RaiseErrorAwareClient


def get_env(name):
Expand Down

0 comments on commit 277bc6d

Please sign in to comment.