From 49c2ead9643defbf94bf076b863cc1cd1e3685ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9luchu?= Date: Sun, 7 Jun 2020 19:12:13 +0200 Subject: [PATCH] Add Thumb news photos --- src/api/api.js | 4 +++- src/api/index.js | 3 ++- src/api/urls.js | 3 ++- src/utils/index.js | 33 +++++++++++++++++++++++++++++++-- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index 1dfa86b..3e886ef 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -8,7 +8,8 @@ const { getAnimeVideoPromo, animeExtraInfo, searchAnime, - transformUrlServer + transformUrlServer, + obtainPreviewNews } = require('../utils/index'); const { @@ -109,6 +110,7 @@ const getNews = async (pageRss) =>{ title: doc.title, url: doc.link, author: pageRss[i].author, + thumbnail: obtainPreviewNews(doc[pageRss[i].content]), content: doc[pageRss[i].content] }); diff --git a/src/api/index.js b/src/api/index.js index 1741b6e..31dc71d 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -26,7 +26,8 @@ router.get('/', (req, res) => { 'GetAnimeServers': '/api/v2/getAnimeServers/:id', 'Search': '/api/v2/search/:title', 'Images': '/api/v2/images/:query', - 'Videos': '/api/v2/videos/:channelId' + 'Videos': '/api/v2/videos/:channelId', + 'Radios': '/api/v2/radio' } ] }); diff --git a/src/api/urls.js b/src/api/urls.js index 3f13bbc..2fac886 100644 --- a/src/api/urls.js +++ b/src/api/urls.js @@ -1,4 +1,5 @@ module.exports = { + BASE_ARUPPI: 'https://aruppi.jeluchu.xyz/', BASE_ANIMEFLV: 'https://animeflv.net/', BASE_ANIMEFLV_JELU: 'https://aruppi.jeluchu.xyz/apis/animeflv/v1/', BASE_YOUTUBE: 'https://aruppi.jeluchu.xyz/apis/youtube/v3/search?channelId=', @@ -11,4 +12,4 @@ module.exports = { SEARCH_URL: 'https://animeflv.net/browse?q=', BASE_EPISODE_IMG_URL: 'https://cdn.animeflv.net/screenshots/', BASE_QWANT: 'https://api.qwant.com/search/images?' -}; \ No newline at end of file +}; diff --git a/src/utils/index.js b/src/utils/index.js index 8a86fde..abc2932 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -306,6 +306,34 @@ const transformUrlServer = async(urlReal) =>{ return promises; } +const obtainPreviewNews = (encoded) => { + + let image; + + if (encoded.includes('