From be4127cfb458fda4869c381c30f2c62ce524dd1a Mon Sep 17 00:00:00 2001
From: Zhiwei Li <65117011+Levix@users.noreply.github.com>
Date: Thu, 7 Sep 2023 11:05:43 +0800
Subject: [PATCH] =?UTF-8?q?feat(route):=20add=20=E5=9C=9F=E7=8C=9B?=
=?UTF-8?q?=E7=9A=84=E5=91=98=E5=A4=96=20blog=20(#13215)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat(route): add 土猛的员外 blog
* fix: review problem
---
lib/v2/luxiangdong/archive.js | 28 ++++++++++++++++++++++++++++
lib/v2/luxiangdong/maintainer.js | 3 +++
lib/v2/luxiangdong/radar.js | 13 +++++++++++++
lib/v2/luxiangdong/router.js | 3 +++
website/docs/routes/blog.md | 5 +++++
5 files changed, 52 insertions(+)
create mode 100644 lib/v2/luxiangdong/archive.js
create mode 100644 lib/v2/luxiangdong/maintainer.js
create mode 100644 lib/v2/luxiangdong/radar.js
create mode 100644 lib/v2/luxiangdong/router.js
diff --git a/lib/v2/luxiangdong/archive.js b/lib/v2/luxiangdong/archive.js
new file mode 100644
index 000000000..b0996d711
--- /dev/null
+++ b/lib/v2/luxiangdong/archive.js
@@ -0,0 +1,28 @@
+const got = require('@/utils/got');
+const { parseDate } = require('@/utils/parse-date');
+
+module.exports = async (ctx) => {
+ const { data } = await got(`https://www.luxiangdong.com/content.json?t=${Date.now()}`);
+
+ const items = data.posts.map((item) => ({
+ // 文章标题
+ title: item.title,
+ // 文章链接
+ link: item.permalink,
+ // 文章发布日期
+ pubDate: parseDate(item.date),
+ // 如果有的话,文章作者
+ author: data.meta.author,
+ // 如果有的话,文章分类
+ category: item.tags.map((tag) => tag.name),
+ }));
+
+ ctx.state.data = {
+ // 源标题
+ title: '土猛的员外',
+ // 源链接
+ link: 'https://www.luxiangdong.com/',
+ // 源文章
+ item: items,
+ };
+};
diff --git a/lib/v2/luxiangdong/maintainer.js b/lib/v2/luxiangdong/maintainer.js
new file mode 100644
index 000000000..657004133
--- /dev/null
+++ b/lib/v2/luxiangdong/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/archive': ['Levix'],
+};
diff --git a/lib/v2/luxiangdong/radar.js b/lib/v2/luxiangdong/radar.js
new file mode 100644
index 000000000..9c801a1bb
--- /dev/null
+++ b/lib/v2/luxiangdong/radar.js
@@ -0,0 +1,13 @@
+module.exports = {
+ 'luxiangdong.com': {
+ _name: '土猛的员外',
+ '.': [
+ {
+ title: '文章',
+ docs: 'https://docs.rsshub.app/routes/blog#luxiangdong',
+ source: ['/'],
+ target: '/luxiangdong/archive',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/luxiangdong/router.js b/lib/v2/luxiangdong/router.js
new file mode 100644
index 000000000..2d85240e7
--- /dev/null
+++ b/lib/v2/luxiangdong/router.js
@@ -0,0 +1,3 @@
+module.exports = (router) => {
+ router.get('/archive', require('./archive'));
+};
diff --git a/website/docs/routes/blog.md b/website/docs/routes/blog.md
index 737ffa525..1d3502238 100644
--- a/website/docs/routes/blog.md
+++ b/website/docs/routes/blog.md
@@ -533,3 +533,8 @@ Limit the number of entries to be retrieved by adding `?limit=x` to the end of t
+## 土猛的员外 {#luxiangdong}
+
+### 文章 {#luxiangdong-wen-zhang}
+
+
\ No newline at end of file