mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add onenote gem add-ins release history (#6241)
This commit is contained in:
@@ -200,6 +200,12 @@ pageClass: routes
|
||||
|
||||
<Route author="cielpy" example="/nvidia/webdriverupdate" path="/nvidia/webdriverupdate"/>
|
||||
|
||||
## OneNote Gem Add-Ins
|
||||
|
||||
### Release History
|
||||
|
||||
<Route author="nczitzk" example="/onenotegem/release" path="/onenotegem/release"/>
|
||||
|
||||
## PlayStation
|
||||
|
||||
### PlayStation 4 系统更新纪录
|
||||
|
||||
@@ -3512,6 +3512,9 @@ router.get('/uisdc/news', require('./routes/uisdc/news'));
|
||||
router.get('/uisdc/zt/:title?', require('./routes/uisdc/zt'));
|
||||
router.get('/uisdc/topic/:title?/:sort?', require('./routes/uisdc/topic'));
|
||||
|
||||
// OneNote Gem Add-Ins
|
||||
router.get('/onenotegem/release', require('./routes/onenotegem/release'));
|
||||
|
||||
// Mind42
|
||||
router.get('/mind42/tag/:id', require('./routes/mind42/tag'));
|
||||
router.get('/mind42/search/:keyword', require('./routes/mind42/search'));
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'http://www.onenotegem.com';
|
||||
const currentUrl = `${rootUrl}/a/release`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('.paragraph ul li a')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.text(),
|
||||
link: `${rootUrl}${item.attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
const title = content('h1.wsite-content-title');
|
||||
|
||||
item.description = title.next().next().next().html();
|
||||
item.pubDate = new Date(title.next().text()).toUTCString();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'OneNote Gem Addins Release History',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user