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:
Angelo E De Zoysa 2023-09-24 18:49:10 +05:30 committed by GitHub
parent c68cbe5ca4
commit 821d2cafdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,3 @@
module.exports = {
'/recent-releases': ['user4302'],
};

View File

@ -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',
},
],
},
};

View File

@ -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,
};
};

View File

@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/recent-releases', require('./recent-releases'));
};

View File

@ -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" />