mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): 澳門特別行政區政府各公共部門獎助貸學金服務平台 (#7547)
This commit is contained in:
@@ -973,3 +973,15 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
### はてな匿名ダイアリー - 人気記事アーカイブ
|
||||
|
||||
<Route author="masakichi" example="/hatena/anonymous_diary/archive" path="/hatena/anonymous_diary/archive"/>
|
||||
|
||||
### 澳門特別行政區政府各公共部門獎助貸學金服務平台
|
||||
|
||||
官方網址:<https://www.bolsas.gov.mo/>
|
||||
|
||||
<Route author="KeiLongW" example="/macau-bolsas" path="/macau-bolsas/:lang?" :paramsDesc="['語言']" >
|
||||
|
||||
| 中文 | 葡文 |
|
||||
| ---- | ---- |
|
||||
| ch | pt |
|
||||
|
||||
</Route>
|
||||
|
||||
@@ -4103,4 +4103,7 @@ router.get('/hainanu/ssszs', require('./routes/hainanu/ssszs'));
|
||||
// 游戏年轮
|
||||
router.get('/bibgame/:category?/:type?', require('./routes/bibgame/category'));
|
||||
|
||||
// 澳門特別行政區政府各公共部門獎助貸學金服務平台
|
||||
router.get('/macau-bolsas/:lang?', require('./routes/macau-bolsas/index'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const lang = ctx.params.lang;
|
||||
const url = `https://www.bolsas.gov.mo/${lang === 'pt' ? lang : ''}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: url,
|
||||
});
|
||||
const $Wrapper = cheerio.load(response.data);
|
||||
const liItems = $Wrapper('ul.news-list li');
|
||||
const items = await Promise.all(
|
||||
liItems &&
|
||||
liItems
|
||||
.map(async (_, item) => {
|
||||
const $item = $Wrapper(item);
|
||||
const $newsItem = $item.find('.news-item');
|
||||
const bureau = $newsItem.find('.label').text();
|
||||
const title = $newsItem.find('.title').text();
|
||||
const link = $newsItem.find('.title').attr('href');
|
||||
const pubDate = new Date($item.find('.date').text() + 'T00:00:00+0800');
|
||||
const description = await ctx.cache.tryGet(link, async () => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
return $('.news-content').html();
|
||||
});
|
||||
return Promise.resolve({
|
||||
title: `[${bureau}] ${title}`,
|
||||
link,
|
||||
description,
|
||||
pubDate,
|
||||
});
|
||||
})
|
||||
.get()
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '澳門特別行政區政府各公共部門獎助貸學金服務平台',
|
||||
link: url,
|
||||
description: '澳門特別行政區政府各公共部門獎助貸學金服務平台',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user