feat(route): 添加 “The Ring of Wonder 首页更新”的route以及文档 (#8237)
* Add route: The Ring of Wonder * Fix timezone * Remove templates (not in use)
This commit is contained in:
parent
2f8705b88d
commit
8a96fcb83c
|
|
@ -778,4 +778,10 @@ pageClass: routes
|
|||
| ------------- | ------------ | ------------ |
|
||||
| lingyishijain | lingyitupian | minjianqitan |
|
||||
|
||||
## The Ring of Wonder
|
||||
|
||||
### 首页更新
|
||||
|
||||
<Route author="shiningdracon" example="/trow/portal" path="/trow/portal" />
|
||||
|
||||
</Route>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/portal': ['shiningdracon'],
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://trow.cc`,
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('#portal_content .borderwrap[style="display:show"]');
|
||||
|
||||
ctx.state.data = {
|
||||
title: `The Ring of Wonder - Portal`,
|
||||
link: `https://trow.cc`,
|
||||
description: `The Ring of Wonder 首页更新`,
|
||||
item: list && list.map((index, item) => {
|
||||
item = $(item);
|
||||
const dateraw = item.find('.postdetails').text();
|
||||
return {
|
||||
title: item.find('.maintitle p:nth-child(2) > a').text(),
|
||||
description: item.find('.portal_news_content .row18').html(),
|
||||
link: item.find('.maintitle p:nth-child(2) > a').attr('href'),
|
||||
author: item.find('.postdetails a').text(),
|
||||
pubDate: timezone(parseDate(dateraw.slice(3), 'YYYY-MM-DD, HH:mm'), +8),
|
||||
};
|
||||
}).get(),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'trow.cc': {
|
||||
_name: 'The Ring of Wonder',
|
||||
'.': [
|
||||
{
|
||||
title: '首页更新',
|
||||
docs: 'https://docs.rsshub.app/bbs.html#the-ring-of-wonder',
|
||||
source: ['/'],
|
||||
target: '/portal',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/portal', require('./portal'));
|
||||
};
|
||||
Loading…
Reference in New Issue