Add(route): add 澳門 衛生局 (#8777)
This commit is contained in:
@@ -16,6 +16,12 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
## 澳门卫生局
|
||||
|
||||
### 最新消息
|
||||
|
||||
<Route author="Fatpandac" exmaple="/ssm/news" path="/ssm/news"/>
|
||||
|
||||
## 北京市卫生健康委员会
|
||||
|
||||
### 新闻中心
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/news': ['Fatpandac'],
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const path = require('path');
|
||||
const { art } = require('@/utils/render');
|
||||
|
||||
const rootUrl = `https://www.ssm.gov.mo`;
|
||||
const newsUrl = `${rootUrl}/apps1/content/ch/973/itemlist.aspx?defaultcss=false&dlimit=20&showdate=true&dorder=cridate%20desc,displaydate%20desc&withattach=true`;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got.get(newsUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('body > div > div > ul > li');
|
||||
|
||||
const item = list
|
||||
.map((_, item) => {
|
||||
const title = $(item).find('a').text();
|
||||
const link = $(item).find('a').attr('href');
|
||||
const pubDate = parseDate($(item).find('small').text().split(':')[1].trim(), 'DD/MM/YYYY');
|
||||
const desc = art(path.join(__dirname, 'templates/news.art'), {
|
||||
link,
|
||||
});
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
description: desc,
|
||||
pubDate,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '澳门卫生局-最新消息',
|
||||
link: rootUrl,
|
||||
item,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'ssm.gov.mo': {
|
||||
_name: '澳门卫生局',
|
||||
www: [
|
||||
{
|
||||
title: '最新消息',
|
||||
docs: 'https://docs.rsshub.app/government.html#ao-men-wei-sheng-ju-zui-xin-xiao-xi',
|
||||
source: ['/', '/portal'],
|
||||
target: '/ssm/news',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/news', require('./news'));
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
<iframe width=900 height=1000 src="{{ link }}">
|
||||
Reference in New Issue
Block a user