mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 21:47:57 +08:00
feat: add mobilism ebook releases (#4867)
This commit is contained in:
@@ -10,6 +10,12 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="HenryQW" example="/allpoetry/newest" path="/allpoetry/:order?" :paramsDesc="['排序方式, `best` 或 `newest`, 缺省 `best`']"/>
|
<Route author="HenryQW" example="/allpoetry/newest" path="/allpoetry/:order?" :paramsDesc="['排序方式, `best` 或 `newest`, 缺省 `best`']"/>
|
||||||
|
|
||||||
|
## Mobilism
|
||||||
|
|
||||||
|
### eBook Releases
|
||||||
|
|
||||||
|
<Route author="nczitzk" example="/mobilism/release" path="/mobilism/release" />
|
||||||
|
|
||||||
## UU 看书
|
## UU 看书
|
||||||
|
|
||||||
### 小说更新
|
### 小说更新
|
||||||
|
|||||||
@@ -2771,4 +2771,7 @@ router.get('/zhutix/latest', require('./routes/zhutix/latest'));
|
|||||||
// arXiv
|
// arXiv
|
||||||
router.get('/arxiv/:query', require('./routes/arxiv/query'));
|
router.get('/arxiv/:query', require('./routes/arxiv/query'));
|
||||||
|
|
||||||
|
// Mobilism
|
||||||
|
router.get('/mobilism/release', require('./routes/mobilism/release'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
43
lib/routes/mobilism/release.js
Normal file
43
lib/routes/mobilism/release.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const url = require('url');
|
||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const currentUrl = `https://forum.mobilism.org/viewforum.php?f=19`;
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: currentUrl,
|
||||||
|
});
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
const list = $('tbody')
|
||||||
|
.eq(1)
|
||||||
|
.find('tr')
|
||||||
|
.map((_, item) => {
|
||||||
|
item = $(item);
|
||||||
|
const a = item.find('a');
|
||||||
|
return {
|
||||||
|
title: a.text(),
|
||||||
|
link: url.resolve(`https://forum.mobilism.org`, a.attr('href')),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get();
|
||||||
|
|
||||||
|
const items = await Promise.all(
|
||||||
|
list.map(
|
||||||
|
async (item) =>
|
||||||
|
await ctx.cache.tryGet(item.link, async () => {
|
||||||
|
const res = await got({ method: 'get', url: item.link });
|
||||||
|
const content = cheerio.load(res.data);
|
||||||
|
|
||||||
|
item.description = content('div.content').html();
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: 'Mobilism - eBook Releases',
|
||||||
|
link: currentUrl,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user