feat(route): add wanqu (#12166)

* feat(route): add wanqu

* Update docs/new-media.md

* Update lib/v2/wanqu/maintainer.js
---------
This commit is contained in:
Fatpandac 2023-03-24 18:33:57 +08:00 committed by GitHub
parent a2814f47ca
commit dd82c1da0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 0 deletions

View File

@ -3812,6 +3812,12 @@ column 为 third 时可选的 category:
<Route author="shuiRong" example="/wainao-reads/all-articles" path="/wainao-reads/all-articles" />
## 湾区日报
### 最新推荐
<Route author="Fatpandac" example="/wanqu/news" path="/wanqu/news" radar="1" />
## 晚点 LatePost
### 报道

View File

@ -0,0 +1,3 @@
module.exports = {
'/news': ['Fatpandac'],
};

26
lib/v2/wanqu/news.js Normal file
View File

@ -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,
};
};

13
lib/v2/wanqu/radar.js Normal file
View File

@ -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',
},
],
},
};

3
lib/v2/wanqu/router.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/news', require('./news'));
};