mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-19 01:43:35 +08:00
feat: add route 漫小肆 (#5207)
Co-authored-by: junfeng <junfeng_pan96@qq.com>
This commit is contained in:
@@ -2095,4 +2095,15 @@
|
||||
},
|
||||
],
|
||||
},
|
||||
'manxiaosi.com': {
|
||||
_name: '漫小肆',
|
||||
'.': [
|
||||
{
|
||||
title: '漫画更新',
|
||||
docs: 'https://docs.rsshub.app/anime.html#man-xiao-si',
|
||||
source: '/book/:id',
|
||||
target: '/manxiaosi/book/:id',
|
||||
}
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -337,3 +337,9 @@ pageClass: routes
|
||||
### 最新汉化
|
||||
|
||||
<Route author="junfengP" example="/zdfx" path="/zdfx"/>
|
||||
|
||||
## 漫小肆
|
||||
|
||||
### 漫画更新
|
||||
|
||||
<Route author="junfengP" path="/manxiaosi/book/:id" example="/manxiaosi/book/90" :paramsDesc="['漫画id,漫画主页的地址栏中']" radar="1"/>
|
||||
|
||||
@@ -2956,4 +2956,10 @@ router.get('/ngbj/cat/:cat', require('./routes/niaogebiji/cat'));
|
||||
// 东方我乐多丛志
|
||||
router.get('/touhougarakuta/:language/:type', require('./routes/touhougarakuta'));
|
||||
|
||||
// 漫小肆
|
||||
router.get('/manxiaosi/book/:id', require('./routes/manxiaosi/book'));
|
||||
|
||||
// 吉林大学校内通知
|
||||
router.get('/jlu/oa', require('./routes/universities/jlu/oa'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const host = 'http://www.manxiaosi.com';
|
||||
const ua = 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Mobile Safari/537.36';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const url = host + `/book/${id}`;
|
||||
const response = await got.get(url);
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('#detail-list-select > li > a').reverse().slice(0, 10).get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
item = $(item);
|
||||
const itemLink = host + item.attr('href');
|
||||
const simple = {
|
||||
title: item.text(),
|
||||
link: itemLink,
|
||||
};
|
||||
const details = await ctx.cache.tryGet(itemLink, async () => {
|
||||
// 具体页面限制手机UA
|
||||
const response = await got.get(itemLink, {
|
||||
headers: {
|
||||
'user-agent': ua,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.body);
|
||||
return {
|
||||
description: $('div#cp_img').html(),
|
||||
};
|
||||
});
|
||||
return Promise.resolve(Object.assign({}, simple, details));
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: '漫小肆 ' + $('div.info > h1').text(),
|
||||
link: url,
|
||||
description: '漫小肆 ' + $('div.info > h1').text(),
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user