diff --git a/lib/router.js b/lib/router.js index 9548129686..b176c93396 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2638,8 +2638,8 @@ router.get('/hnust/graduate/:type?', lazyloadRouteHandler('./routes/universities router.get('/swjtu/tl/news', lazyloadRouteHandler('./routes/swjtu/tl/news')); // AGE动漫 -router.get('/agefans/detail/:id', lazyloadRouteHandler('./routes/agefans/detail')); -router.get('/agefans/update', lazyloadRouteHandler('./routes/agefans/update')); +// router.get('/agefans/detail/:id', lazyloadRouteHandler('./routes/agefans/detail')); +// router.get('/agefans/update', lazyloadRouteHandler('./routes/agefans/update')); // Checkra1n router.get('/checkra1n/releases', lazyloadRouteHandler('./routes/checkra1n/releases')); diff --git a/lib/routes/agefans/detail.js b/lib/v2/agefans/detail.js similarity index 71% rename from lib/routes/agefans/detail.js rename to lib/v2/agefans/detail.js index c5ea62e85a..d7ef311fa1 100644 --- a/lib/routes/agefans/detail.js +++ b/lib/v2/agefans/detail.js @@ -2,10 +2,7 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); module.exports = async (ctx) => { - const response = await got({ - method: 'get', - url: `https://www.agefans.cc/detail/${ctx.params.id}`, - }); + const response = await got(`https://www.agemys.cc/detail/${ctx.params.id}`); const $ = cheerio.load(response.data); const defaultIdx = parseInt($('#DEF_PLAYINDEX').get(0).children[0].data); @@ -15,14 +12,14 @@ module.exports = async (ctx) => { .map((idx, item) => ({ title: $(item).text(), description: $(item).text(), - link: `https://www.agefans.cc${$(item).attr('href')}`, + link: `https://www.agemys.cc${$(item).attr('href')}`, })) .get(); items.reverse(); ctx.state.data = { title: `AGE动漫 - ${$('.detail_imform_name').text()}`, - link: `https://www.agefans.cc/detail/${ctx.params.id}`, + link: `https://www.agemys.cc/detail/${ctx.params.id}`, description: $('.detail_imform_desc_pre').text(), item: items, }; diff --git a/lib/v2/agefans/maintainer.js b/lib/v2/agefans/maintainer.js new file mode 100644 index 0000000000..bbb8327241 --- /dev/null +++ b/lib/v2/agefans/maintainer.js @@ -0,0 +1,4 @@ +module.exports = { + '/detail/:id': ['s2marine'], + '/update': ['nczitzk'], +}; diff --git a/lib/v2/agefans/radar.js b/lib/v2/agefans/radar.js new file mode 100644 index 0000000000..33feb13786 --- /dev/null +++ b/lib/v2/agefans/radar.js @@ -0,0 +1,19 @@ +module.exports = { + 'agemys.cc': { + _name: 'AGE动漫', + '.': [ + { + title: '最近更新', + docs: 'https://docs.rsshub.app/anime.html#age-dong-man', + source: ['/update', '/'], + target: '/agefans/update', + }, + { + title: '番剧详情', + docs: 'https://docs.rsshub.app/anime.html#age-dong-man', + source: ['/detail/:id'], + target: '/agefans/detail/:id', + }, + ], + }, +}; diff --git a/lib/v2/agefans/router.js b/lib/v2/agefans/router.js new file mode 100644 index 0000000000..f5e960f0cb --- /dev/null +++ b/lib/v2/agefans/router.js @@ -0,0 +1,4 @@ +module.exports = (router) => { + router.get('/detail/:id', require('./detail')); + router.get('/update', require('./update')); +}; diff --git a/lib/routes/agefans/update.js b/lib/v2/agefans/update.js similarity index 74% rename from lib/routes/agefans/update.js rename to lib/v2/agefans/update.js index c708073b27..a30ce6c3fb 100644 --- a/lib/routes/agefans/update.js +++ b/lib/v2/agefans/update.js @@ -2,22 +2,19 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); module.exports = async (ctx) => { - const rootUrl = 'https://www.agemys.com'; + const rootUrl = 'https://www.agemys.cc'; const currentUrl = `${rootUrl}/update`; - const response = await got({ - method: 'get', - url: currentUrl, - }); + const response = await got(currentUrl); const $ = cheerio.load(response.data); const list = $('.anime_icon2_name a') - .slice(0, 15) .map((_, item) => { item = $(item); return { title: item.text(), link: `${rootUrl}${item.attr('href')}`, + guid: `${rootUrl}${item.attr('href')}#${item.parent().prev().find('.anime_icon1_name1').text()}`, }; }) .get(); @@ -25,10 +22,7 @@ module.exports = async (ctx) => { const items = await Promise.all( list.map((item) => ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, - }); + const detailResponse = await got(item.link); const content = cheerio.load(detailResponse.data); item.description = content('.div_left').html();