chore(route): use template for 18comic content (#12136)

This commit is contained in:
Ethan Shen 2023-03-19 00:41:43 +08:00 committed by GitHub
parent e5401c5a7c
commit 0e87f8126b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View File

@ -626,9 +626,9 @@ Sources
分类
| 全部 | 其他漫畫 | 同人 | 韓漫 | 美漫 | 短篇 | 單本 |
| ---- | -------- | ------ | ------ | ------ | ----- | ------ |
| all | another | doujin | hanman | meiman | short | single |
| 全部 | 其他漫畫 | 同人 | 韓漫 | 美漫 | 短篇 | 单本 |
| --- | ------- | ------ | ------ | ------ | ----- | ------ |
| all | another | doujin | hanman | meiman | short | single |
时间范围

View File

@ -0,0 +1,4 @@
<p>{{ introduction }}</p>
{{ each images image }}
<img src="{{ image }}">
{{ /each }}

View File

@ -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
@ -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;
})