mirror of https://github.com/aruppi/aruppi-api
v3.2.0 - Type videos and AllThemes
This commit is contained in:
parent
5c151093a9
commit
d3558c7f33
|
@ -1,4 +1,4 @@
|
|||
# **Aruppi API** (v3.1.2)
|
||||
# **Aruppi API** (v3.2.0)
|
||||
|
||||
> This API has everything about Japan, from anime, music, radio, images, videos ... to japanese culture
|
||||
>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "aruppi",
|
||||
"version": "3.1.2",
|
||||
"version": "3.2.0",
|
||||
"description": "Aruppi is a custom API to obtain data from the Japanese culture for the mobile app",
|
||||
"main": "./src/api/api.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -339,6 +339,46 @@ const getYoutubeVideos = async (channelId) => {
|
|||
|
||||
};
|
||||
|
||||
const getSectionYoutubeVideos = async (type) => {
|
||||
|
||||
let data = []
|
||||
|
||||
if (type === 'learn') {
|
||||
data = await homgot(`${BASE_YOUTUBE}UCCyQwSS6m2mVB0-H2FOFJtw&part=snippet,id&order=date&maxResults=50`, { parse: true });
|
||||
return data.items.map(doc =>({
|
||||
title: doc.snippet.title,
|
||||
videoId: doc.id.videoId,
|
||||
thumbDefault: doc.snippet.thumbnails.default.url,
|
||||
thumbMedium: doc.snippet.thumbnails.medium.url,
|
||||
thumbHigh: doc.snippet.thumbnails.high.url
|
||||
}));
|
||||
} else if (type === 'amv') {
|
||||
let yt1 = await homgot(`${BASE_YOUTUBE}UCkTFkshjAsLMKwhAe1uPC1A&part=snippet,id&order=date&maxResults=25`, { parse: true });
|
||||
let yt2 = await homgot(`${BASE_YOUTUBE}UC2cpvlLeowpqnR6bQofwNew&part=snippet,id&order=date&maxResults=25`, { parse: true });
|
||||
data = yt1.items.concat(yt2.items)
|
||||
return data.map(doc =>({
|
||||
title: doc.snippet.title,
|
||||
videoId: doc.id.videoId,
|
||||
thumbDefault: doc.snippet.thumbnails.default.url,
|
||||
thumbMedium: doc.snippet.thumbnails.medium.url,
|
||||
thumbHigh: doc.snippet.thumbnails.high.url
|
||||
}));
|
||||
} else if (type === 'produccer'){
|
||||
let yt1 = await homgot(`${BASE_YOUTUBE}UCkTFkshjAsLMKwhAe1uPC1A&part=snippet,id&order=date&maxResults=25`, { parse: true });
|
||||
let yt2 = await homgot(`${BASE_YOUTUBE}UCwUeTOXP3DD9DIvHttowuSA&part=snippet,id&order=date&maxResults=25`, { parse: true });
|
||||
let yt3 = await homgot(`${BASE_YOUTUBE}UCA8Vj7nN8bzT3rsukD2ypUg&part=snippet,id&order=date&maxResults=25`, { parse: true });
|
||||
data = yt1.items.concat(yt2.items.concat(yt3.items))
|
||||
return data.map(doc =>({
|
||||
title: doc.snippet.title,
|
||||
videoId: doc.id.videoId,
|
||||
thumbDefault: doc.snippet.thumbnails.default.url,
|
||||
thumbMedium: doc.snippet.thumbnails.medium.url,
|
||||
thumbHigh: doc.snippet.thumbnails.high.url
|
||||
}));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const getRadioStations = async () => require('../assets/radiostations.json');
|
||||
|
||||
const getOpAndEd = async (title) => await structureThemes(await parserThemes.serie(title), true);
|
||||
|
@ -422,7 +462,7 @@ const getAnimeGenres = async(genres) => {
|
|||
|
||||
};
|
||||
|
||||
const getAllThemes = async () => await structureThemes(await parserThemes.all(), false);
|
||||
const getAllThemes = async () => require('../assets/themes.json');
|
||||
|
||||
const getDestAnimePlatforms = async () => {
|
||||
|
||||
|
@ -520,5 +560,6 @@ module.exports = {
|
|||
getAllThemes,
|
||||
getDestAnimePlatforms,
|
||||
getPlatforms,
|
||||
getSectionYoutubeVideos,
|
||||
getProfilePlatform
|
||||
};
|
||||
|
|
|
@ -33,6 +33,7 @@ router.get('/', (req, res) => {
|
|||
'Search': '/api/v3/search/:title',
|
||||
'Images': '/api/v3/images/:query',
|
||||
'Videos': '/api/v3/videos/:channelId',
|
||||
'Type Videos': '/api/v3/sectionedVideos/:type',
|
||||
'Radios': '/api/v3/radio',
|
||||
'All Themes': '/api/v3/allThemes',
|
||||
'Themes': '/api/v3/themes/:title',
|
||||
|
|
|
@ -358,6 +358,25 @@ router.get('/videos/:channelId' , (req, res) =>{
|
|||
|
||||
});
|
||||
|
||||
router.get('/sectionedVideos/:type' , (req, res) =>{
|
||||
|
||||
let type = req.params.type;
|
||||
|
||||
api.getSectionYoutubeVideos(type)
|
||||
.then(videos =>{
|
||||
if (videos.length > 0) {
|
||||
res.status(200).json({
|
||||
videos
|
||||
});
|
||||
} else (
|
||||
res.status(500).json({ message: 'Aruppi lost in the shell'})
|
||||
)
|
||||
}).catch((err) =>{
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
router.get('/radio' , (req, res) =>{
|
||||
|
||||
api.getRadioStations()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue