Skip to content

Commit

Permalink
feat(route): add wanqu (#12166)
Browse files Browse the repository at this point in the history
* feat(route): add wanqu

* Update docs/new-media.md

* Update lib/v2/wanqu/maintainer.js
---------
  • Loading branch information
Fatpandac authored Mar 24, 2023
1 parent a2814f4 commit dd82c1d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/new-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

### 报道
Expand Down
3 changes: 3 additions & 0 deletions lib/v2/wanqu/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/news': ['Fatpandac'],
};
26 changes: 26 additions & 0 deletions lib/v2/wanqu/news.js
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions lib/v2/wanqu/radar.js
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions lib/v2/wanqu/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/news', require('./news'));
};

0 comments on commit dd82c1d

Please sign in to comment.