mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
@@ -1343,6 +1343,10 @@ area 分区选项
|
||||
|
||||
<Route author="hillerliao" example="/xuangubao/subject/41" path="/xuangubao/subject/:subject_id" :paramsDesc="['主题 id,网址 https://xuangubao.cn/subject/41 中最后的数字']"/>
|
||||
|
||||
## 妖火网
|
||||
|
||||
<Route author="nczitzk" example="/yaohuo/new" path="/yaohuo/:type?" :paramsDesc="['排序类型,可选 `new` 指最新,`hot` 指最热',默认为 `new`]"/>
|
||||
|
||||
## 异次元软件世界
|
||||
|
||||
### 首页
|
||||
|
||||
@@ -3191,6 +3191,9 @@ router.get('/chuhaibiji', require('./routes/chuhaibiji/index'));
|
||||
// 建宁闲谈
|
||||
router.get('/blogs/jianning', require('./routes/blogs/jianning'));
|
||||
|
||||
// 妖火网
|
||||
router.get('/yaohuo/:type?', require('./routes/yaohuo/index'));
|
||||
|
||||
// 互动吧
|
||||
router.get('/hudongba/:city/:id', require('./routes/hudongba/index'));
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
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,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user