Compare commits

...

19 Commits
v4.1.5 ... v4

Author SHA1 Message Date
Darkangeel_hd 6c44d5a712 Fixed getImages urls
No more "https:https://"
Will this work tomorrow, i don't know
2 years ago
Darkangeel_hd cef7574083 Minor updates
Changed PromoVideos redis keyname, using mal_id now
Changed schedule key TTL from 2 to 6 hours
2 years ago
Darkangeel_hd 7c6307cb1e Expire getRelatedMAL_* faster
TTL set to 1h
Also, forgot to mention on last commit that we changed the key name to a more friendly one, using the mal_id now.
As the relation between mal_id and its content is 1:1 collisions are not possible
That way is easier to identify on the db
2 years ago
Darkangeel_hd 58ac761098 Reimplemented getRelatedAnimesMAL
Reimplemented getRelatedAnimesMAL using jikan v4 and aruppi DB
what a pain in the ass was this one...
2 years ago
Darkangeel_hd 3a633b2ff2 Migrating to jikan v4
moved v3 endpoints to jikan v4
Quick fixes, will review later (as in between a day and 2 years later UwU)
2 years ago
dependabot[bot] e39bb486b0 Bump http-cache-semantics from 4.1.0 to 4.1.1
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](https://github.com/kornelski/http-cache-semantics/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
dependabot[bot] 189a5bfb79 Bump mongoose from 5.13.13 to 5.13.15
Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.13.13 to 5.13.15.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Automattic/mongoose/compare/5.13.13...5.13.15)

