mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 05:03:44 +08:00
feat:增加中国退伍士兵信息公开网 (#2357)
This commit is contained in:
@@ -154,3 +154,11 @@ pageClass: routes
|
||||
### 公示
|
||||
|
||||
<Route author="billyct" example="/gov/mee/gs" path="/gov/mee/gs"/>
|
||||
|
||||
## 中华人民共和国退役军人事务部
|
||||
|
||||
### 部内信息
|
||||
|
||||
<Route author="SunShinenny" example="/gov/veterans/bnxx" path="/gov/veterans/bnxx"/>
|
||||
### 政策解读
|
||||
<Route author="SunShinenny" example="/gov/veterans/zcjd" path="/gov/veterans/zcjd"/>
|
||||
|
||||
@@ -1377,6 +1377,10 @@ router.get('/maoyan/upcoming', require('./routes/maoyan/upcoming'));
|
||||
// cnBeta
|
||||
router.get('/cnbeta', require('./routes/cnbeta/home'));
|
||||
|
||||
// 退伍士兵信息
|
||||
router.get('/gov/veterans/bnxx', require('./routes/gov/veterans/bnxx'));
|
||||
router.get('/gov/veterans/zcjd', require('./routes/gov/veterans/zcjd'));
|
||||
|
||||
// Dilbert Comic Strip
|
||||
router.get('/dilbert/strip', require('./routes/dilbert/strip'));
|
||||
|
||||
|
||||
62
lib/routes/gov/veterans/bnxx.js
Normal file
62
lib/routes/gov/veterans/bnxx.js
Normal file
@@ -0,0 +1,62 @@
|
||||
const axios = require('@/utils/got');
|
||||
const host = 'http://www.mva.gov.cn/sy/xx/bnxx/';
|
||||
const cheerio = require('cheerio');
|
||||
async function load(link, ctx) {
|
||||
const cache = await ctx.cache.get(link);
|
||||
if (cache) {
|
||||
return cache;
|
||||
}
|
||||
|
||||
const response = await axios.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const introduce = $('#div_zhengwen > div').text();
|
||||
const temp = $('#main > div.outerlayer > div > div > div.article-info').text();
|
||||
const pubDate = temp.substring(3, 20);
|
||||
const author = temp.substring(24, temp.indexOf('分享到'));
|
||||
|
||||
const detailResult = `${introduce}`;
|
||||
|
||||
// 定义description,并指定内容
|
||||
const description = detailResult;
|
||||
await ctx.cache.set(link, description);
|
||||
return {
|
||||
description,
|
||||
link: link,
|
||||
pubDate: pubDate,
|
||||
author: author,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const page = host;
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: page,
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('#main > div.overview.container.clearfix > div.overview-right.fr > div > div.public_list_team > ul > li > a').get();
|
||||
|
||||
const process = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
let itemUrl = $(item).attr('href');
|
||||
if (itemUrl.indexOf('./') === 0) {
|
||||
itemUrl = host + itemUrl.substring(2);
|
||||
}
|
||||
const single = {
|
||||
title: $(item).text(),
|
||||
link: itemUrl,
|
||||
guid: itemUrl,
|
||||
};
|
||||
const other = await load(String(itemUrl), ctx);
|
||||
return Promise.resolve(Object.assign({}, single, other));
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: `中华人民共和国退役军人事务部 - 部内信息`,
|
||||
link: `http://www.mva.gov.cn/sy/xx/bnxx`,
|
||||
description: `中华人民共和国退役军人事务部-部内信息更新提示`,
|
||||
item: process,
|
||||
};
|
||||
};
|
||||
62
lib/routes/gov/veterans/zcjd.js
Normal file
62
lib/routes/gov/veterans/zcjd.js
Normal file
@@ -0,0 +1,62 @@
|
||||
const axios = require('@/utils/got');
|
||||
const host = 'http://www.mva.gov.cn/jiedu/zcjd/';
|
||||
const cheerio = require('cheerio');
|
||||
async function load(link, ctx) {
|
||||
const cache = await ctx.cache.get(link);
|
||||
if (cache) {
|
||||
return cache;
|
||||
}
|
||||
|
||||
const response = await axios.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const introduce = $('#div_zhengwen > div').text();
|
||||
const temp = $('#main > div.outerlayer > div > div > div.article-info').text();
|
||||
const pubDate = temp.substring(3, 20);
|
||||
const author = temp.substring(24, temp.indexOf('分享到'));
|
||||
|
||||
const detailResult = `${introduce}`;
|
||||
|
||||
// 定义description,并指定内容
|
||||
const description = detailResult;
|
||||
await ctx.cache.set(link, description);
|
||||
return {
|
||||
description,
|
||||
link: link,
|
||||
pubDate: pubDate,
|
||||
author: author,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const page = host;
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: page,
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('#main > div.overview.container.clearfix > div.overview-right.fr > div > div.public_list_team > ul > li > a').get();
|
||||
|
||||
const process = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
let itemUrl = $(item).attr('href');
|
||||
if (itemUrl.indexOf('./') === 0) {
|
||||
itemUrl = host + itemUrl.substring(2);
|
||||
}
|
||||
const single = {
|
||||
title: $(item).text(),
|
||||
link: itemUrl,
|
||||
guid: itemUrl,
|
||||
};
|
||||
const other = await load(String(itemUrl), ctx);
|
||||
return Promise.resolve(Object.assign({}, single, other));
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: `中华人民共和国退役军人事务部 - 政策解读`,
|
||||
link: `http://www.mva.gov.cn/sy/xx/bnxx`,
|
||||
description: `中华人民共和国退役军人事务部-政策解读更新提示`,
|
||||
item: process,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user