feat(route): add 安徽省科技厅 (#9387)

* feat(route): add 安徽省科技厅

* update lib/v2/gov/radar.js

* refactor: sort radar in alphabetical order
This commit is contained in:
Ethan Shen 2022-03-26 18:12:54 +08:00 committed by GitHub
parent 329a04d06d
commit be5dd42e09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 164 additions and 76 deletions

View File

@ -4,6 +4,22 @@ pageClass: routes
# 政务消息
## 安徽省科技厅
### 科技资讯 & 科技资源
<Route author="nczitzk" example="/gov/anhui/kjt/kjzx/tzgg" path="/gov/anhui/kjt/:path?" :paramsDesc="['路径,默认为通知公告']">
::: tip 提示
路径处填写对应页面 URL 中 `http://kjt.ah.gov.cn/``/index.html` 之间的字段。下面是一个例子。
若订阅 [通知公告](http://kjt.ah.gov.cn/kjzx/tzgg/index.html) 则将对应页面 URL <http://kjt.ah.gov.cn/kjzx/tzgg/index.html>`http://kjt.ah.gov.cn/``/index.html` 之间的字段 `kjzx/tzgg` 作为路径填入。此时路由为 [`/gov/anhui/kjt/kjzx/tzgg`](https://rsshub.app/gov/anhui/kjt/kjzx/tzgg)
:::
</Route>
## 澳门廉政公署
### 最新消息

56
lib/v2/gov/anhui/kjt.js Normal file
View File

@ -0,0 +1,56 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const params = ctx.params[0] ?? 'kjzx/tzgg';
const rootUrl = 'http://kjt.ah.gov.cn';
const currentUrl = `${rootUrl}/${params}/index.html`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
let items = $('.doc_list li')
.not('.columnName')
.find('a')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.text(),
link: item.attr('href'),
};
});
items = await Promise.all(
items.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.wzcon').html();
item.author = content('meta[name="Author"]').attr('content');
item.pubDate = timezone(parseDate(content('meta[name="PubDate"]').attr('content')), +8);
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};

View File

