mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 15:47:48 +08:00
feat: add 四川省科学技术厅 (#4284)
This commit is contained in:
@@ -427,6 +427,18 @@ type 为 all 时,category 参数不支持 cost 和 free
|
|||||||
|
|
||||||
<Route author="Jeason0228" example="/szse/inquire/navall" path="/szse/inquire/:type" :paramsDesc="['tab选项,navall为全部,nav1为主板,nav2,为中小企业板,nav3位创业板']"/>
|
<Route author="Jeason0228" example="/szse/inquire/navall" path="/szse/inquire/:type" :paramsDesc="['tab选项,navall为全部,nav1为主板,nav2,为中小企业板,nav3位创业板']"/>
|
||||||
|
|
||||||
|
## 四川省科学技术厅
|
||||||
|
|
||||||
|
### 四川省科学技术厅-公示公告
|
||||||
|
|
||||||
|
<Route author="Cubernet" example="/sckjt/news" path="/sckjt/news/:type?" :paramsDesc="['默认为`tz`']">
|
||||||
|
|
||||||
|
| 通知 | 公示公告 |
|
||||||
|
| ---- | -------- |
|
||||||
|
| tz | gs |
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
## 搜狗
|
## 搜狗
|
||||||
|
|
||||||
### 搜狗特色 LOGO
|
### 搜狗特色 LOGO
|
||||||
|
|||||||
@@ -2409,4 +2409,7 @@ router.get('/hubu/news/:type', require('./routes/universities/hubu/news'));
|
|||||||
// 大连海事大学
|
// 大连海事大学
|
||||||
router.get('/dlmu/news/:type', require('./routes/universities/dlmu/news'));
|
router.get('/dlmu/news/:type', require('./routes/universities/dlmu/news'));
|
||||||
|
|
||||||
|
// 四川省科学技术厅
|
||||||
|
router.get('/sckjt/news/:type?', require('./routes/sckjt/news'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
46
lib/routes/sckjt/news.js
Normal file
46
lib/routes/sckjt/news.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
const baseUrl = 'http://kjt.sc.gov.cn';
|
||||||
|
const dateRegex = /\((\d{4})-(\d{2})-(\d{2})\)/;
|
||||||
|
|
||||||
|
const map = {
|
||||||
|
tz: '/tz/index.jhtml',
|
||||||
|
gs: '/gs/index.jhtml',
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const type = ctx.params.type || 'tz';
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: baseUrl + map[type],
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = response.data;
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '四川省科学技术厅',
|
||||||
|
link: baseUrl,
|
||||||
|
item: $('div[class="news_middle_top"]')
|
||||||
|
.next('div')
|
||||||
|
.children('h2')
|
||||||
|
.slice(0, 15)
|
||||||
|
.map((_, elem) => ({
|
||||||
|
link:
|
||||||
|
baseUrl +
|
||||||
|
$(elem)
|
||||||
|
.children('a')
|
||||||
|
.attr('href'),
|
||||||
|
title: $(elem)
|
||||||
|
.children('a')
|
||||||
|
.text(),
|
||||||
|
pubDate: new Date(
|
||||||
|
$(elem)
|
||||||
|
.children('span')
|
||||||
|
.text()
|
||||||
|
.replace(dateRegex, '$1-$2-$3')
|
||||||
|
).toUTCString(),
|
||||||
|
}))
|
||||||
|
.get(),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user