feat(route): 新增妹图社 (#10760)

* feat: 新增妹图社

* feat: 新增妹图社文档

* feat: Remove markdown-it-attrs, since it breaks sidebar item title

* feat: Use art template

* fix: time parsing
This commit is contained in:
Chris Wan
2022-09-13 01:05:39 +08:00
committed by GitHub
parent 7ef81ae8d8
commit 94f0d1ea94
7 changed files with 73 additions and 0 deletions
+6
View File
@@ -208,6 +208,12 @@ For example:
<RouteEn author="hoilc" example="/loveheaven/update/kimetsu-no-yaiba" path="/loveheaven/update/:slug" :paramsDesc="['Manga slug, can be found in URL, including neither `manga-` nor `.html`']" />
## Meituclub
### Latest
<RouteEn author="ocleo1" example="/meituclub/latest" path="/meituclub/latest" />
## NASA Astronomy Picture of the Day
### NASA
+6
View File
@@ -554,6 +554,12 @@ R18 显示
<Route author="nczitzk" example="/cool18/bbs/keywords/都市" path="/cool18/:id/keywords/:keyword?" :paramsDesc="['分站,见上表,默认为禁忌书屋', '关键字']"/>
## 妹图社
### 最新
<Route author="ocleo1" example="/meituclub/latest" path="/meituclub/latest" />
## 妹子图
### 首页(最新)
+41
View File
@@ -0,0 +1,41 @@
const path = require('path');
const cheerio = require('cheerio');
const got = require('@/utils/got');
const { art } = require('@/utils/render');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
const HOME_URL = 'https://www.meituclub.com/';
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: HOME_URL,
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('#index-tab-main .posts-item.card');
ctx.state.data = {
title: '妹图社 - 最新',
link: HOME_URL,
item: list
.map((index, item) => {
item = $(item);
const img = item.find('.item-thumbnail').find('img');
const heading = item.find('.item-heading').find('a');
return {
title: heading.text(),
description: art(path.join(__dirname, 'templates/description.art'), {
src: img.attr('data-src'),
alt: img.attr('alt'),
}),
link: heading.attr('href'),
pubDate: timezone(parseDate(item.find('.item-meta').find('.icon-circle').attr('title'), 'YYYY-MM-DD HH:mm:ss'), +8),
};
})
.get(),
};
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/latest': ['ocleo1'],
};
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
'meituclub.com': {
_name: '妹图社',
'.': [
{
title: '最新',
docs: 'https://docs.rsshub.app/picture.html#mei-tu-she-zui-xin',
source: ['/'],
target: '/meituclub/latest',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/latest', require('./latest'));
};
@@ -0,0 +1 @@
<img src="{{ src }}" alt="{{ alt }}" />