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 > 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. 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** ## **:handshake: Contributing**

2
package-lock.json generated

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

@ -1,6 +1,6 @@
{ {
"name": "aruppi", "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", "description": "Aruppi is a custom API to obtain data from the Japanese culture for the mobile app",
"main": "./src/api/api.js", "main": "./src/api/api.js",
"scripts": { "scripts": {

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

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

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

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

Loading…
Cancel
Save