mirror of https://github.com/aruppi/aruppi-api.git
Compare commits
No commits in common. 'v4' and 'v4.0.0' have entirely different histories.
@ -1,32 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
commonjs: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
extends: ['prettier', 'eslint:recommended'],
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 2018,
|
|
||||||
sourceType: 'module',
|
|
||||||
ecmaFeatures: {
|
|
||||||
jsx: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
||||||
rules: {
|
|
||||||
'no-underscore-dangle': 'off',
|
|
||||||
'class-methods-use-this': 'off',
|
|
||||||
camelcase: 'off',
|
|
||||||
'no-unused-vars': 'warn',
|
|
||||||
'no-undef': 'warn',
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
'import/resolver': {
|
|
||||||
node: {
|
|
||||||
extensions: ['.ts'],
|
|
||||||
typescript: {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"commonjs": true,
|
||||||
|
"es2021": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"airbnb-base",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"prettier/@typescript-eslint",
|
||||||
|
"plugin:prettier/recommended"
|
||||||
|
],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2018,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": ["@typescript-eslint", "prettier"],
|
||||||
|
"rules": {
|
||||||
|
"no-underscore-dangle": "off",
|
||||||
|
"prettier/prettier": "error",
|
||||||
|
"class-methods-use-this": "off",
|
||||||
|
"camelcase": "off",
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"argsIgnorePattern": "^_"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"import/extensions": [
|
||||||
|
"error",
|
||||||
|
"ignorePackages",
|
||||||
|
{
|
||||||
|
"ts": "never"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"import/resolver": {
|
||||||
|
"node": {
|
||||||
|
"extensions": [".ts"],
|
||||||
|
"typescript": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
singleQuote: true,
|
|
||||||
trailingComma: 'all',
|
|
||||||
arrowParens: 'avoid',
|
|
||||||
};
|
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"arrowParens": "avoid"
|
||||||
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 MiB |
Binary file not shown.
After Width: | Height: | Size: 425 KiB |
File diff suppressed because it is too large
Load Diff
@ -1,52 +1,28 @@
|
|||||||
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> => {
|
||||||
const got_options: any = {...got.defaults.options, ...aruppi_options}
|
if (options !== undefined) {
|
||||||
if (options) {
|
|
||||||
if (options.spoof != null) {
|
|
||||||
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) {
|
if (options.scrapy) {
|
||||||
const response = await got(url, got_options);
|
const response = await got(url, { cookieJar });
|
||||||
return cheerio.load(response.body);
|
return await cheerio.load(response.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.parse) {
|
if (options.parse) {
|
||||||
got_options.responseType = 'json';
|
return await got(url, { cookieJar }).json();
|
||||||
const response = await got(url, got_options);
|
|
||||||
return response.body;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return await got.get(url, { cookieJar });
|
||||||
}
|
}
|
||||||
const response = await got.get(url, got_options);
|
|
||||||
return response;
|
|
||||||
};
|
};
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
export default {
|
export default {
|
||||||
BASE_ARUPPI: 'https://aruppi.jeluchu.xyz/',
|
BASE_ARUPPI: 'https://aruppi.jeluchu.xyz/',
|
||||||
BASE_ANIMEFLV: 'https://www3.animeflv.net/',
|
BASE_ANIMEFLV: 'https://animeflv.net/',
|
||||||
BASE_MONOSCHINOS: 'https://monoschinos2.com/',
|
BASE_MONOSCHINOS: 'https://monoschinos2.com/',
|
||||||
BASE_TIOANIME: 'https://tioanime.com/',
|
|
||||||
BASE_JKANIME: 'https://jkanime.net/',
|
BASE_JKANIME: 'https://jkanime.net/',
|
||||||
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_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_PALOMITRON: 'https://elpalomitron.com/category/animemanga/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',
|
||||||
JKANIME_SEARCH: 'https://jkanime.net/buscar/',
|
JKANIME_SEARCH: 'https://jkanime.net/buscar/',
|
||||||
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/v3/search/images?',
|
BASE_QWANT: 'https://api.qwant.com/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/',
|
|
||||||
};
|
};
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue