feat(route): add gogoanimehd (#13340)
* add gogoanime * updated data being sent * update radar.js * update for loop to a map * update docs path change from multimedia to anime * add docs for gogoanimehd * change the title to a string, move the episode to the description * Update lib/v2/gogoanimehd/radar.js rename title value in radar.js ---------
This commit is contained in:
parent
c68cbe5ca4
commit
821d2cafdf
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/recent-releases': ['user4302'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'gogoanimehd.io': {
|
||||
_name: 'Gogoanime',
|
||||
developer: [
|
||||
{
|
||||
title: 'Recent Releases',
|
||||
docs: 'https://docs.rsshub.app/routes/anime#gogoanimehd',
|
||||
source: ['/'],
|
||||
target: '/gogoanimehd/recent-releases',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://gogoanimehd.io';
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: rootUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const recentReleases = $('.last_episodes');
|
||||
const listItems = $(recentReleases).find('li');
|
||||
|
||||
const arrayOfItems = listItems.toArray().map((item) => {
|
||||
const title = $(item).find('.name a').attr('title');
|
||||
const episode = $(item).find('.episode').text();
|
||||
const link = $(item).find('.name a').attr('href');
|
||||
const img = $(item).find('.img a img').attr('src');
|
||||
|
||||
const formattedDescription = `<h2>${episode}</h2><br/><img src='${img}' alt='${title}'>`;
|
||||
|
||||
const structuredData = {
|
||||
title,
|
||||
description: formattedDescription,
|
||||
link,
|
||||
};
|
||||
return structuredData;
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: rootUrl,
|
||||
item: arrayOfItems,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/recent-releases', require('./recent-releases'));
|
||||
};
|
||||
|
|
@ -905,3 +905,9 @@ You can use some RSS parsing libraries (like `feedpraser` in `Python`) to receiv
|
|||
|
||||
<Route author="devinmugen" example="/bangumi/online" path="/bangumi/online"/>
|
||||
|
||||
## Gogoanimehd {#gogoanimehd}
|
||||
|
||||
### Recent Releases {#gogoanimehd-recent-releases}
|
||||
|
||||
<Route author="user4302" example="/gogoanimehd/recent-releases" path="/gogoanimehd/recent-releases" />
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue