fix(route): 妖火 (#8503)
This commit is contained in:
+1
-1
@@ -3360,7 +3360,7 @@ router.get('/chuhaibiji', lazyloadRouteHandler('./routes/chuhaibiji/index'));
|
||||
router.get('/blogs/jianning', lazyloadRouteHandler('./routes/blogs/jianning'));
|
||||
|
||||
// 妖火网
|
||||
router.get('/yaohuo/:type?', lazyloadRouteHandler('./routes/yaohuo/index'));
|
||||
// router.get('/yaohuo/:type?', lazyloadRouteHandler('./routes/yaohuo/index'));
|
||||
|
||||
// 互动吧
|
||||
router.get('/hudongba/:city/:id', lazyloadRouteHandler('./routes/hudongba/index'));
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
ctx.params.type = ctx.params.type || 'new';
|
||||
|
||||
const rootUrl = `https://yaohuo.me`;
|
||||
const currentUrl = `${rootUrl}/bbs/book_list.aspx?action=${ctx.params.type}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('div.line1, div.line2')
|
||||
.slice(0, 15)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a').eq(0);
|
||||
return {
|
||||
title: a.text(),
|
||||
link: `${rootUrl}${a.attr('href')}`,
|
||||
author: item.text().split('/')[0].split(a.text())[1],
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://yaohuo.me';
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: rootUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('.list a')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
return {
|
||||
title: item.text(),
|
||||
link: `${rootUrl}${item.attr('href')}`,
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/': ['nczitzk'],
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'yaohuo.me': {
|
||||
_name: '妖火',
|
||||
'.': [
|
||||
{
|
||||
title: '首页',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#yao-huo-shou-ye',
|
||||
source: ['/'],
|
||||
target: '/yaohuo',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/', require('./index'));
|
||||
};
|
||||
Reference in New Issue
Block a user