mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
* fix(route): 国家税务总局 - 最新文件 (#11960) * refactor(route): use WHATWG URL API for chinatax
This commit is contained in:
+2
-2
@@ -2875,8 +2875,8 @@ router.get('/dcinside/board/:id', lazyloadRouteHandler('./routes/dcinside/board'
|
||||
// 企鹅电竞
|
||||
router.get('/egameqq/room/:id', lazyloadRouteHandler('./routes/tencent/egame/room'));
|
||||
|
||||
// 国家税务总局
|
||||
router.get('/gov/chinatax/latest', lazyloadRouteHandler('./routes/gov/chinatax/latest'));
|
||||
// 国家税务总局 migrated to v2
|
||||
// router.get('/gov/chinatax/latest', lazyloadRouteHandler('./routes/gov/chinatax/latest'));
|
||||
|
||||
// 荔枝FM
|
||||
router.get('/lizhi/user/:id', lazyloadRouteHandler('./routes/lizhi/user'));
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
@@ -17,19 +16,26 @@ module.exports = async (ctx) => {
|
||||
const a = item.find('a');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: url.resolve(`http://www.chinatax.gov.cn`, a.attr('href')),
|
||||
link: new URL(a.attr('href'), `http://www.chinatax.gov.cn`).toString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const res = await got({ method: 'get', url: item.link });
|
||||
const content = cheerio.load(res.data);
|
||||
item.pubDate = content('meta[name="PubDate"]').attr('content');
|
||||
item.description = content('#fontzoom').html();
|
||||
return item;
|
||||
try {
|
||||
const res = await got({ method: 'get', url: item.link });
|
||||
const content = cheerio.load(res.data);
|
||||
item.pubDate = content('meta[name="PubDate"]').attr('content');
|
||||
item.description = content('#fontzoom').html();
|
||||
return item;
|
||||
} catch (err) {
|
||||
if (err.name === 'HTTPError') {
|
||||
item.description = err.message;
|
||||
return item;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
})
|
||||
)
|
||||
);
|
||||
@@ -2,6 +2,7 @@ module.exports = {
|
||||
// ministry
|
||||
'/cac/:path+': ['drgnchan'],
|
||||
'/ccdi/:path+': ['bigfei'],
|
||||
'/chinatax/latest': ['nczitzk', 'fuzy112'],
|
||||
'/cmse/xwzx/zhxw': ['nczitzk'],
|
||||
'/cmse/xwzx/yzjz': ['nczitzk'],
|
||||
'/cmse/gfgg': ['nczitzk'],
|
||||
|
||||
@@ -341,6 +341,17 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'chinatax.gov.cn': {
|
||||
_name: '国家税务总局',
|
||||
www: [
|
||||
{
|
||||
title: '国家税务总局 - 最新文件',
|
||||
docs: 'https://docs.rsshub.app/government.html#guo-jia-shui-wu-zong-ju',
|
||||
source: ['/*'],
|
||||
target: '/gov/chinatax/latest',
|
||||
},
|
||||
],
|
||||
},
|
||||
'cmse.gov.cn': {
|
||||
_name: '中国载人航天',
|
||||
www: [
|
||||
|
||||
@@ -2,6 +2,7 @@ module.exports = function (router) {
|
||||
// ministry
|
||||
router.get(/cac(\/[\w/-]+)?/, require('./cac/index'));
|
||||
router.get(/ccdi(\/[\w/-]+)?/, require('./ccdi'));
|
||||
router.get('/chinatax/latest', require('./chinatax/latest'));
|
||||
router.get('/cmse/fxrw', require('./cmse/fxrw'));
|
||||
router.get(/cmse(\/[\w/-]+)?/, require('./cmse'));
|
||||
router.get(/cnnic(\/[\w/-]+)?/, require('./cnnic'));
|
||||
|
||||
Reference in New Issue
Block a user