diff --git a/docs/government.md b/docs/government.md index d7d61b319..9292fa0dc 100644 --- a/docs/government.md +++ b/docs/government.md @@ -217,6 +217,12 @@ pageClass: routes +## 中国庭审公开网 + +### 开庭信息 + + + ## 中国信息通信研究院 ### 白皮书 diff --git a/lib/router.js b/lib/router.js index d9ee29182..8d4bc6080 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3894,4 +3894,7 @@ router.get('/dxy/vaccine/:province?/:city?/:location?', require('./routes/dxy/va // Wtu router.get('/wtu/:type', require('./routes/universities/wtu')); +// 中国庭审公开网 +router.get('/tingshen', require('./routes/tingshen/tingshen')); + module.exports = router; diff --git a/lib/routes/tingshen/tingshen.js b/lib/routes/tingshen/tingshen.js new file mode 100644 index 000000000..c9a284781 --- /dev/null +++ b/lib/routes/tingshen/tingshen.js @@ -0,0 +1,28 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const url = require('url').resolve; + +const host = 'http://tingshen.court.gov.cn/preview'; + +module.exports = async (ctx) => { + const response = await got.get(host); + const $ = cheerio.load(response.data); + const list = $('ul[class="_preview_ul"]').find('li'); + ctx.state.data = { + title: '中国庭审公开', + link: host, + item: + list && + list + .map((index, item) => { + item = $(item); + return { + title: item.find('a[class="ellipsis22"]').text(), + description: '开庭法院:' + item.find('span[class="show-col show-court-name"]').find('a[target="_blank"]').text() + '\n时间:' + item.find('span[class="show-col show-time"]').text(), + pubDate: new Date(item.find('span[class="pull-right nes-date"]').text()).toUTCString(), + link: url(host, item.find('a[class="ellipsis22"]').attr('href')), + }; + }) + .get(), + }; +};