diff --git a/lib/router.js b/lib/router.js index 3d7396168..49e956f22 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/yaohuo/index.js b/lib/routes/yaohuo/index.js deleted file mode 100644 index 6b3ad444a..000000000 --- a/lib/routes/yaohuo/index.js +++ /dev/null @@ -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, - }; -}; diff --git a/lib/v2/yaohuo/index.js b/lib/v2/yaohuo/index.js new file mode 100644 index 000000000..dca289127 --- /dev/null +++ b/lib/v2/yaohuo/index.js @@ -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, + }; +}; diff --git a/lib/v2/yaohuo/maintainer.js b/lib/v2/yaohuo/maintainer.js new file mode 100644 index 000000000..ca7cf1eb1 --- /dev/null +++ b/lib/v2/yaohuo/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/': ['nczitzk'], +}; diff --git a/lib/v2/yaohuo/radar.js b/lib/v2/yaohuo/radar.js new file mode 100644 index 000000000..0c52519bf --- /dev/null +++ b/lib/v2/yaohuo/radar.js @@ -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', + }, + ], + }, +}; diff --git a/lib/v2/yaohuo/router.js b/lib/v2/yaohuo/router.js new file mode 100644 index 000000000..20c52b09d --- /dev/null +++ b/lib/v2/yaohuo/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/', require('./index')); +};