feat(route): fjksbm (#11723)
Co-authored-by: nczitzk <42264778+nczitzk@users.noreply.github.com>
This commit is contained in:
parent
304c84a0d1
commit
5d88133082
|
|
@ -302,6 +302,18 @@ path="/ctfhub/upcoming/:limit?"
|
|||
|
||||
</Route>
|
||||
|
||||
## 福建考试报名网
|
||||
|
||||
### 分类
|
||||
|
||||
<Route author="nczitzk" example="/fjksbm" path="/fjksbm/:category?" :paramsDesc="['分类,见下表,默认为网络报名进行中']" radar="1">
|
||||
|
||||
| 已发布公告 (方案),即将开始 | 网络报名进行中 | 网络报名结束等待打印准考证 | 正在打印准考证 | 考试结束,等待发布成绩 | 已发布成绩 | 新闻动态 | 政策法规 |
|
||||
| --------------- | ------- | ------------- | ------- | ----------- | ----- | ---- | ------ |
|
||||
| 0 | 1 | 2 | 3 | 4 | 5 | news | policy |
|
||||
|
||||
</Route>
|
||||
|
||||
## 杭州市国家普通话测试网报信息
|
||||
|
||||
### 考试信息
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ?? '0';
|
||||
|
||||
const id = parseInt(category);
|
||||
const isNumber = !isNaN(id);
|
||||
|
||||
const rootUrl = 'https://fjksbm.com';
|
||||
const currentUrl = `${rootUrl}/portal${isNumber ? '' : `/${category}`}`;
|
||||
|
||||
const response = await got(currentUrl);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = (isNumber ? $('.panel-body').eq(id).find('.examName a') : $('.panel-body ul li a')).toArray().map((item) => {
|
||||
item = $(item);
|
||||
const link = item.attr('href');
|
||||
|
||||
return {
|
||||
title: item.text(),
|
||||
link: !link.startsWith('//') ? `${rootUrl}${link}/news/bulletin` : !link.startsWith('https') ? `https:${link}` : link,
|
||||
};
|
||||
});
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got(item.link);
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
content('h3').remove();
|
||||
content('.panel-body div').eq(0).remove();
|
||||
|
||||
item.description = content('.panel-body').html();
|
||||
item.pubDate = timezone(parseDate(detailResponse.data.match(/发布时间:(\d{4}-\d{2}-\d{2} \d{2}:\d{2})/)[1]), 8);
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${$('.panel-heading')
|
||||
.eq(isNumber ? id : 1)
|
||||
.text()} - 福建考试报名网`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/:category?': ['nczitzk'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'fjksbm.com': {
|
||||
_name: '福建考试报名网',
|
||||
'.': [
|
||||
{
|
||||
title: '分类',
|
||||
docs: 'https://docs.rsshub.app/study.html#fu-jian-kao-shi-bao-ming-wang',
|
||||
source: ['/portal/:category?', '/portal'],
|
||||
target: '/fjksbm/:category?',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/:category?', require('./'));
|
||||
};
|
||||
Loading…
Reference in New Issue