mirror of https://github.com/aruppi/aruppi-api
v3.1.0 - Legal Platforms, refactor and improve genres
This commit is contained in:
parent
0d1c2ee1fe
commit
9f4e8fc865
|
@ -1,4 +1,4 @@
|
|||
# **Aruppi API** (v3.0.3)
|
||||
# **Aruppi API** (v3.1.0)
|
||||
|
||||
> This API has everything about Japan, from anime, music, radio, images, videos ... to japanese culture
|
||||
>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "aruppi",
|
||||
"version": "3.0.3",
|
||||
"version": "3.1.0",
|
||||
"description": "Aruppi is a custom API to obtain data from the Japanese culture for the mobile app",
|
||||
"main": "./src/api/api.js",
|
||||
"scripts": {
|
||||
|
|
141
src/api/api.js
141
src/api/api.js
|
@ -25,7 +25,7 @@ const ThemeParser = require('../utils/animetheme');
|
|||
const parserThemes = new ThemeParser()
|
||||
|
||||
const {
|
||||
BASE_ANIMEFLV_JELU, BASE_JIKAN, BASE_IVOOX, BASE_QWANT, BASE_YOUTUBE, GENRES_URL, BASE_THEMEMOE, BASE_ANIMEFLV
|
||||
BASE_ANIMEFLV_JELU, BASE_JIKAN, BASE_IVOOX, BASE_QWANT, BASE_YOUTUBE, GENRES_URL, BASE_THEMEMOE, BASE_ANIMEFLV, BASE_ARUPPI
|
||||
} = require('./urls');
|
||||
|
||||
const schedule = async (day) =>{
|
||||
|
@ -379,46 +379,122 @@ const getArtist = async (id) => {
|
|||
|
||||
};
|
||||
|
||||
const getAnimeGenres = async(genre, order, page) => {
|
||||
const getAnimeGenres = async(genres) => {
|
||||
|
||||
let $
|
||||
let promises = []
|
||||
|
||||
if (page !== undefined) {
|
||||
$ = await homgot(`${GENRES_URL}genre%5B%5D=${genre}&order=${order}&page=${page}`,{ scrapy: true })
|
||||
if (genres.genre === undefined && genres.page === undefined && genres.order === undefined) {
|
||||
return require('../assets/genres.json');
|
||||
} else {
|
||||
$ = await homgot(`${GENRES_URL}genre%5B%5D=${genre}&order=${order}`,{ scrapy: true })
|
||||
|
||||
if (genres.page !== undefined) {
|
||||
$ = await homgot(`${GENRES_URL}genre%5B%5D=${genres.genre}&order=${genres.order}&page=${genres.page}`,{ scrapy: true })
|
||||
} else {
|
||||
$ = await homgot(`${GENRES_URL}genre%5B%5D=${genres.genre}&order=${genres.order}`,{ scrapy: true })
|
||||
}
|
||||
|
||||
$('div.Container ul.ListAnimes li article').each((index , element) =>{
|
||||
const $element = $(element);
|
||||
const id = $element.find('div.Description a.Button').attr('href').slice(1);
|
||||
const title = $element.find('a h3').text();
|
||||
const poster = $element.find('a div.Image figure img').attr('src');
|
||||
const banner = poster.replace('covers' , 'banners').trim();
|
||||
const type = $element.find('div.Description p span.Type').text();
|
||||
const synopsis = $element.find('div.Description p').eq(1).text().trim();
|
||||
const rating = $element.find('div.Description p span.Vts').text();
|
||||
|
||||
promises.push(animeflvGenres(id).then(async genres => ({
|
||||
id: id || null,
|
||||
title: title || null,
|
||||
poster: await imageUrlToBase64(poster) || null,
|
||||
banner: banner || null,
|
||||
synopsis: synopsis || null,
|
||||
type: type || null,
|
||||
rating: rating || null,
|
||||
genres: genres || null
|
||||
})))
|
||||
|
||||
})
|
||||
|
||||
return Promise.all(promises);
|
||||
|
||||
}
|
||||
|
||||
$('div.Container ul.ListAnimes li article').each((index , element) =>{
|
||||
const $element = $(element);
|
||||
const id = $element.find('div.Description a.Button').attr('href').slice(1);
|
||||
const title = $element.find('a h3').text();
|
||||
const poster = $element.find('a div.Image figure img').attr('src');
|
||||
const banner = poster.replace('covers' , 'banners').trim();
|
||||
const type = $element.find('div.Description p span.Type').text();
|
||||
const synopsis = $element.find('div.Description p').eq(1).text().trim();
|
||||
const rating = $element.find('div.Description p span.Vts').text();
|
||||
|
||||
promises.push(animeflvGenres(id).then(async genres => ({
|
||||
id: id || null,
|
||||
title: title || null,
|
||||
poster: await imageUrlToBase64(poster) || null,
|
||||
banner: banner || null,
|
||||
synopsis: synopsis || null,
|
||||
type: type || null,
|
||||
rating: rating || null,
|
||||
genres: genres || null
|
||||
})))
|
||||
|
||||
})
|
||||
|
||||
return Promise.all(promises);
|
||||
|
||||
};
|
||||
|
||||
const getAllThemes = async () => await structureThemes(await parserThemes.all(), false);
|
||||
|
||||
const getDestAnimePlatforms = async () => {
|
||||
|
||||
let data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/top.json`, { parse: true });
|
||||
|
||||
return data.map(doc =>({
|
||||
id: doc.id,
|
||||
name: doc.name,
|
||||
logo: doc.logo
|
||||
}));
|
||||
|
||||
};
|
||||
|
||||
const getPlatforms = async (id) => {
|
||||
|
||||
let data
|
||||
|
||||
if (id === undefined) {
|
||||
|
||||
data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/typeplatforms.json`, { parse: true });
|
||||
|
||||
return data.map(doc =>({
|
||||
id: doc.id,
|
||||
name: doc.name,
|
||||
comming: doc.comming || false,
|
||||
cover: doc.cover
|
||||
}));
|
||||
|
||||
} else {
|
||||
|
||||
data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/type/${id}.json`, { parse: true });
|
||||
|
||||
return data.map(doc =>({
|
||||
id: doc.id,
|
||||
name: doc.name,
|
||||
type: doc.type,
|
||||
logo: doc.logo,
|
||||
cover: doc.cover,
|
||||
link: doc.link
|
||||
}));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const getProfilePlatform = async (id) => {
|
||||
|
||||
let data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/platforms/${id}.json`, { parse: true })
|
||||
|
||||
let channelId = { id: data[0].youtubeId, part: 'snippet,id', order: 'date', maxResults: '50', prop: 'items' };
|
||||
let videos = await getYoutubeVideos(channelId)
|
||||
|
||||
return data.map(doc =>({
|
||||
id: doc.id,
|
||||
name: doc.name,
|
||||
logo: doc.logo,
|
||||
cover: doc.cover,
|
||||
category: doc.category,
|
||||
description: doc.description,
|
||||
facebook: doc.facebook,
|
||||
twitter: doc.twitter,
|
||||
instagram: doc.instagram,
|
||||
webpage: doc.webpage,
|
||||
simulcast: doc.simulcast,
|
||||
paid: doc.paid,
|
||||
shop: doc.shop,
|
||||
faq: doc.faq,
|
||||
videos: videos
|
||||
}));
|
||||
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
schedule,
|
||||
top,
|
||||
|
@ -442,5 +518,8 @@ module.exports = {
|
|||
getRandomTheme,
|
||||
getArtist,
|
||||
getAnimeGenres,
|
||||
getAllThemes
|
||||
getAllThemes,
|
||||
getDestAnimePlatforms,
|
||||
getPlatforms,
|
||||
getProfilePlatform
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ router.get('/', (req, res) => {
|
|||
'Season': '/api/v3/season/:year/:type',
|
||||
'All Seasons': '/api/v3/allSeasons',
|
||||
'All Directory': '/api/v3/allDirectory',
|
||||
'Genres': '/api/v3/getByGenres/:genre/:order/:page?',
|
||||
'Genres': '/api/v3/getByGenres/:genre?/:order?/:page?',
|
||||
'Futures Seasons': '/api/v3/laterSeasons',
|
||||
'LastEpisodes': '/api/v3/lastEpisodes',
|
||||
'Movies': '/api/v3/movies/:type/:page',
|
||||
|
@ -38,7 +38,10 @@ router.get('/', (req, res) => {
|
|||
'Themes': '/api/v3/themes/:title',
|
||||
'Year Themes': '/api/v3/themesYear/:year?',
|
||||
'Random Theme': '/api/v3/randomTheme',
|
||||
'Artists Theme': '/api/v3/artists/:id?'
|
||||
'Artists Theme': '/api/v3/artists/:id?',
|
||||
'Famous Platforms': '/api/v3/destAnimePlatforms',
|
||||
'Legal Platforms': '/api/v3/platforms/:id?',
|
||||
'Platforms Details': '/api/v3/profilePlatform:id'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
|
@ -469,11 +469,11 @@ router.get('/artists/:id?', (req, res) =>{
|
|||
|
||||
});
|
||||
|
||||
router.get('/getByGenres/:genre/:order/:page?' , (req , res) =>{
|
||||
let genre = req.params.genre;
|
||||
let order = req.params.order;
|
||||
let page = req.params.page;
|
||||
api.getAnimeGenres(genre, order , page)
|
||||
router.get('/getByGenres/:genre?/:order?/:page?' , (req , res) =>{
|
||||
|
||||
let genres = { genre: req.params.genre, order: req.params.order, page: req.params.page };
|
||||
|
||||
api.getAnimeGenres(genres)
|
||||
.then(animes =>{
|
||||
if (animes.length > 0) {
|
||||
res.status(200).json({
|
||||
|
@ -487,4 +487,54 @@ router.get('/getByGenres/:genre/:order/:page?' , (req , res) =>{
|
|||
});
|
||||
});
|
||||
|
||||
router.get('/destAnimePlatforms' , (req , res) =>{
|
||||
|
||||
api.getDestAnimePlatforms()
|
||||
.then(destPlatforms =>{
|
||||
if (destPlatforms.length > 0) {
|
||||
res.status(200).json({
|
||||
destPlatforms
|
||||
});
|
||||
} else (
|
||||
res.status(500).json({ message: 'Aruppi lost in the shell'})
|
||||
)
|
||||
}).catch((err) =>{
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/platforms/:id?' , (req , res) =>{
|
||||
|
||||
let id = req.params.id;
|
||||
|
||||
api.getPlatforms(id)
|
||||
.then(platforms =>{
|
||||
if (platforms.length > 0) {
|
||||
res.status(200).json({
|
||||
platforms
|
||||
});
|
||||
} else (
|
||||
res.status(500).json({ message: 'Aruppi lost in the shell'})
|
||||
)
|
||||
}).catch((err) =>{
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/profilePlatform/:id' , (req , res) =>{
|
||||
|
||||
let id = req.params.id;
|
||||
|
||||
api.getProfilePlatform(id)
|
||||
.then(info =>{
|
||||
if (info.length > 0) {
|
||||
res.status(200).json(info[0]);
|
||||
} else (
|
||||
res.status(500).json({ message: 'Aruppi lost in the shell'})
|
||||
)
|
||||
}).catch((err) =>{
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
@ -9372,7 +9372,7 @@
|
|||
{
|
||||
"id": "ghost-hound",
|
||||
"title": "Ghost Hound",
|
||||
"mal_title": "Ghost Hound",
|
||||
"mal_title": "Shinreigari",
|
||||
"poster": "https://aruppi.jeluchu.xyz/res/directory/537.jpg",
|
||||
"type": "Anime",
|
||||
"genres": [
|
||||
|
@ -21633,7 +21633,7 @@
|
|||
{
|
||||
"id": "jojos-bizarre-adventure-stardust-crusaders",
|
||||
"title": "JoJo's Bizarre Adventure: Stardust Crusaders",
|
||||
"mal_title": "JoJo's Bizarre Adventure: Stardust Crusaders",
|
||||
"mal_title": "JoJo no Kimyou na Bouken Part 3: Stardust Crusaders",
|
||||
"poster": "https://aruppi.jeluchu.xyz/res/directory/1257.jpg",
|
||||
"type": "Anime",
|
||||
"genres": [
|
||||
|
@ -30087,7 +30087,7 @@
|
|||
{
|
||||
"id": "jojos-bizarre-adventure-stardust-crusaders-2",
|
||||
"title": "Jojo's Bizarre Adventure: Stardust Crusaders 2nd Season",
|
||||
"mal_title": "Jojo's Bizarre Adventure: Stardust Crusaders 2nd Season",
|
||||
"mal_title": "JoJo no Kimyou na Bouken Part 3: Stardust Crusaders 2nd Season",
|
||||
"poster": "https://aruppi.jeluchu.xyz/res/directory/1752.jpg",
|
||||
"type": "Anime",
|
||||
"genres": [
|
||||
|
@ -55528,5 +55528,72 @@
|
|||
],
|
||||
"state": "Finalizado",
|
||||
"description": "El año es 2027, y la ciudad de Kyoto ha experimentado un tremendo avance tecnológico. Dentro de la ciudad vive Naomi Katagaki, un niño socialmente torpe e introvertido que ama los libros, y Ruri Ichigyou, una niña con una personalidad fría que a menudo es contundente con la gente, pero comparte su amor por la lectura. A pesar de tener intereses similares, Naomi teme acercarse a Ruri debido a su naturaleza hostil."
|
||||
},
|
||||
{
|
||||
"id": "devilman-lady",
|
||||
"title": "Devilman Lady",
|
||||
"mal_title": "Devilman Lady",
|
||||
"poster": "https://aruppi.jeluchu.xyz/res/directory/3278.jpg",
|
||||
"type": "Anime",
|
||||
"score": "3.8",
|
||||
"jkanime": true,
|
||||
"genres": [
|
||||
"Acción",
|
||||
"Drama",
|
||||
"Terror",
|
||||
"Psicológico"
|
||||
],
|
||||
"state": "Finalizado",
|
||||
"description": "La historia se centra en Jun Fudo, una maestra que es atacada por los demonios mientras acompañaba a un grupo de estudiantes en un viaje escolar. En medio del asalto, junio se transforma en Devil Lady y defiende a los sobrevivientes del ataque inicial, matando a los demonios con su recien adquirida fuerza. Jun, ahora la Devilman Lady, lucha por el bien de la humanidad para protegerlos de las bestias del diablo y sus creaciones."
|
||||
},
|
||||
{
|
||||
"id": "ore-wo-suki-nano-wa-omae-dake-ka-yo-oretachi-no-game-set",
|
||||
"title": "Ore wo Suki nano wa Omae dake ka yo: Oretachi no Game Set",
|
||||
"mal_title": "Ore wo Suki nano wa Omae dake ka yo: Oretachi no Game Set",
|
||||
"poster": "https://aruppi.jeluchu.xyz/res/directory/3279.jpg",
|
||||
"type": "OVA",
|
||||
"score": "4.8",
|
||||
"jkanime": false,
|
||||
"genres": [
|
||||
"Comedia",
|
||||
"Escolares",
|
||||
"Romance"
|
||||
],
|
||||
"state": "Finalizado",
|
||||
"description": "La historia se centra en Amatsuyu “Joro” Kisaragi, un chico ordinario de preparatoria que es invitado por dos hermosas chicas a hablar a solas: la primera es su senpai, Sakura “Cosmos” Akino, y la segunda es su amiga de la infancia Aoi “Himawari” Hinata. Esperando que ambas va a confesarle su amor, Joro triunfante asiste a verlas solo para que ellas le confiesen que están enamoradas de su mejor amigo, Taiyou “Sun-chan” Ouga. Joro a regañadientes acepta ayudarlas a atraer su atención, con la esperanza de aprovechar la situación cuando una de las dos pierda, no obstante, la chica ratón de biblioteca Sumireko “Pansy” Sanshokuin se le confiesa, y resulta que su mejor amigo Sun-chan en realidad solo está interesado en ella. ¡Vaya lío!"
|
||||
},
|
||||
{
|
||||
"id": "jewelpet-twinkle",
|
||||
"title": "Jewelpet Twinkle☆",
|
||||
"mal_title": "Jewelpet Twinkle☆",
|
||||
"poster": "https://aruppi.jeluchu.xyz/res/directory/3280.jpg",
|
||||
"type": "Anime",
|
||||
"score": "4.8",
|
||||
"jkanime": true,
|
||||
"genres": [
|
||||
"Shoujo",
|
||||
"Colegial",
|
||||
"Magia",
|
||||
"Fantasia"
|
||||
],
|
||||
"state": "En Emisión",
|
||||
"description": "En Jewel Land, Jewelpets, criaturas que tienen la habilidad natural de usar la magia vivían en armonia con las Brujas, asistiendo a la Escuela de Magia y Hechicería para aprender a usar la magia con sus Jewel Eyes. Sin embargo, Ruby, una liebre japonesa blanca cuya magia a veces falla. Pero cuando usó la tarjeta que le dieron los magos, fue enviada al mundo Humano por accidente. En el mundo humano, una chica llamada Akari Sakura la encontró en la playa de camino a la escuela. Al principio, Akari no puede entenderla debido a su idioma de la tierra de las joyas hasta que Ruby tomo un caramelo especial para poder hablar y comprender el lenguaje humano."
|
||||
},
|
||||
{
|
||||
"id": "human-lost-ningen-shikkaku",
|
||||
"title": "Human Lost: Ningen Shikkaku",
|
||||
"mal_title": "Human Lost: Ningen Shikkaku",
|
||||
"poster": "https://aruppi.jeluchu.xyz/res/directory/3281.jpg",
|
||||
"type": "Película",
|
||||
"score": "4.4",
|
||||
"jkanime": true,
|
||||
"genres": [
|
||||
"Drama",
|
||||
"Historico",
|
||||
"Psicológico",
|
||||
"Seinen"
|
||||
],
|
||||
"state": "Finalizado",
|
||||
"description": "Tokio, 2036 (año 111 de Showa): una revolucion en el tratamiento médico ha conquistado la muerte ...\nMediante nanomaquinas internas y el \"S.H.E.L.L.\" sistema cuya red los controla, los seres humanos no padecen enfermedades, no requieren tratamiento de lesiones y tienen garantizada una vida útil de 120 años, libre de enfermedades. Sin embargo, este consumado sistema social distorsiona a la nación japonesa de muchas maneras: disparidades económicas no resueltas, decadencia etica resultante de la inmortalidad, grave contaminacion ambiental y el fenomeno \"Human Lost\", en el que las personas mismas, desconectadas de S.H.E.L.L. red, se deforman. Japón se tambalea salvajemente entre dos futuros potenciales: la restauracion de la civilizacion o su destrucción."
|
||||
}
|
||||
]
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
[
|
||||
{ "name": " Acción", "value": "accion" },
|
||||
{ "name": " Artes Marciales", "value": "artes-marciales" },
|
||||
{ "name": " Aventuras", "value": "aventura" },
|
||||
{ "name": " Carreras", "value": "carreras" },
|
||||
{ "name": " Ciencia Ficción", "value": "ciencia-ficcion" },
|
||||
{ "name": " Comedia", "value": "comedia" },
|
||||
{ "name": " Demencia", "value": "demencia" },
|
||||
{ "name": " Demonios", "value": "demonios" },
|
||||
{ "name": " Deportes", "value": "deportes" },
|
||||
{ "name": " Drama", "value": "drama" },
|
||||
{ "name": " Ecchi", "value": "ecchi" },
|
||||
{ "name": " Escolares", "value": "escolares" },
|
||||
{ "name": " Espacial", "value": "espacial" },
|
||||
{ "name": " Fantasía", "value": "fantasia" },
|
||||
{ "name": " Harem", "value": "harem" },
|
||||
{ "name": " Historico", "value": "historico" },
|
||||
{ "name": " Infantil", "value": "infantil" },
|
||||
{ "name": " Josei", "value": "josei" },
|
||||
{ "name": " Juegos", "value": "juegos" },
|
||||
{ "name": " Magia", "value": "magia" },
|
||||
{ "name": " Mecha", "value": "mecha" },
|
||||
{ "name": " Militar", "value": "militar" },
|
||||
{ "name": " Misterio", "value": "misterio" },
|
||||
{ "name": " Música", "value": "musica" },
|
||||
{ "name": " Parodia", "value": "parodia" },
|
||||
{ "name": " Policía", "value": "policia" },
|
||||
{ "name": " Psicológico", "value": "psicologico" },
|
||||
{ "name": " Recuentos de la vida", "value": "recuentos-de-la-vida" },
|
||||
{ "name": " Romance", "value": "romance" },
|
||||
{ "name": " Samurai", "value": "samurai" },
|
||||
{ "name": " Seinen", "value": "seinen" },
|
||||
{ "name": " Shoujo", "value": "shoujo" },
|
||||
{ "name": " Shounen", "value": "shounen" },
|
||||
{ "name": " Sobrenatural", "value": "sobrenatural" },
|
||||
{ "name": " Superpoderes", "value": "superpoderes" },
|
||||
{ "name": " Suspenso", "value": "suspenso" },
|
||||
{ "name": " Terror", "value": "terror" },
|
||||
{ "name": " Vampiros", "value": "vampiros" },
|
||||
{ "name": " Yaoi", "value": "yaoi" },
|
||||
{ "name": " Yuri", "value": "yuri" }
|
||||
]
|
Loading…
Reference in New Issue