rss: add xclient app

This commit is contained in:
DIYgod 2018-09-05 18:21:33 +08:00
parent 91e01155e8
commit 4e51922e19
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
3 changed files with 52 additions and 0 deletions

View File

@ -1768,6 +1768,18 @@ GitHub 官方也提供了一些 RSS:
- project: 项目的短名或者 `Project ID`. 项目的短名可以在地址栏获取到, 例如地址为 `https://minecraft.curseforge.com/projects/non-update`, 短名就为 `non-update`. `Project ID` 可在 `Overview` 中的 `About This Project` 中找到
### xclient.info
#### 应用更新
举例: <https://rsshub.app/xclient/app/sketch>
路由: `/xclient/app/:name`
参数:
- name: 应用名,可在应用页 URL 中找到
## 大学通知
### 上海海事大学

View File

@ -530,4 +530,7 @@ router.get('/douyin/user/:id', require('./routes/douyin/user'));
// 少数派 sspai
router.get('/sspai/series', require('./routes/sspai/series'));
// xclient.info
router.get('/xclient/app/:name', require('./routes/xclient/app'));
module.exports = router;

37
routes/xclient/app.js Normal file
View File

@ -0,0 +1,37 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const name = ctx.params.name;
const response = await axios({
method: 'get',
url: `http://xclient.info/s/${name}.html`,
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('#versions tbody tr');
ctx.state.data = {
title: $('title').text(),
link: `http://xclient.info/s/${name}.html`,
description: $('meta[name="description"]').attr('content') || $('title').text(),
item:
list &&
list
.map((index, item) => {
item = $(item);
const td = item.find('td');
return {
title: td.eq(0).text(),
description: `版本号:${td.eq(0).text()}<br>更新日期:${td.eq(2).text()}<br>文件大小:${td.eq(3).text()}`,
pubDate: new Date(td.eq(2).text()).toUTCString(),
link: `http://xclient.info/s/${name}.html`,
guid: td.eq(0).text(),
};
})
.get(),
};
};