feat: add xyplorer what's new (#6334)

This commit is contained in:
Ethan Shen
2020-12-04 15:59:38 +00:00
committed by GitHub
parent 99a2e32b51
commit 83a0f2d705
4 changed files with 47 additions and 0 deletions
+6
View File
@@ -232,3 +232,9 @@ Refer to [#minecraft](/en/game.html#minecraft)
### Module Update
<RouteEn author="nczitzk" example="/xposed/module/com.ext.star.wars" path="/xposed/module/:mod" :paramsDesc="['module package name']"/>
## XYplorer
### What's New
<RouteEn author="nczitzk" example="/xyplorer/whatsnew" path="/xyplorer/whatsnew"/>
+6
View File
@@ -312,6 +312,12 @@ pageClass: routes
<Route author="nczitzk" example="/xposed/module/com.ext.star.wars" path="/xposed/module/:mod" :paramsDesc="['模块包名, 模块页中的 Package 字段']"/>
## XYplorer
### What's New
<Route author="nczitzk" example="/xyplorer/whatsnew" path="/xyplorer/whatsnew"/>
## 怪物猎人世界
### 更新
+3
View File
@@ -3517,6 +3517,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'));
// XYplorer
router.get('/xyplorer/whatsnew', require('./routes/xyplorer/whatsnew'));
// RescueTime
router.get('/rescuetime/release-notes/:os?', require('./routes/rescuetime/release-notes'));
+32
View File
@@ -0,0 +1,32 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const date = require('@/utils/date');
module.exports = async (ctx) => {
const rootUrl = 'https://www.xyplorer.com';
const currentUrl = `${rootUrl}/whatsnew.php`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const items = $('.waznu')
.map((_, item) => {
item = $(item);
return {
link: currentUrl,
description: item.html(),
title: item.prev().prev().text(),
pubDate: date(item.prev().text().replace('released ', '')),
};
})
.get();
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};