mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): 新增广州市人民政府 (#11339)
* feat[route]: 新增广州市人民政府 * fix(v2ex): enable allowEmpty and enrich pubDate * refactor: move `gzgov` dir under `gov` * refactor: replace `gzgov` by `gz` and change doc accordingly * refactor: polish code * refactor: polish code * fix: maintainer path
This commit is contained in:
@@ -180,6 +180,28 @@ pageClass: routes
|
||||
|
||||
<Route author="Fatpandac" example="/gov/huizhou/zwgk/jgdt" path="/gov/huizhou/zwgk/:category?" :paramsDesc="['资讯类别,可以从网址中得到,默认为政务要闻']"/>
|
||||
|
||||
## 广州市人民政府
|
||||
|
||||
### 新闻
|
||||
|
||||
<Route author="drgnchan" example="/gov/gz/xw/gzyw" path="/gov/gz/xw/:category" :paramsDesc="['新闻分类']">
|
||||
|
||||
| 广州要闻 | 今日头条 | 通知公告 |
|
||||
| ---- | ---- | ---- |
|
||||
| gzyw | jrtt | tzgg |
|
||||
|
||||
</Route>
|
||||
|
||||
### 政务公开
|
||||
|
||||
<Route author="drgnchan" example="/gov/gz/zwgk/zcjd" path="/gov/gz/zwgk/:category" :paramsDesc="['政务话你知']">
|
||||
|
||||
| 文字解读 |
|
||||
| ---- |
|
||||
| zcjd |
|
||||
|
||||
</Route>
|
||||
|
||||
## 国家广播电视总局
|
||||
|
||||
### 分类
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const postid = ctx.params.postid;
|
||||
@@ -29,8 +30,10 @@ module.exports = async (ctx) => {
|
||||
guid: post.attr('id'),
|
||||
link: `${pageUrl}#${post.attr('id')}`,
|
||||
author: post.find('.dark').first().text(),
|
||||
pubDate: parseDate(post.find('.ago').attr('title')),
|
||||
};
|
||||
})
|
||||
.reverse(),
|
||||
allowEmpty: true,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const rootUrl = 'https://www.gz.gov.cn';
|
||||
|
||||
const urlMap = {
|
||||
gzyw: 'gzyw',
|
||||
jrtt: 'jrtt',
|
||||
tzgg: 'tzgg',
|
||||
zcjd: 'zcjd/zcjd',
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const channel = ctx.params.channel;
|
||||
const category = ctx.params.category;
|
||||
const url = `${rootUrl}/${channel}/${urlMap[category]}/`;
|
||||
const response = await got(url);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('.news_list li')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const href = item.find('a').attr('href');
|
||||
return {
|
||||
title: item.find('a').attr('title'),
|
||||
link: href,
|
||||
pubDate: parseDate(item.find('span').text()),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `广州市人民政府 - ${$('.main_title').text()}`,
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -46,6 +46,8 @@ module.exports = {
|
||||
'/beijing/kw/:channel': ['Fatpandac'],
|
||||
'/guangdong/tqyb/tfxtq': ['Fatpandac'],
|
||||
'/guangdong/tqyb/sncsyjxh': ['Fatpandac'],
|
||||
'/gz/xw/:category': ['drgnchan'],
|
||||
'/gz/zwgk/:category': ['drgnchan'],
|
||||
'/hebei/czt/xwdt/:category?': ['nczitzk'],
|
||||
'/huizhou/zwgk/:category?': ['Fatpandac'],
|
||||
'/hunan/changsha/major-email': ['shansing'],
|
||||
|
||||
@@ -428,6 +428,17 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'gz.gov.cn': {
|
||||
_name: '广州市人民政府',
|
||||
www: [
|
||||
{
|
||||
title: '新闻',
|
||||
docs: 'https://docs.rsshub.app/government.html#guang-zhou-shi-ren-min-zheng-fu',
|
||||
source: ['/:channel/:category'],
|
||||
target: (params) => `/gov/gz/${params.channel}/${params.category}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
'hebei.gov.cn': {
|
||||
_name: '河北省人民政府',
|
||||
czt: [
|
||||
|
||||
@@ -38,6 +38,7 @@ module.exports = function (router) {
|
||||
router.get('/beijing/kw/:channel', require('./beijing/kw/index'));
|
||||
router.get('/guangdong/tqyb/tfxtq', require('./guangdong/tqyb/tfxtq'));
|
||||
router.get('/guangdong/tqyb/sncsyjxh', require('./guangdong/tqyb/sncsyjxh'));
|
||||
router.get('/gz/:channel/:category', require('./gz/index'));
|
||||
router.get('/hebei/czt/xwdt/:category?', require('./hebei/czt'));
|
||||
router.get('/huizhou/zwgk/:category?', require('./huizhou/zwgk/index'));
|
||||
router.get('/hunan/changsha/major-email', require('./hunan/changsha/major-email'));
|
||||
|
||||
Reference in New Issue
Block a user