mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix(route): AGE 动漫路由修復 (#10401)
* update agefans domain * refactor: migrate to v2
This commit is contained in:
+2
-2
@@ -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'));
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'/detail/:id': ['s2marine'],
|
||||
'/update': ['nczitzk'],
|
||||
};
|
||||
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/detail/:id', require('./detail'));
|
||||
router.get('/update', require('./update'));
|
||||
};
|
||||
@@ -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();
|
||||
Reference in New Issue
Block a user