Skip to content

Commit

Permalink
Add Directory Not NSWF
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluchu committed Jan 9, 2021
1 parent d65fc54 commit 9107698
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 145 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.1)
# **Aruppi API** (v3.3.2)

> This API has everything about Japan, from anime, music, radio, images, videos ... to japanese culture
>
Expand Down
231 changes: 102 additions & 129 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aruppi",
"version": "3.3.1",
"version": "3.3.2",
"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 Expand Up @@ -43,13 +43,13 @@
"license": "MIT",
"dependencies": {
"body-parser": "^1.19.0",
"cheerio": "^1.0.0-rc.3",
"cheerio": "^1.0.0-rc.5",
"compose-middleware": "^5.0.1",
"cors": "^2.8.5",
"express": "^4.16.4",
"got": "^11.8.0",
"helmet": "^4.1.1",
"rss-to-json": "^1.1.1",
"express": "^4.17.1",
"got": "^11.8.1",
"helmet": "^4.3.1",
"rss-to-json": "^1.1.2",
"tough-cookie": "^4.0.0"
}
}
11 changes: 9 additions & 2 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,16 @@ const getAllAnimes = async () =>{

};

const getAllDirectory = async () =>{
const getAllDirectory = async (notNSWF) =>{

let data = JSON.parse(JSON.stringify(require('../assets/directory.json')));
let data
if (notNSWF) {
data = JSON.parse(JSON.stringify(require('../assets/directory.json'))).filter(function (item) {
return !item.genres.includes("Ecchi") && !item.genres.includes("ecchi");
})
} else {
data = JSON.parse(JSON.stringify(require('../assets/directory.json')));
}

return data.map(doc => ({
id: doc.id,
Expand Down
5 changes: 3 additions & 2 deletions src/api/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ router.get('/allAnimes' , (req, res) =>{

});

router.get('/allDirectory' , (req, res) =>{
router.get('/allDirectory/:notNSWF?' , (req, res) =>{

api.getAllDirectory()
let notNSWF = req.params.notNSWF;
api.getAllDirectory(notNSWF)
.then(directory =>{
if (directory.length > 0) {
res.status(200).json({
Expand Down
2 changes: 1 addition & 1 deletion src/v2/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const getAllAnimes = async () =>{

};

const getAllDirectory = async () =>{ return await getDirectory(); };
const getAllDirectory = async (notNSWF) =>{ return await getDirectory(notNSWF); };

const getAnitakume = async () =>{

Expand Down
6 changes: 4 additions & 2 deletions src/v2/api/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ router.get('/allAnimes' , (req, res) =>{

});

router.get('/allDirectory' , (req, res) =>{
router.get('/allDirectory/:notNSWF?' , (req, res) =>{

api.getAllDirectory()
let notNSWF = req.params.notNSWF;

api.getAllDirectory(notNSWF)
.then(directory =>{
if (directory.length > 0) {
res.status(200).json({
Expand Down
12 changes: 10 additions & 2 deletions src/v2/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,17 @@ const getThemes = async (themes) => {

const getAnimes = async () => await homgot(`${BASE_ANIMEFLV}api/animes/list`, { parse: true });

const getDirectory = async () => {
const getDirectory = async (notNSWF) => {

let data
if (notNSWF) {
data = JSON.parse(JSON.stringify(require('../../assets/directory.json'))).filter(function (item) {
return !item.genres.includes("Ecchi") && !item.genres.includes("ecchi");
})
} else {
data = JSON.parse(JSON.stringify(require('../../assets/directory.json')));
}

let data = JSON.parse(JSON.stringify(require('../../assets/directory.json')));
return data.map(doc => ({
id: doc.id,
title: doc.title,
Expand Down

0 comments on commit 9107698

Please sign in to comment.