From 0a909ecd93a29af700cc760e3bb2913fa95342d9 Mon Sep 17 00:00:00 2001
From: ruoshui9527 <104556597+ruoshui9527@users.noreply.github.com>
Date: Fri, 2 Feb 2024 23:47:52 +0800
Subject: [PATCH] =?UTF-8?q?feat(route):=20add=20=E6=88=91=E4=B8=8D?=
=?UTF-8?q?=E6=98=AF=E7=9B=90=E7=A5=9E=20(#14348)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Create common.js
* Create maintainer.js
* Create router.js
* Create radar.js
* Update common.js
A space is add after ','.
* Update common.js
A space is add after ','.
* Update common.js
* Update radar.js
* Update new-media.mdx
* Update maintainer.js
* Update radar.js
* Update radar.js
* Update radar.js
---
lib/v2/onehu/common.js | 27 +++++++++++++++++++++++++++
lib/v2/onehu/maintainer.js | 3 +++
lib/v2/onehu/radar.js | 11 +++++++++++
lib/v2/onehu/router.js | 3 +++
website/docs/routes/new-media.mdx | 6 ++++++
5 files changed, 50 insertions(+)
create mode 100644 lib/v2/onehu/common.js
create mode 100644 lib/v2/onehu/maintainer.js
create mode 100644 lib/v2/onehu/radar.js
create mode 100644 lib/v2/onehu/router.js
diff --git a/lib/v2/onehu/common.js b/lib/v2/onehu/common.js
new file mode 100644
index 00000000000000..21cdb270985e09
--- /dev/null
+++ b/lib/v2/onehu/common.js
@@ -0,0 +1,27 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const timezone = require('@/utils/timezone');
+const { parseDate } = require('@/utils/parse-date');
+
+module.exports = async (ctx) => {
+ const link = 'https://onehu.xyz';
+ const response = await got(link);
+ const data = response.data;
+ const $ = cheerio.load(data);
+ const list = $('#board article').toArray().map((item) => {
+ item = $(item);
+ return {
+ title: item.find('.index-header').text(),
+ link: item.find('.index-header').children('a').attr('href'),
+ description: item.find('.index-excerpt.index-excerpt__noimg').children('div').text(),
+ pubDate: timezone(parseDate(item.find('.post-meta.mr-3').children('time').attr('datetime'), 'YYYY年MM月DD日 HH:mm'), +8),
+ };
+ });
+
+ ctx.state.data = {
+ title: $('title').text(),
+ link,
+ item: list,
+ };
+
+};
diff --git a/lib/v2/onehu/maintainer.js b/lib/v2/onehu/maintainer.js
new file mode 100644
index 00000000000000..a407b2bade6c27
--- /dev/null
+++ b/lib/v2/onehu/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/': ['ruoshui9527'],
+};
diff --git a/lib/v2/onehu/radar.js b/lib/v2/onehu/radar.js
new file mode 100644
index 00000000000000..e58232343583bb
--- /dev/null
+++ b/lib/v2/onehu/radar.js
@@ -0,0 +1,11 @@
+module.exports = {
+ 'onehu.xyz': {
+ _name: '我不是盐神',
+ '.': [
+ {
+ title: '我不是盐神',
+ docs: 'https://docs.rsshub.app/routes/new-media#wo-bu-shi-yan-shen',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/onehu/router.js b/lib/v2/onehu/router.js
new file mode 100644
index 00000000000000..ebf2d27f70e0e0
--- /dev/null
+++ b/lib/v2/onehu/router.js
@@ -0,0 +1,3 @@
+module.exports = function (router) {
+ router.get('/', require('./common'));
+};
diff --git a/website/docs/routes/new-media.mdx b/website/docs/routes/new-media.mdx
index a4ee1d12781a04..b0a09c6a589dc5 100644
--- a/website/docs/routes/new-media.mdx
+++ b/website/docs/routes/new-media.mdx
@@ -5288,3 +5288,9 @@
### 公众号 {#zi-you-wei-xin-gong-zhong-hao}
+
+## 我不是盐神 {#wo-bu-shi-yan-shen}
+
+### 首页 {#wo-bu-shi-yan-shen-shou-ye}
+
+