Skip to content

Commit

Permalink
chore(route): use template for 18comic content (DIYgod#12136)
Browse files Browse the repository at this point in the history
  • Loading branch information
nczitzk authored Mar 18, 2023
1 parent e5401c5 commit 0e87f81
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/anime.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,9 @@ Sources

分类

| 全部 | 其他漫畫 | 同人 | 韓漫 | 美漫 | 短篇 | 單本 |
| ---- | -------- | ------ | ------ | ------ | ----- | ------ |
| all | another | doujin | hanman | meiman | short | single |
| 全部 | 其他漫畫 | 同人 | 韓漫 | 美漫 | 短篇 | 单本 |
| --- | ------- | ------ | ------ | ------ | ----- | ------ |
| all | another | doujin | hanman | meiman | short | single |

时间范围

Expand Down
4 changes: 4 additions & 0 deletions lib/v2/18comic/templates/description.art
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<p>{{ introduction }}</p>
{{ each images image }}
<img src="{{ image }}">
{{ /each }}
12 changes: 8 additions & 4 deletions lib/v2/18comic/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');

const rootUrl = 'https://jmcomic.me';
// list of address: https://jmcomic1.bet
Expand Down Expand Up @@ -46,10 +48,12 @@ module.exports = {
.toArray()
.map((a) => $(a).text())
.join(', ');
item.description = `<p>${content('#intro-block .p-t-5').text()}</p><img src="${content('.img_zoom_img img')
.toArray()
.map((image) => content(image).attr('data-original'))
.join('"><img src="')}">`;
item.description = art(path.join(__dirname, 'templates/description.art'), {
introduction: content('#intro-block .p-t-5').text(),
images: content('.img_zoom_img img')
.toArray()
.map((image) => content(image).attr('data-original')),
});

return item;
})
Expand Down

0 comments on commit 0e87f81

Please sign in to comment.