mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 05:03:44 +08:00
@@ -2823,3 +2823,7 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
|
||||
### 政府
|
||||
|
||||
<route name="最新政策" author="SettingDust" example="/gov/zhengce/zuixin" path="/gov/zhengce/zuixin"/>
|
||||
|
||||
### 移动支付网
|
||||
|
||||
<route name="新闻" author="LogicJake" example="/mpaypass/news" path="/mpaypass/news"/>
|
||||
|
||||
@@ -1006,4 +1006,6 @@ router.get('/gov/zhengce/zuixin', require('./routes/gov/zhengce/zuixin'));
|
||||
// 小黑盒
|
||||
router.get('/xiaoheihe/user/:id', require('./routes/xiaoheihe/user'));
|
||||
|
||||
// 移动支付
|
||||
router.get('/mpaypass/news', require('./routes/mpaypass/news'));
|
||||
module.exports = router;
|
||||
|
||||
46
lib/routes/mpaypass/news.js
Normal file
46
lib/routes/mpaypass/news.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `http://m.mpaypass.com.cn/`;
|
||||
const listData = await axios.get(link);
|
||||
const $list = cheerio.load(listData.data);
|
||||
ctx.state.data = {
|
||||
title: `新闻 - 移动支付网`,
|
||||
link,
|
||||
item: await Promise.all(
|
||||
$list('.newsbodylist')
|
||||
.map(async (_, el) => {
|
||||
const $el = $list(el);
|
||||
const $a = $el.find('.newsbodylist-title a');
|
||||
const href = $a.attr('href');
|
||||
const title = $a.text();
|
||||
const date = $el
|
||||
.find('.newsbodylist-title span')
|
||||
.text()
|
||||
.split('|')[1];
|
||||
|
||||
const key = `${href}`;
|
||||
let description;
|
||||
const value = await ctx.cache.get(key);
|
||||
|
||||
if (value) {
|
||||
description = value;
|
||||
} else {
|
||||
const contentData = await axios.get(href);
|
||||
const $content = cheerio.load(contentData.data);
|
||||
description = $content('.newsbody').html();
|
||||
ctx.cache.set(key, description, 24 * 60 * 60);
|
||||
}
|
||||
|
||||
return {
|
||||
title: title,
|
||||
description,
|
||||
link: href,
|
||||
pubDate: new Date(date).toUTCString(),
|
||||
};
|
||||
})
|
||||
.get()
|
||||
),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user