Merge branch 'develop'

pull/27/head v3.4.1
Jéluchu 5 years ago
commit 8bdd642ad5

@ -1,4 +1,4 @@
# **Aruppi API** (v3.4.0)
# **Aruppi API** (v3.4.1)
> This API has everything about Japan, from anime, music, radio, images, videos ... to japanese culture
>
@ -73,7 +73,7 @@ But if you need to see the code or the operation of the old version you can do i
Aruppi has grown since it was launched and we need to continue improving the application along with the services to be able to give new features.
At this time version 2.6.8 will remain functional until Aruppi App users fully migrate to version 1.5.0 of the app
At this time version 2.6.9 will remain functional until Aruppi App users fully migrate to version 1.5.0 of the app
## **:handshake: Contributing**

2
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "aruppi",
"version": "3.4.0",
"version": "3.4.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

@ -1,6 +1,6 @@
{
"name": "aruppi",
"version": "3.4.0",
"version": "3.4.1",
"description": "Aruppi is a custom API to obtain data from the Japanese culture for the mobile app",
"main": "./src/api/api.js",
"scripts": {

@ -81,7 +81,7 @@ const getAllDirectory = async (genres) => {
return !item.genres.includes("Ecchi") && !item.genres.includes("ecchi");
});
} else {
data = JSON.parse(JSON.stringify(require('../assets/directory.json')));
data = directoryAnimes;
}
return data.map(doc => ({

@ -19,11 +19,15 @@ const {
videoServersJK,
getAnimes,
getDirectory,
getThemes
getThemes,
directoryAnimes,
radioStations,
animeGenres,
animeThemes
} = require('../utils');
const ThemeParser = require('../utils/animetheme');
const parserThemes = new ThemeParser()
const parserThemes = new ThemeParser();
const {
BASE_ANIMEFLV_JELU, BASE_JIKAN, BASE_IVOOX, BASE_QWANT, BASE_YOUTUBE, GENRES_URL, BASE_THEMEMOE
@ -111,7 +115,7 @@ const getAnitakume = async () =>{
const getNews = async (pageRss) =>{
const promises = []
const promises = [];
for(let i = 0; i <= pageRss.length -1; i++) {
@ -242,10 +246,10 @@ const getMoreInfo = async (title) =>{
try {
const promises = []
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];
let data = directoryAnimes;
const res = data.filter(x => x.title === title)[0];
if (!res.jkanime) {
promises.push({
@ -257,9 +261,9 @@ const getMoreInfo = async (title) =>{
rating: res.score || null,
genres: res.genres || null,
episodes: await animeflvInfo(res.id).then(episodes => episodes || null),
moreInfo: await animeExtraInfo(res.mal_title).then(info => info || null),
promo: await getAnimeVideoPromo(res.mal_title).then(promo => promo || null),
characters: await getAnimeCharacters(res.mal_title).then(characters => characters || null)
moreInfo: await animeExtraInfo(res.mal_id).then(info => info || null),
promo: await getAnimeVideoPromo(res.mal_id).then(promo => promo || null),
characters: await getAnimeCharacters(res.mal_id).then(characters => characters || null)
});
} else {
promises.push({
@ -271,9 +275,9 @@ const getMoreInfo = async (title) =>{
rating: res.score || null,
genres: res.genres || null,
episodes: await jkanimeInfo(res.id).then(episodes => episodes || null),
moreInfo: await animeExtraInfo(res.mal_title).then(info => info || null),
promo: await getAnimeVideoPromo(res.mal_title).then(promo => promo || null),
characters: await getAnimeCharacters(res.mal_title).then(characters => characters || null)
moreInfo: await animeExtraInfo(res.mal_id).then(info => info || null),
promo: await getAnimeVideoPromo(res.mal_id).then(promo => promo || null),
characters: await getAnimeCharacters(res.mal_id).then(characters => characters || null)
});
}
@ -343,7 +347,7 @@ const getYoutubeVideos = async (channelId) => {
};
const getRadioStations = async () => {
return require('../assets/radiostations.json');
return radioStations;
}
const getOpAndEd = async (title) => {
@ -432,7 +436,7 @@ const getAnimeGenres = async(genre, order, page) => {
};
const getAllThemes = async () => require('../../assets/themes.json');
const getAllThemes = async () => animeThemes;
module.exports = {
schedule,

@ -8,7 +8,7 @@ router.get('/', (req, res) => {
res.json({
message: 'Aruppi API - 🎏',
author: 'Jéluchu',
version: '2.6.8',
version: '2.6.9',
credits: 'The bitch loves APIs that offers data to Aruppi App',
deprecated: 'This version will be available until users migrate to Aruppi App v1.5.0',
entries: [

@ -1,10 +1,13 @@
const {
BASE_ANIMEFLV, BASE_JIKAN, BASE_EPISODE_IMG_URL, BASE_ARUPPI, ANIMEFLV_SEARCH, BASE_JKANIME
} = require('../api/urls.js');
const {
homgot
} = require('../api/apiCall.js');
const directoryAnimes = JSON.parse(JSON.stringify(require('../../assets/directory.json')));
const radioStations = require('../../assets/radiostations.json');
const animeGenres = require('../../assets/genres.json');
const animeThemes = require('../../assets/themes.json');
function btoa(str) {
let buffer;
@ -194,13 +197,16 @@ const animeflvInfo = async (id) => {
};
const getAnimeCharacters = async(title) =>{
const matchAnime = await getMALid(title)
const getAnimeCharacters = async(mal_id) =>{
let data;
try {
if(matchAnime !== null) {
const data = await homgot(`${BASE_JIKAN}anime/${matchAnime.mal_id}/characters_staff`, { parse: true });
data = await homgot(`${BASE_JIKAN}anime/${mal_id}/characters_staff`, { parse: true });
}catch(error) {
console.log(error);
}
if(data !== null) {
return data.characters.map(doc => ({
id: doc.mal_id,
name: doc.name,
@ -208,40 +214,31 @@ const getAnimeCharacters = async(title) =>{
role: doc.role
}));
}
} catch (err) {
console.log(err)
}
};
const getAnimeVideoPromo = async(title) =>{
const matchAnime = await getMALid(title)
const getAnimeVideoPromo = async(mal_id) =>{
let data;
try {
if(matchAnime !== null) {
const data = await homgot(`${BASE_JIKAN}anime/${matchAnime.mal_id}/videos`, {parse: true})
data = await homgot(`${BASE_JIKAN}anime/${mal_id}/videos`, {parse: true});
}catch(error) {
console.log(error);
}
if(data !== null) {
return data.promo.map(doc => ({
title: doc.title,
previewImage: doc.image_url,
videoURL: doc.video_url
}));
}
} catch (err) {
console.log(err)
}
};
const animeExtraInfo = async (title) => {
const matchAnime = await getMALid(title)
const animeExtraInfo = async (mal_id) => {
const data = await homgot(`${BASE_JIKAN}anime/${mal_id}`, {parse: true});
try {
if(matchAnime !== null) {
const data = await homgot(`${BASE_JIKAN}anime/${matchAnime.mal_id}`, {parse: true})
if(data !== null) {
const promises = [];
let broadcast = ''
@ -298,19 +295,6 @@ const animeExtraInfo = async (title) => {
};
const getMALid = async(title) =>{
const res = await homgot(`${BASE_JIKAN}search/anime?q=${title}`,{ parse: true })
const matchAnime = res.results.find(x => x.title === title);
if(typeof matchAnime === 'undefined') {
return null;
} else {
return matchAnime;
}
};
const imageUrlToBase64 = async (url) => {
let img = await homgot(url)
return img.rawBody.toString('base64');
@ -491,11 +475,11 @@ const getDirectory = async (genres) => {
let data
if (genres === "sfw") {
data = JSON.parse(JSON.stringify(require('../../assets/directory.json'))).filter(function (item) {
data = directoryAnimes.filter(function (item) {
return !item.genres.includes("Ecchi") && !item.genres.includes("ecchi");
})
} else {
data = JSON.parse(JSON.stringify(require('../../assets/directory.json')));
data = directoryAnimes;
}
return data.map(doc => ({
@ -520,7 +504,6 @@ module.exports = {
getAnimeCharacters,
getAnimeVideoPromo,
animeExtraInfo,
getMALid,
imageUrlToBase64,
searchAnime,
transformUrlServer,
@ -529,5 +512,9 @@ module.exports = {
getThemes,
getAnimes,
getDirectory,
videoServersJK
videoServersJK,
directoryAnimes,
radioStations,
animeGenres,
animeThemes
}

Loading…
Cancel
Save