mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 21:47:57 +08:00
feat: add 广东省教育厅资讯中心 (#4813)
This commit is contained in:
@@ -16,6 +16,18 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
## 广东省人民政府
|
||||
|
||||
### 广东省教育厅
|
||||
|
||||
<Route author="nczitzk" example="/gov/guangdong/edu/tzgg" path="/gov/guangdong/edu/:caty" :paramsDesc="['资讯类别']">
|
||||
|
||||
| 通知公告 | 本厅信息 | 新闻发布 | 媒体聚焦 | 广东教育 | 教育动态 | 图片新闻 | 政声传递 |
|
||||
| :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: |
|
||||
| tzgg | btxx | xwfb | mtjj | gdjy | jydt | tpxw | zscd |
|
||||
|
||||
</Route>
|
||||
|
||||
## 国家新闻出版广电总局
|
||||
|
||||
### 游戏审批结果
|
||||
|
||||
@@ -1200,6 +1200,9 @@ router.get('/gov/beijing/mhc/:caty', require('./routes/gov/beijing/mhc'));
|
||||
// 北京考试院
|
||||
router.get('/gov/beijing/bjeea/:type', require('./routes/gov/beijing/eea'));
|
||||
|
||||
// 广东省教育厅
|
||||
router.get('/gov/guangdong/edu/:caty', require('./routes/gov/guangdong/edu'));
|
||||
|
||||
// 小黑盒
|
||||
router.get('/xiaoheihe/user/:id', require('./routes/xiaoheihe/user'));
|
||||
router.get('/xiaoheihe/news', require('./routes/xiaoheihe/news'));
|
||||
|
||||
80
lib/routes/gov/guangdong/edu.js
Normal file
80
lib/routes/gov/guangdong/edu.js
Normal file
@@ -0,0 +1,80 @@
|
||||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const rootUrl = 'http://edu.gd.gov.cn/';
|
||||
|
||||
const config = {
|
||||
tzgg: {
|
||||
link: '/zxzx/tzgg/',
|
||||
title: '通知公告',
|
||||
},
|
||||
btxx: {
|
||||
link: '/zxzx/btxx/',
|
||||
title: '本厅信息',
|
||||
},
|
||||
xwfb: {
|
||||
link: '/zxzx/xwfb/',
|
||||
title: '新闻发布',
|
||||
},
|
||||
mtjj: {
|
||||
link: '/zxzx/mtjj/',
|
||||
title: '媒体聚焦',
|
||||
},
|
||||
gdjy: {
|
||||
link: '/zxzx/gdjy/',
|
||||
title: '广东教育',
|
||||
},
|
||||
jydt: {
|
||||
link: '/zxzx/jydt/',
|
||||
title: '教育动态',
|
||||
},
|
||||
tpxw: {
|
||||
link: '/zxzx/tpxw/',
|
||||
title: '图片新闻',
|
||||
},
|
||||
zscd: {
|
||||
link: '/zxzx/tzgg/',
|
||||
title: '政声传递',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const cfg = config[ctx.params.caty];
|
||||
if (!cfg) {
|
||||
throw Error('Bad category. See <a href="https://docs.rsshub.app/government.html#guang-dong-sheng-jiao-yu-ting">docs</a>');
|
||||
}
|
||||
|
||||
const currentUrl = url.resolve(rootUrl, cfg.link);
|
||||
const response = await got({ method: 'get', url: currentUrl });
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('div.list_list ul li')
|
||||
.map((_, item) => {
|
||||
item = $(item).find('a');
|
||||
return {
|
||||
title: item.text(),
|
||||
link: item.attr('href'),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = 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('div.concent_center').html();
|
||||
item.pubDate = new Date(content('td[align="right"]').text().replace(/发布日期:/, '') + ' GMT+8').toUTCString();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '广东省教育厅 - ' + cfg.title,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user