feat: add cia annual foia reports (#6365)
This commit is contained in:
parent
a458b0669e
commit
e60baf68ee
|
|
@ -26,4 +26,10 @@ pageClass: routes
|
|||
|
||||
### Dispute settlement news
|
||||
|
||||
<RouteEn author="nczitzk" example="/wto/dispute-settlement" path="/wto/dispute-settlement/:year?" :paramsDesc="['Year, current year by default']"/>
|
||||
<RouteEn author="nczitzk" example="/wto/dispute-settlement" path="/wto/dispute-settlement/:year?" :paramsDesc="['Year, current year by default']"/>
|
||||
|
||||
## Central Intelligence Agency
|
||||
|
||||
### Annual FOIA Reports
|
||||
|
||||
<RouteEn author="nczitzk" example="/cia/foia-annual-report" path="/cia/foia-annual-report"/>
|
||||
|
|
@ -83,6 +83,12 @@ pageClass: routes
|
|||
|
||||
<Route author="nczitzk" example="/us/supremecourt/argument_audio" path="/us/supremecourt/argument_audio/:year?" :paramsDesc="['年份,默认为当前年份']"/>
|
||||
|
||||
## 美国中央情报局
|
||||
|
||||
### 年度信息自由法报告
|
||||
|
||||
<Route author="nczitzk" example="/cia/foia-annual-report" path="/cia/foia-annual-report"/>
|
||||
|
||||
## 泉州市跨境电子商务协会
|
||||
|
||||
### 新闻动态
|
||||
|
|
|
|||
|
|
@ -3519,6 +3519,9 @@ router.get('/uisdc/news', require('./routes/uisdc/news'));
|
|||
router.get('/uisdc/zt/:title?', require('./routes/uisdc/zt'));
|
||||
router.get('/uisdc/topic/:title?/:sort?', require('./routes/uisdc/topic'));
|
||||
|
||||
// 美国中央情报局
|
||||
router.get('/cia/foia-annual-report', require('./routes/us/cia/foia-annual-report'));
|
||||
|
||||
// Everything
|
||||
router.get('/everything/changes', require('./routes/everything/changes'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.cia.gov';
|
||||
const currentUrl = `${rootUrl}/library/readingroom/foia-annual-report`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('.smaller-table tr')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('td').eq(1).text(),
|
||||
link: `${rootUrl}/${item.find('td a').eq(0).attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'CIA Annual FOIA Reports',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue