From dd82c1da0e1bce5d0e5b6213136c447d5b71450a Mon Sep 17 00:00:00 2001
From: Fatpandac <1779196284@qq.com>
Date: Fri, 24 Mar 2023 18:33:57 +0800
Subject: [PATCH] feat(route): add wanqu (#12166)
* feat(route): add wanqu
* Update docs/new-media.md
* Update lib/v2/wanqu/maintainer.js
---------
---
docs/new-media.md | 6 ++++++
lib/v2/wanqu/maintainer.js | 3 +++
lib/v2/wanqu/news.js | 26 ++++++++++++++++++++++++++
lib/v2/wanqu/radar.js | 13 +++++++++++++
lib/v2/wanqu/router.js | 3 +++
5 files changed, 51 insertions(+)
create mode 100644 lib/v2/wanqu/maintainer.js
create mode 100644 lib/v2/wanqu/news.js
create mode 100644 lib/v2/wanqu/radar.js
create mode 100644 lib/v2/wanqu/router.js
diff --git a/docs/new-media.md b/docs/new-media.md
index a69340644..59eae60a6 100644
--- a/docs/new-media.md
+++ b/docs/new-media.md
@@ -3812,6 +3812,12 @@ column 为 third 时可选的 category:
+## 湾区日报
+
+### 最新推荐
+
+
+
## 晚点 LatePost
### 报道
diff --git a/lib/v2/wanqu/maintainer.js b/lib/v2/wanqu/maintainer.js
new file mode 100644
index 000000000..89c40d4d5
--- /dev/null
+++ b/lib/v2/wanqu/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/news': ['Fatpandac'],
+};
diff --git a/lib/v2/wanqu/news.js b/lib/v2/wanqu/news.js
new file mode 100644
index 000000000..5052b39c5
--- /dev/null
+++ b/lib/v2/wanqu/news.js
@@ -0,0 +1,26 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+
+module.exports = async (ctx) => {
+ const rootUrl = 'https://www.wanqu.co';
+ const currentUrl = rootUrl;
+
+ const response = await got(currentUrl);
+
+ const $ = cheerio.load(response.data);
+
+ const items = $('div.mb-4')
+ .toArray()
+ .map((item) => ({
+ title: $(item).text(),
+ link: $(item).find('a').attr('href'),
+ pubDate: parseDate($(item).find('i.text-helper-color.mr-4').text()),
+ }));
+
+ ctx.state.data = {
+ title: '湾区日报 - 最新推荐',
+ link: currentUrl,
+ item: items,
+ };
+};
diff --git a/lib/v2/wanqu/radar.js b/lib/v2/wanqu/radar.js
new file mode 100644
index 000000000..86e507db6
--- /dev/null
+++ b/lib/v2/wanqu/radar.js
@@ -0,0 +1,13 @@
+module.exports = {
+ 'wanqu.co': {
+ _name: '湾区日报',
+ '.': [
+ {
+ title: '最新推荐',
+ docs: 'https://docs.rsshub.app/new-media.html#wan-qu-ri-bao',
+ source: ['/'],
+ target: '/wanqu/news',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/wanqu/router.js b/lib/v2/wanqu/router.js
new file mode 100644
index 000000000..69a5972f6
--- /dev/null
+++ b/lib/v2/wanqu/router.js
@@ -0,0 +1,3 @@
+module.exports = function (router) {
+ router.get('/news', require('./news'));
+};