Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from diygod:master #794

Merged
merged 5 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
build:
runs-on: ubuntu-latest
name: Build assets
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
actions: read
contents: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/comment-on-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
testRoute:
name: Call maintainers
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3 # just need its cache
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dependabot-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jobs:
if: github.repository_owner != 'DIYgod' && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
name: Ignore dependabot on forks
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
permissions:
contents: none
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
check-docker: ${{ steps.check-docker.outputs.defined }}
steps:
Expand All @@ -32,6 +33,7 @@ jobs:
runs-on: ubuntu-latest
needs: check-env
if: needs.check-env.outputs.check-docker == 'true'
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -100,6 +102,7 @@ jobs:
runs-on: ubuntu-latest
needs: check-env
if: needs.check-env.outputs.check-docker == 'true'
timeout-minutes: 5
steps:
- uses: actions/checkout@v3

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
test:
name: Docker build & tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
contents: write # for Git to git push
name: Auto format
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/issue-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
name: Automatic Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') && github.event.comment.author_association == 'COLLABORATOR'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout the latest code
uses: actions/checkout@v3
Expand All @@ -26,6 +27,7 @@ jobs:
name: Self Assign
if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, '/wip') }}
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
issues: write
Expand All @@ -41,6 +43,7 @@ jobs:
name: Test route on demand
if: startsWith(github.event.comment.body, '/test')
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
issues: write
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
name: npm publish
if: github.repository == 'DIYgod/RSSHub'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-deploy-route-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
name: Route test
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }} # skip if unsuccessful
timeout-minutes: 10
steps:
- uses: actions/checkout@v3

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jobs:
name: Lint
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -20,6 +21,7 @@ jobs:
name: reviewdog
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -35,6 +37,7 @@ jobs:
if: ${{ github.event_name == 'pull_request_target' }}
name: Validate PR title
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
Expand All @@ -49,6 +52,7 @@ jobs:
contents: read
pull-requests: write
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/labeler@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scrape.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
jobs:
scrape-docs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ permissions:
jobs:
jest:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
redis:
image: redis
Expand Down Expand Up @@ -68,6 +69,7 @@ jobs:

puppeteer:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -111,6 +113,7 @@ jobs:

docs:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
Expand All @@ -134,6 +137,7 @@ jobs:

all:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/yarn-lock-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
jobs:
yarn_lock_changes:
runs-on: ubuntu-latest
timeout-minutes: 5
# Permission overwrite is required for Dependabot PRs, see https://github.com/marketplace/actions/yarn-lock-changes#-common-issues.
permissions:
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion docs/anime.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ Sources

### 漫画更新

<Route author="KellyHwong" path="/cartoonmad/comic/:id" example="/cartoonmad/comic/5827" :paramsDesc="['漫画ID']"/>
<Route author="KellyHwong" path="/cartoonmad/comic/:id" example="/cartoonmad/comic/5827" :paramsDesc="['漫画ID']" radar="1"/>

## 风之动漫

Expand Down
6 changes: 6 additions & 0 deletions docs/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ username 为博主用户名,而非`xxx.hashnode.dev`中`xxx`所代表的 blog

</Route>

## 交流岛资源网

### 最新文章

<Route author="TonyRL" example="/jiaoliudao" path="/jiaoliudao" radar="1" />

## 敬维博客

### 文章
Expand Down
2 changes: 1 addition & 1 deletion lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ router.get('/tencentvideo/playlist/:id', lazyloadRouteHandler('./routes/tencent/
// router.get('/copymanga/comic/:id', lazyloadRouteHandler('./routes/copymanga/comic'));

// 動漫狂
router.get('/cartoonmad/comic/:id', lazyloadRouteHandler('./routes/cartoonmad/comic'));
// router.get('/cartoonmad/comic/:id', lazyloadRouteHandler('./routes/cartoonmad/comic'));
// Vol
router.get('/vol/:mode?', lazyloadRouteHandler('./routes/vol/lastupdate'));
// 咚漫
Expand Down
69 changes: 0 additions & 69 deletions lib/routes/cartoonmad/comic.js

This file was deleted.

70 changes: 70 additions & 0 deletions lib/v2/cartoonmad/comic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
const iconv = require('iconv-lite');
const { art } = require('@/utils/render');
const path = require('path');

const baseUrl = 'https://www.cartoonmad.com';
const KEY = '5e585';

const load = (id, { chapter, pages }) => {
let description = '';
for (let page = 1; page <= pages; page++) {
const url = `${baseUrl}/${KEY}/${id}/${chapter}/${String(page).padStart(3, '0')}.jpg`;
description += art(path.join(__dirname, 'templates/chapter.art'), {
url,
});
}
return description;
};

const getChapters = (id, list, tryGet) =>
Promise.all(
list.map((item) =>
tryGet(item.link, () => {
item.description = load(id, item);

return item;
})
)
);

module.exports = async (ctx) => {
const { id } = ctx.params;
const link = `${baseUrl}/comic/${id}`;

const { data } = await got(link, {
responseType: 'buffer',
headers: {
Referer: 'https://www.cartoonmad.com/',
},
});
const content = iconv.decode(data, 'big5');
const $ = cheerio.load(content);

const bookIntro = $('#info').eq(0).find('td').text().trim();
// const coverImgSrc = $('.cover').parent().find('img').attr('src');
const list = $('#info')
.eq(1)
.find('a')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.text(),
link: `${baseUrl}${item.attr('href')}`,
chapter: item.text().match(/\d+/)[0],
pages: item.next('font').text().match(/\d+/)[0],
};
})
.reverse();

const chapters = await getChapters(id, list, ctx.cache.tryGet);

ctx.state.data = {
title: $('head title').text(),
link,
description: bookIntro,
item: chapters,
};
};
3 changes: 3 additions & 0 deletions lib/v2/cartoonmad/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/comic/:id': ['KellyHwong'],
};
13 changes: 13 additions & 0 deletions lib/v2/cartoonmad/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'cartoonmad.com': {
_name: '動漫狂',
'.': [
{
title: '漫画更新',
docs: 'https://docs.rsshub.app/anime.html#dong-man-kuang',
source: ['/comic/:id'],
target: '/cartoonmad/comic/:id',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/cartoonmad/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/comic/:id', require('./comic'));
};
1 change: 1 addition & 0 deletions lib/v2/cartoonmad/templates/chapter.art
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<img src="{{ url }}"><br>
Loading