From c64b62a85e0e861e9573aca0202863fd92158fbb Mon Sep 17 00:00:00 2001
From: Hank Chow <280630620@qq.com>
Date: Fri, 21 Apr 2023 22:50:35 +0800
Subject: [PATCH] =?UTF-8?q?feat(route):=20=E4=B8=AD=E5=9B=BD=E6=B3=95?=
=?UTF-8?q?=E5=AD=A6=E7=BD=91=20(#12363)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat: css/iolaw
* feat(route): add cssn
---
docs/en/study.md | 6 ++++++
docs/study.md | 6 ++++++
lib/v2/cssn/iolaw.js | 38 ++++++++++++++++++++++++++++++++++++++
lib/v2/cssn/maintainer.js | 3 +++
lib/v2/cssn/radar.js | 11 +++++++++++
lib/v2/cssn/router.js | 3 +++
6 files changed, 67 insertions(+)
create mode 100644 lib/v2/cssn/iolaw.js
create mode 100644 lib/v2/cssn/maintainer.js
create mode 100644 lib/v2/cssn/radar.js
create mode 100644 lib/v2/cssn/router.js
diff --git a/docs/en/study.md b/docs/en/study.md
index 65f2236bb..2683466cc 100644
--- a/docs/en/study.md
+++ b/docs/en/study.md
@@ -18,6 +18,12 @@ pageClass: routes
+## Chinese Social Science Net
+
+### Institute of Law
+
+
+
## gradCafe
### gradCafe result
diff --git a/docs/study.md b/docs/study.md
index 0694a2052..839961413 100644
--- a/docs/study.md
+++ b/docs/study.md
@@ -721,6 +721,12 @@ path="/ctfhub/upcoming/:limit?"
+## 中国社会科学网
+
+### 中国法学网
+
+
+
## 中国研究生招生信息网
### 考研热点新闻
diff --git a/lib/v2/cssn/iolaw.js b/lib/v2/cssn/iolaw.js
new file mode 100644
index 000000000..e013b4e92
--- /dev/null
+++ b/lib/v2/cssn/iolaw.js
@@ -0,0 +1,38 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+
+module.exports = async (ctx) => {
+ const section = ctx.params.section ?? 'zxzp';
+ const domain = 'iolaw.cssn.cn';
+ const response = await got(`http://${domain}/${section}/`);
+ const data = response.data;
+
+ const $ = cheerio.load(data);
+ const list = $('div.notice_right ul li')
+ .map((_, item) => {
+ item = $(item);
+ const url = `http://${domain}` + item.find('a').attr('href').substr(1);
+ const title = item.find('a div.title').text();
+ const publish_time = parseDate(item.find('a p').text());
+ return {
+ title,
+ link: url,
+ author: '中国法学网',
+ pubtime: publish_time,
+ };
+ })
+ .get();
+
+ ctx.state.data = {
+ title: '中国法学网',
+ url: `http://${domain}/${section}/`,
+ description: '中国法学网',
+ item: list.map((item) => ({
+ title: item.title,
+ pubDate: item.pubtime,
+ link: item.link,
+ author: item.author,
+ })),
+ };
+};
diff --git a/lib/v2/cssn/maintainer.js b/lib/v2/cssn/maintainer.js
new file mode 100644
index 000000000..56ab62b77
--- /dev/null
+++ b/lib/v2/cssn/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/iolaw/:section?': ['HankChow'],
+};
diff --git a/lib/v2/cssn/radar.js b/lib/v2/cssn/radar.js
new file mode 100644
index 000000000..8dcf140ce
--- /dev/null
+++ b/lib/v2/cssn/radar.js
@@ -0,0 +1,11 @@
+module.exports = {
+ 'cssn.cn': {
+ _name: '中国社会科学网',
+ iolaw: [
+ {
+ title: '中国法学网',
+ docs: 'https://docs.rsshub.app/study.html#zhong-guo-she-hui-ke-xue-wang',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/cssn/router.js b/lib/v2/cssn/router.js
new file mode 100644
index 000000000..6748ded48
--- /dev/null
+++ b/lib/v2/cssn/router.js
@@ -0,0 +1,3 @@
+module.exports = function (router) {
+ router.get('/iolaw/:section?', require('./iolaw'));
+};