mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-15 01:30:33 +08:00
feat(route): add "micmicidol" (#8070)
Co-authored-by: SettingDust <settingdust@gmail.com> Co-authored-by: DIYgod <diy.d.god@gmail.com>
This commit is contained in:
@@ -269,6 +269,17 @@ R18 显示
|
|||||||
|
|
||||||
<Route author="hoilc" example="/loveheaven/update/kimetsu-no-yaiba" path="/loveheaven/update/:slug" :paramsDesc="['漫画 slug,可在漫画页面URL中找到,不包括开头的`manga-`,也不包括末尾的`.html`']" />
|
<Route author="hoilc" example="/loveheaven/update/kimetsu-no-yaiba" path="/loveheaven/update/:slug" :paramsDesc="['漫画 slug,可在漫画页面URL中找到,不包括开头的`manga-`,也不包括末尾的`.html`']" />
|
||||||
|
|
||||||
|
## Mic Mic Idol
|
||||||
|
|
||||||
|
### 最新
|
||||||
|
|
||||||
|
<Route author="KotoriK" example="/micmicidol" path="/micmicidol"/>
|
||||||
|
|
||||||
|
### 标签
|
||||||
|
|
||||||
|
<Route author="KotoriK" example="/micmicidol/search/Young%20Jump?limit=50" path="/micmicidol/search/:label" :paramsDesc="['标签名']"/>
|
||||||
|
获取数量可以通过 [limit](https://docs.rsshub.app/parameter.html#tiao-shu-xian-zhi) 参数控制。默认值为`50`。
|
||||||
|
|
||||||
## MM 范
|
## MM 范
|
||||||
|
|
||||||
### 分类
|
### 分类
|
||||||
|
|||||||
@@ -4212,6 +4212,10 @@ router.get('/right/forum/:id?', lazyloadRouteHandler('./routes/right/forum'));
|
|||||||
// 香港經濟日報
|
// 香港經濟日報
|
||||||
router.get('/hket/:category?', lazyloadRouteHandler('./routes/hket/index'));
|
router.get('/hket/:category?', lazyloadRouteHandler('./routes/hket/index'));
|
||||||
|
|
||||||
|
// micmicidol
|
||||||
|
router.get('/micmicidol', lazyloadRouteHandler('./routes/micmicidol/latest'));
|
||||||
|
router.get('/micmicidol/search/:label', lazyloadRouteHandler('./routes/micmicidol/search'));
|
||||||
|
|
||||||
// 香港高登
|
// 香港高登
|
||||||
router.get('/hkgolden/:id?/:limit?/:sort?', lazyloadRouteHandler('./routes/hkgolden'));
|
router.get('/hkgolden/:id?/:limit?/:sort?', lazyloadRouteHandler('./routes/hkgolden'));
|
||||||
|
|
||||||
|
|||||||
28
lib/routes/micmicidol/article.js
Normal file
28
lib/routes/micmicidol/article.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const Cheerio = require('cheerio');
|
||||||
|
const got = require('@/utils/got');
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
|
const regStripAnchor = /(?:<br\/?> *)?<a name="more"\/?>(?:<\/a>)(?: *<br\/?>)?/i;
|
||||||
|
|
||||||
|
async function loadArticle(link) {
|
||||||
|
const resp = await got(link);
|
||||||
|
const $ = Cheerio.load(resp.body);
|
||||||
|
const matchResult = $('#post-header-top > script')
|
||||||
|
.html()
|
||||||
|
.match(/var timestamp="\w+,(.+)";/i)[1]
|
||||||
|
.trim();
|
||||||
|
// Ex. "August 20, 2021"
|
||||||
|
const pubDate = parseDate(matchResult + '+0000', 'MMMM D, YYYYZ');
|
||||||
|
|
||||||
|
const labels = $('.post-labels a')
|
||||||
|
.text()
|
||||||
|
.split('\n')
|
||||||
|
.filter((item) => item !== '');
|
||||||
|
return {
|
||||||
|
title: $('.entry-title').text().trim(),
|
||||||
|
description: $('.post-body.entry-content').html().replace(regStripAnchor, ''),
|
||||||
|
category: labels,
|
||||||
|
pubDate,
|
||||||
|
link,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
module.exports = loadArticle;
|
||||||
3
lib/routes/micmicidol/latest.js
Normal file
3
lib/routes/micmicidol/latest.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
const parse = require('./parse');
|
||||||
|
|
||||||
|
module.exports = (ctx) => parse(ctx, '', 'Latest');
|
||||||
22
lib/routes/micmicidol/parse.js
Normal file
22
lib/routes/micmicidol/parse.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const Cheerio = require('cheerio');
|
||||||
|
const loadArticle = require('./article');
|
||||||
|
|
||||||
|
module.exports = async (ctx, urlParam, title) => {
|
||||||
|
const link = new URL(urlParam, 'https://www.micmicidol.com/').toString();
|
||||||
|
const response = await got(link);
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `micmicidol-${title}`,
|
||||||
|
link,
|
||||||
|
item:
|
||||||
|
response.body &&
|
||||||
|
(await Promise.all(
|
||||||
|
Cheerio.load(response.body)('.post.hentry')
|
||||||
|
.map((_, entry) => {
|
||||||
|
const { href } = Cheerio.load(entry)('.post-title.entry-title a')[0].attribs;
|
||||||
|
return ctx.cache.tryGet(href, () => loadArticle(href));
|
||||||
|
})
|
||||||
|
.toArray()
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
};
|
||||||
7
lib/routes/micmicidol/search.js
Normal file
7
lib/routes/micmicidol/search.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
const parse = require('./parse');
|
||||||
|
|
||||||
|
module.exports = (ctx) => {
|
||||||
|
const max = ctx.query.limit || 50;
|
||||||
|
const { label } = ctx.params;
|
||||||
|
return parse(ctx, `search/label/${label}?max-results=${max}`, label);
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user