mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-13 00:35:57 +08:00
@@ -1066,6 +1066,18 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="Fatpandac" example="/tingshen" path="/tingshen"/>
|
<Route author="Fatpandac" example="/tingshen" path="/tingshen"/>
|
||||||
|
|
||||||
|
## 中国无线电协会业余无线电分会
|
||||||
|
|
||||||
|
### 最新资讯
|
||||||
|
|
||||||
|
<Route author="Misaka13514" example="/crac/2" path="/crac/:type?" :paramsDesc="['类型,见下表,默认为全部']" radar="1" rssbud="1">
|
||||||
|
|
||||||
|
| 新闻动态 | 通知公告 | 政策法规 | 常见问题 | 资料下载 | English | 业余中继台 | 科普专栏 |
|
||||||
|
| ---- | ---- | ---- | ---- | ---- | ------- | ----- | ---- |
|
||||||
|
| 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 |
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
## 中国信息通信研究院
|
## 中国信息通信研究院
|
||||||
|
|
||||||
### 白皮书
|
### 白皮书
|
||||||
|
|||||||
46
lib/v2/crac/index.js
Normal file
46
lib/v2/crac/index.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
const cheerio = require('cheerio');
|
||||||
|
const got = require('@/utils/got');
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const baseUrl = 'http://www.crac.org.cn';
|
||||||
|
const type = ctx.params.type;
|
||||||
|
const link = type ? `${baseUrl}/News/List?type=${type}` : `${baseUrl}/News/List`;
|
||||||
|
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: link,
|
||||||
|
});
|
||||||
|
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
const list = $('div.InCont_r_d_cont > li')
|
||||||
|
.map((_, item) => {
|
||||||
|
item = $(item);
|
||||||
|
return {
|
||||||
|
link: new URL(item.find('a').attr('href'), baseUrl).href,
|
||||||
|
pubDate: parseDate(item.find('span.cont_d').text(), 'YYYY-MM-DD'),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get();
|
||||||
|
|
||||||
|
await Promise.all(
|
||||||
|
list.map((item) =>
|
||||||
|
ctx.cache.tryGet(item.link, async () => {
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: item.link,
|
||||||
|
});
|
||||||
|
const content = cheerio.load(response.data);
|
||||||
|
item.title = content('div.r_d_cont_title > h3').text();
|
||||||
|
item.description = content('div.r_d_cont').html().trim().replace(/\n/g, '');
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: $('title').text(),
|
||||||
|
link,
|
||||||
|
item: list,
|
||||||
|
};
|
||||||
|
};
|
||||||
3
lib/v2/crac/maintainer.js
Normal file
3
lib/v2/crac/maintainer.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
'/:type?': ['Misaka13514'],
|
||||||
|
};
|
||||||
13
lib/v2/crac/radar.js
Normal file
13
lib/v2/crac/radar.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
module.exports = {
|
||||||
|
'crac.org.cn': {
|
||||||
|
_name: '中国无线电协会业余无线电分会',
|
||||||
|
www: [
|
||||||
|
{
|
||||||
|
title: '最新资讯',
|
||||||
|
docs: 'https://docs.rsshub.app/government.html#zhong-guo-wu-xian-dian-xie-hui-ye-yu-wu-xian-dian-fen-hui',
|
||||||
|
source: '/News/List',
|
||||||
|
target: (params, url) => `/crac/${new URL(url).searchParams.get('type') || ''}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
3
lib/v2/crac/router.js
Normal file
3
lib/v2/crac/router.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = function (router) {
|
||||||
|
router.get('/:type?', require('./index'));
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user