From ad88d2dc4ba36efab085bbffa0a9df4f632c41bb Mon Sep 17 00:00:00 2001 From: Fatpandac <30423976+Fatpandac@users.noreply.github.com> Date: Tue, 26 Jan 2021 05:00:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E4=B8=AD=E5=9B=BD=E5=BA=AD?= =?UTF-8?q?=E5=AE=A1=E5=85=AC=E5=BC=80=E7=BD=91=20(#6781)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/government.md | 6 ++++++ lib/router.js | 3 +++ lib/routes/tingshen/tingshen.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 lib/routes/tingshen/tingshen.js 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(), + }; +};