mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): add shuax 项目 (#7025)
Co-authored-by: NeverBehave <gayhub@never.pet>
This commit is contained in:
co-authored by
NeverBehave
parent
d2abeb9883
commit
e025857586
@@ -354,6 +354,18 @@ pageClass: routes
|
||||
|
||||
<Route author="nczitzk" example="/sesame/release_notes" path="/sesame/release_notes"/>
|
||||
|
||||
## Shuax
|
||||
|
||||
### Project
|
||||
|
||||
<Route author="nczitzk" example="/shuax/project/chrome" path="/shuax/project" :paramsDesc="['项目名,见下表,默认为 MouseInc']">
|
||||
|
||||
| MouseInc | Chrome | Edge |
|
||||
| -------- | ------ | ---- |
|
||||
| mouseinc | chrome | edge |
|
||||
|
||||
</Route>
|
||||
|
||||
## simpread
|
||||
|
||||
### 消息通知
|
||||
|
||||
@@ -3933,6 +3933,9 @@ router.get('/tianyancha/hot', require('./routes/tianyancha/hot'));
|
||||
// King Arthur
|
||||
router.get('/kingarthur/:type', require('./routes/kingarthur/index'));
|
||||
|
||||
// Shuax
|
||||
router.get('/shuax/project/:name?', require('./routes/shuax/project'));
|
||||
|
||||
// BioOne
|
||||
router.get('/bioone/featured', require('./routes/bioone/featured'));
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const name = ctx.params.name || 'mouseinc';
|
||||
|
||||
const rootUrl = 'https://shuax.com';
|
||||
const currentUrl = `${rootUrl}/project/${name}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
$('.love-box').remove();
|
||||
|
||||
const title = $('title').text();
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${title.split(' ')[0]} - 耍下`,
|
||||
link: currentUrl,
|
||||
item: [
|
||||
{
|
||||
link: currentUrl,
|
||||
title: title.replace(' – 耍下', ''),
|
||||
description: $('#page-content').html(),
|
||||
pubDate: new Date(
|
||||
response.data
|
||||
.match(/\d{4}年\d+月\d+日/)[0]
|
||||
.replace(/年|月/g, '-')
|
||||
.replace('日', '')
|
||||
).toUTCString(),
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user