@ -1,4 +1,5 @@
module.exports = {
'/anhui/kjt/:path?': ['nczitzk'],
'/beijing/kw/:channel': ['Fatpandac'],
'/shenzhen/hrss/szksy/:caty/:page?': ['zlasd'],
'/shenzhen/zzb/:caty/:page?': ['zlasd'],

View File

@ -1,4 +1,21 @@
module.exports = {
'ah.gov.cn': {
_name: '安徽省科技厅',
kjt: [
{
title: '科技资讯',
docs: 'https://docs.rsshub.app/government.html#an-hui-sheng-ke-ji-ting-ke-ji-zi-xun',
source: ['/*'],
target: (params, url) => `/gov/anhui/kjt${new URL(url).href.match(/kjt\.ah\.gov\.cn(.*)\/index.html/)[1] ?? ''}`,
},
{
title: '科技资源',
docs: 'https://docs.rsshub.app/government.html#an-hui-sheng-ke-ji-ting-ke-ji-zi-yuan',
source: ['/*'],
target: (params, url) => `/gov/anhui/kjt${new URL(url).href.match(/kjt\.ah\.gov\.cn(.*)\/index.html/)[1] ?? ''}`,
},
],
},
'beijing.gov.cn': {
_name: '北京市人民政府',
kw: [
@ -272,61 +289,14 @@ module.exports = {
},
],
},
'hrss.sz.gov.cn': {
_name: '深圳考试院',
'deyang.gov.cn': {
_name: '德阳市人民政府',
'.': [
{
title: '公告',
docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-wei-zu-zhi-bu',
title: '德阳市政府公开信息',
docs: 'https://docs.rsshub.app/government.html#de-yang-shi-fu-ren-min-zheng-zheng-fu',
source: ['/*'],
target: '/gov/shenzhen/hrss/szksy/:caty/:page?',
},
],
},
'zzb.sz.gov.cn': {
_name: '深圳组工在线',
www: [
{
title: '公告',
docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-kao-shi-yuan',
source: ['/*'],
target: '/gov/shenzhen/zzb/:caty/:page?',
},
],
},
'sh.gov.cn': {
_name: '上海市人民政府',
wsjkw: [
{
title: '上海卫健委 疫情通报',
docs: 'https://docs.rsshub.app/other.html#xin-guan-fei-yan-yi-qing-xin-wen-dong-tai-yi-qing-tong-bao-shang-hai-wei-jian-wei',
source: ['/'],
target: '/gov/shanghai/wsjkw/yqtb',
},
],
rsj: [
{
title: '上海市职业能力考试院 考试项目',
docs: 'https://docs.rsshub.app/government.html#shang-hai-shi-zhi-ye-neng-li-kao-shi-yuan-kao-shi-xiang-mu',
source: ['/'],
target: '/gov/shanghai/rsj/ksxm',
},
],
},
'tqyb.com.cn': {
_name: '广州天气',
www: [
{
title: '突发性天气提示',
docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-tu-fa-xing-tian-qi-ti-shi',
source: ['/gz/weatherAlarm/suddenWeather/'],
target: '/gov/guangdong/tqyb/tfxtq',
},
{
title: '广东省内城市预警信号',
docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-guang-dong-sheng-nei-cheng-shi-yu-jing-xin-hao',
source: ['/gz/weatherAlarm/otherCity/'],
target: '/gov/guangdong/tqyb/sncsyjxh',
target: '/sichuan/deyang/govpulicinfo/:countyName/:institutionName?',
},
],
},
@ -365,14 +335,25 @@ module.exports = {
},
],
},
'deyang.gov.cn': {
_name: '德阳市人民政府',
'.': [
'mee.gov.cn': {
_name: '生态环境部',
www: [
{
title: '德阳市政府公开信息',
docs: 'https://docs.rsshub.app/government.html#de-yang-shi-fu-ren-min-zheng-zheng-fu',
source: ['/*'],
target: '/sichuan/deyang/govpulicinfo/:countyName/:institutionName?',
title: '要闻动态',
docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-sheng-tai-huan-jing-bu',
source: ['/ywdt/:category'],
target: '/gov/mee/ywdt/:category',
},
],
},
'mfa.gov.cn': {
_name: '中华人民共和国外交部',
www: [
{
title: '外交动态',
docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-wai-jiao-bu-wai-jiao-dong-tai',
source: ['/web/wjdt_674879/:category'],
target: (params) => `/gov/mfa/wjdt/${params.category.split('_')[0]}`,
},
],
},
@ -393,17 +374,6 @@ module.exports = {
},
],
},
'mee.gov.cn': {
_name: '生态环境部',
www: [
{
title: '要闻动态',
docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-sheng-tai-huan-jing-bu',
source: ['/ywdt/:category'],
target: '/gov/mee/ywdt/:category',
},
],
},
'pbc.gov.cn': {
_name: '中国人民银行',
'.': [
@ -433,14 +403,58 @@ module.exports = {
},
],
},
'mfa.gov.cn': {
_name: '中华人民共和国外交部',
'sh.gov.cn': {
_name: '上海市人民政府',
wsjkw: [
{
title: '上海卫健委 疫情通报',
docs: 'https://docs.rsshub.app/other.html#xin-guan-fei-yan-yi-qing-xin-wen-dong-tai-yi-qing-tong-bao-shang-hai-wei-jian-wei',
source: ['/'],
target: '/gov/shanghai/wsjkw/yqtb',
},
],
rsj: [
{
title: '上海市职业能力考试院 考试项目',
docs: 'https://docs.rsshub.app/government.html#shang-hai-shi-zhi-ye-neng-li-kao-shi-yuan-kao-shi-xiang-mu',
source: ['/'],
target: '/gov/shanghai/rsj/ksxm',
},
],
},
'sz.gov.cn': {
_name: '深圳政府在线移动门户',
hrss: [
{
title: '考试院公告',
docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-wei-zu-zhi-bu',
source: ['/*'],
target: '/gov/shenzhen/hrss/szksy/:caty/:page?',
},
],
zzb: [
{
title: '组工在线公告',
docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-kao-shi-yuan',
source: ['/*'],
target: '/gov/shenzhen/zzb/:caty/:page?',
},
],
},
'tqyb.com.cn': {
_name: '广州天气',
www: [
{
title: '外交动态',
docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-wai-jiao-bu-wai-jiao-dong-tai',
source: ['/web/wjdt_674879/:category'],
target: (params) => `/gov/mfa/wjdt/${params.category.split('_')[0]}`,
title: '突发性天气提示',
docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-tu-fa-xing-tian-qi-ti-shi',
source: ['/gz/weatherAlarm/suddenWeather/'],
target: '/gov/guangdong/tqyb/tfxtq',
},
{
title: '广东省内城市预警信号',
docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-guang-dong-sheng-nei-cheng-shi-yu-jing-xin-hao',
source: ['/gz/weatherAlarm/otherCity/'],
target: '/gov/guangdong/tqyb/sncsyjxh',
},
],
},

View File

@ -1,4 +1,5 @@
module.exports = function (router) {
router.get(/anhui\/kjt\/([\w\d/-]+)?/, require('./anhui/kjt'));
router.get('/beijing/kw/:channel', require('./beijing/kw/index'));
router.get('/shenzhen/hrss/szksy/:caty/:page?', require('./shenzhen/hrss/szksy/index'));
router.get('/shenzhen/zzb/:caty/:page?', require('./shenzhen/zzb/index'));