Skip to content

Commit

Permalink
v3.3.4 - Update Directory and Add GetEpisodes Service
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluchu committed Jan 12, 2021
1 parent c65a5bd commit 0c14e0f
Show file tree
Hide file tree
Showing 7 changed files with 702 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# **Aruppi API** (v3.3.3)
# **Aruppi API** (v3.3.4)

> This API has everything about Japan, from anime, music, radio, images, videos ... to japanese culture
>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aruppi",
"version": "3.3.3",
"version": "3.3.4",
"description": "Aruppi is a custom API to obtain data from the Japanese culture for the mobile app",
"main": "./src/api/api.js",
"scripts": {
Expand Down
28 changes: 28 additions & 0 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,33 @@ const getMoreInfo = async (title) =>{

};

const getEpisodes = async (title) =>{

try {

const promises = []

let data = JSON.parse(JSON.stringify(require('../assets/directory.json')));
const res = data.filter(x => x.title === title || x.mal_title === title)[0];

if (!res.jkanime) {
promises.push({
episodes: await animeflvInfo(res.id).then(episodes => episodes || null),
});
} else {
promises.push({
episodes: await jkanimeInfo(res.id).then(episodes => episodes || null),
});
}

return promises;

} catch (e) {
console.log(e)
}

};

const getAnimeServers = async (id) => {

if (isNaN(id.split('/')[0])) {
Expand Down Expand Up @@ -520,6 +547,7 @@ module.exports = {
getLastEpisodes,
getSpecials,
getMoreInfo,
getEpisodes,
getAnimeServers,
search,
getImages,
Expand Down
3 changes: 2 additions & 1 deletion src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ router.get('/', (req, res) => {
'News': '/api/v3/news',
'Season': '/api/v3/season/:year/:type',
'All Seasons': '/api/v3/allSeasons',
'All Directory': '/api/v3/allDirectory',
'All Directory': '/api/v3/allDirectory/:type',
'Genres': '/api/v3/getByGenres/:genre?/:order?/:page?',
'Futures Seasons': '/api/v3/laterSeasons',
'LastEpisodes': '/api/v3/lastEpisodes',
Expand All @@ -29,6 +29,7 @@ router.get('/', (req, res) => {
'Specials': '/api/v3/specials/:type/:page',
'Tv': '/api/v3/tv/:type/:page',
'MoreInfo': '/api/v3/moreInfo/:title',
'GetEpisodes': '/api/v3/getEpisodes/:title',
'GetAnimeServers': '/api/v3/getAnimeServers/:id',
'Search': '/api/v3/search/:title',
'Images': '/api/v3/images/:query',
Expand Down
17 changes: 17 additions & 0 deletions src/api/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,23 @@ router.get('/moreInfo/:title' , (req, res) =>{

});

router.get('/getEpisodes/:title' , (req, res) =>{

let title = req.params.title;

api.getEpisodes(title)
.then(episodes =>{
if (episodes.length > 0) {
res.status(200).json(episodes);
} else (
res.status(500).json({ message: 'Aruppi lost in the shell'})
)
}).catch((err) =>{
console.error(err);
});

});

router.get('/getAnimeServers/:id([^/]+/[^/]+)' , (req, res) =>{

let id = req.params.id;
Expand Down
Loading

0 comments on commit 0c14e0f

Please sign in to comment.