diff --git a/docs/en/government.md b/docs/en/government.md index 832b21522..5754eacd4 100644 --- a/docs/en/government.md +++ b/docs/en/government.md @@ -26,4 +26,10 @@ pageClass: routes ### Dispute settlement news - \ No newline at end of file + + +## Central Intelligence Agency + +### Annual FOIA Reports + + \ No newline at end of file diff --git a/docs/government.md b/docs/government.md index 6c1ee9600..48a7ede88 100644 --- a/docs/government.md +++ b/docs/government.md @@ -83,6 +83,12 @@ pageClass: routes +## 美国中央情报局 + +### 年度信息自由法报告 + + + ## 泉州市跨境电子商务协会 ### 新闻动态 diff --git a/lib/router.js b/lib/router.js index b58e89adb..3dd14a82d 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/us/cia/foia-annual-report.js b/lib/routes/us/cia/foia-annual-report.js new file mode 100644 index 000000000..b9210a4e7 --- /dev/null +++ b/lib/routes/us/cia/foia-annual-report.js @@ -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, + }; +};