mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-29 07:27:22 +08:00
feat: add 中华人民共和国住房和城乡建设部政策发布 (#4647)
This commit is contained in:
@@ -375,6 +375,12 @@ pageClass: routes
|
||||
|
||||
<Route author="nicolaszf" example="/gov/fmprc/fyrbt" path="/gov/fmprc/fyrbt"/>
|
||||
|
||||
## 中华人民共和国住房和城乡建设部
|
||||
|
||||
### 政策发布
|
||||
|
||||
<Route author="nczitzk" example="/gov/mohurd/policy" path="/gov/mohurd/policy"/>
|
||||
|
||||
## 中央纪委国家监委
|
||||
|
||||
### 审查调查
|
||||
|
||||
@@ -1172,6 +1172,9 @@ router.get('/gov/moe/:type', require('./routes/gov/moe/moe'));
|
||||
// 中华人民共和国外交部
|
||||
router.get('/gov/fmprc/fyrbt', require('./routes/gov/fmprc/fyrbt'));
|
||||
|
||||
// 中华人民共和国住房和城乡建设部
|
||||
router.get('/gov/mohurd/policy', require('./routes/gov/mohurd/policy'));
|
||||
|
||||
// 国家新闻出版广电总局
|
||||
router.get('/gov/sapprft/approval/:channel/:detail?', require('./routes/gov/sapprft/7026'));
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `http://www.mohurd.gov.cn/wjfb/index.html`;
|
||||
const response = await got({ method: 'get', url: link });
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('body table tbody tr')
|
||||
.eq(3)
|
||||
.find('td table tbody tr')
|
||||
.eq(2)
|
||||
.find('td table tbody tr')
|
||||
.map((_, item) => {
|
||||
const a = $(item).find('a');
|
||||
const subtitle = $(item).find('td').eq(2).text();
|
||||
return {
|
||||
title: a.text() + (subtitle === '' ? '' : ' - ' + subtitle),
|
||||
link: a.attr('href'),
|
||||
pubDate: new Date($(item).find('td').eq(3).text().substr(1, 10) + ' GMT+8').toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '中华人民共和国住房和城乡建设部 - 政策发布',
|
||||
link: link,
|
||||
item: 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);
|
||||
item.description = content('table[bgcolor="#ffffff"]').html();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user