---
updated-dependencies:
- dependency-name: mongoose
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
dependabot[bot] df30fd785e Bump json5 from 1.0.1 to 1.0.2
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
dependabot[bot] 656d4ce1ba Bump express from 4.17.1 to 4.17.3
Bumps [express](https://github.com/expressjs/express) from 4.17.1 to 4.17.3.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.17.1...4.17.3)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
dependabot[bot] a90e522c21 Bump minimatch from 3.0.4 to 3.1.2
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
Darkangeel_hd faf0afee8c Updated utils/requestCall
Added new options to spoof user agent
New Aruppi APi user agent
Adapt relevant code to new funcionality

fixed line break on urls.ts
3 years ago
Darkangeel_hd 736ff79707 Update qwant api url 3 years ago
dependabot[bot] 2b4e3d0d7d
Bump minimist from 1.2.5 to 1.2.6 (#58)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years ago
Jesús María fdb744582f
Merge pull request #57 from aruppi/dependabot/npm_and_yarn/got-11.8.5
Bump got from 11.8.3 to 11.8.5
3 years ago
dependabot[bot] c3fa6cd854
Bump got from 11.8.3 to 11.8.5
Bumps [got](https://github.com/sindresorhus/got) from 11.8.3 to 11.8.5.
- [Release notes](https://github.com/sindresorhus/got/releases)
- [Commits](https://github.com/sindresorhus/got/compare/v11.8.3...v11.8.5)

---
updated-dependencies:
- dependency-name: got
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years ago
Angel 868a958e36
Update README.md
Fixed Akiyama logo
Updated copyright year
3 years ago
Jesús María 99d636fa3f Fixed the episode number in recent episodes 4 years ago
Jesús María 361d0553e9 Fixed getEpisodes 4 years ago
Jesús María 08fb60749b Fixed lastEpisodes 4 years ago

@ -1,4 +1,4 @@
# **Aruppi API** (v4.1.5) # **Aruppi API** (v4.2.2)
> 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
> >
@ -116,7 +116,7 @@ Currently the Aruppi app on Android is already using the v4.x.x API services fro
</td> </td>
<td align="center"> <td align="center">
<a href="https://github.com/Fmaldonado6/Akiyama"> <a href="https://github.com/Fmaldonado6/Akiyama">
<img src="https://raw.githubusercontent.com/Fmaldonado6/Akiyama/master/images/logo/web-logo.png" width="75px;" alt="Jeluchu"/><br /> <img src="https://raw.githubusercontent.com/Fmaldonado6/Akiyama/master/images/logo/logo.png" width="75px;" alt="Jeluchu"/><br />
<sub> <sub>
<b>Akiyama</b> <b>Akiyama</b>
</sub> </sub>
@ -156,4 +156,4 @@ There are also **people who have made contributions** and therefore it is also i
- [Jéluchu](https://github.com/Jeluchu) (Multiplatform Developer, designer, and others) - [Jéluchu](https://github.com/Jeluchu) (Multiplatform Developer, designer, and others)
- [Capitanwesler](https://github.com/capitanwesler) (Backend developer, web developer and others) - [Capitanwesler](https://github.com/capitanwesler) (Backend developer, web developer and others)
Copyright © 2021 [Jéluchu](https://about.jeluchu.com/). Copyright © 2022 [Jéluchu](https://about.jeluchu.com/).

7496
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{ {
"name": "aruppi", "name": "aruppi",
"version": "4.1.5", "version": "4.2.2",
"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.ts", "main": "./src/api/api.ts",
"scripts": { "scripts": {
@ -54,12 +54,11 @@
"compose-middleware": "^5.0.1", "compose-middleware": "^5.0.1",
"cors": "^2.8.5", "cors": "^2.8.5",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"express": "^4.17.1", "express": "^4.17.3",
"got": "^11.8.2", "got": "^11.8.5",
"helmet": "^4.5.0", "helmet": "^4.5.0",
"mongodb": "^3.6.6", "mongodb": "^3.6.6",
"mongoose": "^5.12.5", "mongoose": "^5.13.15",
"node-html-parser": "^5.1.0",
"redis": "^3.1.2", "redis": "^3.1.2",
"rss-parser": "^3.12.0", "rss-parser": "^3.12.0",
"tough-cookie": "^4.0.0", "tough-cookie": "^4.0.0",

@ -81,7 +81,7 @@ interface Movie {
export default class AnimeController { export default class AnimeController {
async schedule(req: Request, res: Response, next: NextFunction) { async schedule(req: Request, res: Response, next: NextFunction) {
const { day } = req.params; const { day } = req.params;
let data: any; let info: any;
try { try {
if (redisClient.connected) { if (redisClient.connected) {
@ -96,7 +96,7 @@ export default class AnimeController {
} }
} }
data = await requestGot(`${urls.BASE_JIKAN}schedule/${day}`, { info = await requestGot(`${urls.BASE_JIKAN}schedules?filter=${day}`, {
parse: true, parse: true,
scrapy: false, scrapy: false,
}); });
@ -104,10 +104,10 @@ export default class AnimeController {
return next(err); return next(err);
} }
const animeList: Schedule[] = data[day].map((item: Schedule) => ({ const animeList: Schedule[] = info.data.map((item: any) => ({
title: item.title, title: item.titles.find((x: { type: string; }) => x.type === "Default").title,
malid: item.mal_id, malid: item.mal_id,
image: item.image_url, image: item.images.jpg.image_url,
})); }));
if (animeList.length > 0) { if (animeList.length > 0) {
@ -119,11 +119,11 @@ export default class AnimeController {
JSON.stringify({ day: animeList }), JSON.stringify({ day: animeList }),
); );
/* After 24hrs expire the key. */ /* After 6hrs expire the key. */
redisClient.expireat( redisClient.expire(
`schedule_${hashStringMd5(day)}`, `schedule_${hashStringMd5(day)}`,
parseInt(`${+new Date() / 1000}`, 10) + 7200, + 21600,
); );
} }
@ -137,7 +137,7 @@ export default class AnimeController {
async top(req: Request, res: Response, next: NextFunction) { async top(req: Request, res: Response, next: NextFunction) {
const { type, subtype, page } = req.params; const { type, subtype, page } = req.params;
let data: any; let info: any;
try { try {
if (redisClient.connected) { if (redisClient.connected) {
@ -161,12 +161,12 @@ export default class AnimeController {
} }
if (subtype !== undefined) { if (subtype !== undefined) {
data = await requestGot( info = await requestGot(
`${urls.BASE_JIKAN}top/${type}/${page}/${subtype}`, `${urls.BASE_JIKAN}top/${type}?filter=${subtype}&page=${page}`,
{ parse: true, scrapy: false }, { parse: true, scrapy: false },
); );
} else { } else {
data = await requestGot(`${urls.BASE_JIKAN}top/${type}/${page}`, { info = await requestGot(`${urls.BASE_JIKAN}top/${type}?page=${page}`, {
parse: true, parse: true,
scrapy: false, scrapy: false,
}); });
@ -175,11 +175,12 @@ export default class AnimeController {
return next(err); return next(err);
} }
const top: Top[] = data.top.map((item: Top) => ({ const top: Top[] = info.data.map((item: any, index: number) => ({
rank: item.rank, // A little hacky way to fix null ranks
title: item.title, rank: item.rank || index + 1 + (info.pagination.current_page-1)*info.pagination.items.per_page,
title: item.titles.find((x: { type: string; }) => x.type === "Default").title,
url: item.url, url: item.url,
image_url: item.image_url, image_url: item.images.jpg.image_url,
type: type, type: type,
subtype: subtype, subtype: subtype,
page: page, page: page,
@ -229,6 +230,7 @@ export default class AnimeController {
data = await requestGot(`${urls.BASE_ANIMEFLV}api/animes/list`, { data = await requestGot(`${urls.BASE_ANIMEFLV}api/animes/list`, {
parse: true, parse: true,
scrapy: false, scrapy: false,
spoof: true,
}); });
} catch (err) { } catch (err) {
return next(err); return next(err);
@ -268,9 +270,9 @@ export default class AnimeController {
} }
} }
lastEpisodes = await requestGot(`${urls.BASE_ARUPPI_MONOSCHINOS}`, { lastEpisodes = await requestGot(`${urls.BASE_ARUPPI_MONOSCHINOS}lastest`, {
scrapy: true, scrapy: false,
parse: false, parse: true,
}); });
} catch (err) { } catch (err) {
@ -282,7 +284,7 @@ export default class AnimeController {
id: `ver/${anime.id}`, id: `ver/${anime.id}`,
title: anime.title, title: anime.title,
image: anime.image, image: anime.image,
episode: anime.episode, episode: anime.no,
}); });
} }

@ -104,7 +104,7 @@ export default class DirectoryController {
async getSeason(req: Request, res: Response, next: NextFunction) { async getSeason(req: Request, res: Response, next: NextFunction) {
const { year, type } = req.params; const { year, type } = req.params;
let data: any; let info: any;
try { try {
if (redisClient.connected) { if (redisClient.connected) {
@ -119,7 +119,7 @@ export default class DirectoryController {
} }
} }
data = await requestGot(`${urls.BASE_JIKAN}season/${year}/${type}`, { info = await requestGot(`${urls.BASE_JIKAN}seasons/${year}/${type}`, {
scrapy: false, scrapy: false,
parse: true, parse: true,
}); });
@ -127,10 +127,10 @@ export default class DirectoryController {
return next(err); return next(err);
} }
const season: TypeAnime[] = data.anime.map((item: any) => { const season: TypeAnime[] = info.data.map((item: any) => {
return { return {
title: item.title, title: item.titles.find((x: { type: string; }) => x.type === "Default").title,
image: item.image_url, image: item.images.jpg.image_url,
genres: item.genres.map((genre: any) => genre.name), genres: item.genres.map((genre: any) => genre.name),
}; };
}); });
@ -161,7 +161,7 @@ export default class DirectoryController {
} }
async allSeasons(req: Request, res: Response, next: NextFunction) { async allSeasons(req: Request, res: Response, next: NextFunction) {
let data: any; let info: any;
try { try {
if (redisClient.connected) { if (redisClient.connected) {
@ -176,7 +176,7 @@ export default class DirectoryController {
} }
} }
data = await requestGot(`${urls.BASE_JIKAN}season/archive`, { info = await requestGot(`${urls.BASE_JIKAN}seasons`, {
parse: true, parse: true,
scrapy: false, scrapy: false,
}); });
@ -184,7 +184,7 @@ export default class DirectoryController {
return next(err); return next(err);
} }
const archive: Archive[] = data.archive.map((item: any) => { const archive: Archive[] = info.data.map((item: any) => {
return { return {
year: item.year, year: item.year,
seasons: item.seasons, seasons: item.seasons,
@ -215,7 +215,7 @@ export default class DirectoryController {
} }
async laterSeasons(req: Request, res: Response, next: NextFunction) { async laterSeasons(req: Request, res: Response, next: NextFunction) {
let data: any; let info: any;
try { try {
if (redisClient.connected) { if (redisClient.connected) {
@ -230,7 +230,7 @@ export default class DirectoryController {
} }
} }
data = await requestGot(`${urls.BASE_JIKAN}season/later`, { info = await requestGot(`${urls.BASE_JIKAN}seasons/upcoming`, {
parse: true, parse: true,
scrapy: false, scrapy: false,
}); });
@ -238,10 +238,10 @@ export default class DirectoryController {
return next(err); return next(err);
} }
const future: Season[] = data.anime.map((item: any) => { const future: Season[] = info.data.map((item: any) => {
return { return {
title: item.title, title: item.titles.find((x: { type: string; }) => x.type === "Default").title,
image: item.image_url, image: item.images.jpg.image_url,
malink: item.url, malink: item.url,
}; };
}); });
@ -294,6 +294,7 @@ export default class DirectoryController {
const extraInfo: any = await animeExtraInfo(resultQuery!.mal_id); const extraInfo: any = await animeExtraInfo(resultQuery!.mal_id);
resultAnime = { resultAnime = {
//aruppi_key: hashStringMd5(title),
title: resultQuery?.title, title: resultQuery?.title,
poster: resultQuery?.poster, poster: resultQuery?.poster,
synopsis: resultQuery?.description, synopsis: resultQuery?.description,

@ -234,7 +234,7 @@ export default class UtilsController {
`${urls.BASE_QWANT}t=images&q=${encodeURIComponent( `${urls.BASE_QWANT}t=images&q=${encodeURIComponent(
title, title,
)}&count=51&locale=es_ES&safesearch=1`, )}&count=51&locale=es_ES&safesearch=1`,
{ scrapy: false, parse: true }, { scrapy: false, parse: true, spoof: true, },
); );
} catch (err) { } catch (err) {
return next(err); return next(err);
@ -243,8 +243,8 @@ export default class UtilsController {
const results: any[] = data.data.result.items.map((item: any) => { const results: any[] = data.data.result.items.map((item: any) => {
return { return {
type: item.thumb_type, type: item.thumb_type,
thumbnail: `https:${item.thumbnail}`, thumbnail: `${item.thumbnail}`,
fullsize: `https:${item.media_fullsize}`, fullsize: `${item.media_fullsize}`,
}; };
}); });
@ -637,6 +637,7 @@ export default class UtilsController {
data = await requestGot(`${urls.BASE_THEMEMOE}roulette`, { data = await requestGot(`${urls.BASE_THEMEMOE}roulette`, {
parse: true, parse: true,
scrapy: false, scrapy: false,
spoof: true,
}); });
} catch (err) { } catch (err) {
return next(err); return next(err);

@ -26,7 +26,7 @@ routes.get('/api/v4/', (req: Request, res: Response) => {
res.json({ res.json({
message: 'Aruppi /api - 🎏', message: 'Aruppi /api - 🎏',
author: 'Jéluchu', author: 'Jéluchu',
version: '4.1.5', version: '4.2.2',
credits: 'The bitch loves /apis that offers data to Aruppi App', credits: 'The bitch loves /apis that offers data to Aruppi App',
entries: [ entries: [
{ {

@ -285,6 +285,7 @@ async function redditocall(href: string) {
const resp = await requestGot(urls.REDDIT_ANIMETHEMES + href + '.json', { const resp = await requestGot(urls.REDDIT_ANIMETHEMES + href + '.json', {
parse: true, parse: true,
scrapy: false, scrapy: false,
spoof: true,
}); });
return cheerio.load(getHTML(resp.data.content_html)); return cheerio.load(getHTML(resp.data.content_html));

@ -1,28 +1,52 @@
import got from 'got'; import got from 'got';
import cheerio from 'cheerio'; import cheerio from 'cheerio';
import { CookieJar } from 'tough-cookie'; import { CookieJar } from 'tough-cookie';
// @ts-ignore
import * as got_pjson from 'got/package.json'
const pjson = require('../../package.json');
const cookieJar = new CookieJar(); const cookieJar = new CookieJar();
const aruppi_options: any = {
cookieJar,
'headers': {
'user-agent': `Aruppi-API/${pjson.version} ${got_pjson.name}/${got_pjson.version}`,
'x-client': 'aruppi-api'
},
};
interface Options { interface Options {
scrapy: boolean; scrapy?: boolean,
parse: boolean; parse?: boolean,
spoof?: boolean
} }
export const requestGot = async ( export const requestGot = async (
url: string, url: string,
options?: Options, options?: Options,
): Promise<any> => { ): Promise<any> => {
if (options !== undefined) { const got_options: any = {...got.defaults.options, ...aruppi_options}
if (options.scrapy) { if (options) {
const response = await got(url, { cookieJar }); if (options.spoof != null) {
return await cheerio.load(response.body); got_options.headers["user-agent"] = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/69.0";
} delete got_options.headers['x-client'];
if (!options.spoof)
got_options.headers['user-agent'] = got.defaults.options.headers['user-agent'];
} else if (process.env.ALPI_KEY && (new URL(url)).hostname.match(/\.jeluchu\.xyz$/)) {
got_options.headers['x-aruppi-key'] = process.env.ALPI_KEY;
}
if (options.scrapy) {
const response = await got(url, got_options);
return cheerio.load(response.body);
}
if (options.parse) { if (options.parse) {
return await got(url, { cookieJar }).json(); got_options.responseType = 'json';
const response = await got(url, got_options);
return response.body;
}
} }
} else { const response = await got.get(url, got_options);
return await got.get(url, { cookieJar }); return response;
}
}; };

@ -7,9 +7,8 @@ export default {
BASE_ANIMEFLV_JELU: 'https://aruppi.jeluchu.xyz/apis/animeflv/v1/', BASE_ANIMEFLV_JELU: 'https://aruppi.jeluchu.xyz/apis/animeflv/v1/',
BASE_YOUTUBE: 'https://aruppi.jeluchu.xyz/api/Youtube/?channelId=', BASE_YOUTUBE: 'https://aruppi.jeluchu.xyz/api/Youtube/?channelId=',
BASE_YOUTUBE_PLAYLIST: 'https://aruppi.jeluchu.xyz/api/Youtube/playlist/?playlistId=', BASE_YOUTUBE_PLAYLIST: 'https://aruppi.jeluchu.xyz/api/Youtube/playlist/?playlistId=',
BASE_JIKAN: 'https://aruppi.jeluchu.xyz/apis/jikan/v3/', BASE_JIKAN: 'https://aruppi.jeluchu.xyz/apis/jikan/v4/',
BASE_IVOOX: BASE_IVOOX: 'https://www.ivoox.com/podcast-anitakume_fg_f1660716_filtro_1.xml',
'https://www.ivoox.com/podcast-anitakume_fg_f1660716_filtro_1.xml',
BASE_KUDASAI: 'https://somoskudasai.com/feed/', BASE_KUDASAI: 'https://somoskudasai.com/feed/',
BASE_RAMENPARADOS: 'https://ramenparados.com/category/noticias/anime/feed/', BASE_RAMENPARADOS: 'https://ramenparados.com/category/noticias/anime/feed/',
BASE_CRUNCHYROLL: 'https://www.crunchyroll.com/newsrss?lang=esES', BASE_CRUNCHYROLL: 'https://www.crunchyroll.com/newsrss?lang=esES',
@ -17,7 +16,7 @@ export default {
ANIMEFLV_SEARCH: 'https://animeflv.net/browse?', ANIMEFLV_SEARCH: 'https://animeflv.net/browse?',
SEARCH_DIRECTORY: 'https://animeflv.net/browse?order=title&page=', SEARCH_DIRECTORY: 'https://animeflv.net/browse?order=title&page=',
BASE_EPISODE_IMG_URL: 'https://cdn.animeflv.net/screenshots/', BASE_EPISODE_IMG_URL: 'https://cdn.animeflv.net/screenshots/',
BASE_QWANT: 'https://api.qwant.com/search/images?', BASE_QWANT: 'https://api.qwant.com/v3/search/images?',
REDDIT_ANIMETHEMES: 'https://reddit.com/r/AnimeThemes/wiki/', REDDIT_ANIMETHEMES: 'https://reddit.com/r/AnimeThemes/wiki/',
BASE_THEMEMOE: 'https://themes.moe/api/', BASE_THEMEMOE: 'https://themes.moe/api/',
BASE_ARUPPI_MONOSCHINOS: 'https://aruppi.jeluchu.xyz/apis/monoschinos/', BASE_ARUPPI_MONOSCHINOS: 'https://aruppi.jeluchu.xyz/apis/monoschinos/',

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save