mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
feat: add 国家税务总局税收政策最新文件 (#4902)
This commit is contained in:
@@ -28,6 +28,12 @@ pageClass: routes
|
|||||||
|
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
## 国家税务总局
|
||||||
|
|
||||||
|
### 最新文件
|
||||||
|
|
||||||
|
<Route author="nczitzk" example="/gov/chinatax/latest" path="/gov/chinatax/latest"/>
|
||||||
|
|
||||||
## 国家新闻出版广电总局
|
## 国家新闻出版广电总局
|
||||||
|
|
||||||
### 游戏审批结果
|
### 游戏审批结果
|
||||||
|
|||||||
@@ -2812,4 +2812,7 @@ router.get('/gov/caict/bps', require('./routes/gov/caict/bps'));
|
|||||||
router.get('/gov/caict/qwsj', require('./routes/gov/caict/qwsj'));
|
router.get('/gov/caict/qwsj', require('./routes/gov/caict/qwsj'));
|
||||||
router.get('/gov/caict/caictgd', require('./routes/gov/caict/caictgd'));
|
router.get('/gov/caict/caictgd', require('./routes/gov/caict/caictgd'));
|
||||||
|
|
||||||
|
// 国家税务总局
|
||||||
|
router.get('/gov/chinatax/latest', require('./routes/gov/chinatax/latest'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
43
lib/routes/gov/chinatax/latest.js
Normal file
43
lib/routes/gov/chinatax/latest.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const url = require('url');
|
||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const link = `http://www.chinatax.gov.cn/chinatax/n810341/n810755/index.html`;
|
||||||
|
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: link,
|
||||||
|
});
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
const list = $('ul.list.whlist li')
|
||||||
|
.slice(0, 10)
|
||||||
|
.map((_, item) => {
|
||||||
|
item = $(item);
|
||||||
|
const a = item.find('a');
|
||||||
|
return {
|
||||||
|
title: a.text(),
|
||||||
|
link: url.resolve(`http://www.chinatax.gov.cn`, a.attr('href')),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get();
|
||||||
|
|
||||||
|
const items = await Promise.all(
|
||||||
|
list.map(
|
||||||
|
async (item) =>
|
||||||
|
await 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;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '国家税务总局 - 最新文件',
|
||||||
|
link: link,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user