diff --git a/addon/lib/filter.js b/addon/lib/filter.js index 2b60d8a..b7f6c39 100644 --- a/addon/lib/filter.js +++ b/addon/lib/filter.js @@ -45,6 +45,16 @@ export const Providers = { label: 'NyaaSi', anime: true }, + { + key: 'tokyotosho', + label: 'TokyoTosho', + anime: true + }, + { + key: 'anidex', + label: 'AniDex', + anime: true + }, { key: 'rutor', label: 'Rutor', diff --git a/addon/lib/magnetHelper.js b/addon/lib/magnetHelper.js index 50a43d9..3732958 100644 --- a/addon/lib/magnetHelper.js +++ b/addon/lib/magnetHelper.js @@ -4,6 +4,7 @@ import { getRandomUserAgent } from './requestHelper.js'; import { getTorrent } from './repository.js'; import { Type } from './types.js'; import { extractProvider } from "./titleHelper.js"; +import { Providers } from "./filter.js"; const TRACKERS_URL = 'https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt'; const DEFAULT_TRACKERS = [ @@ -49,15 +50,12 @@ const RUSSIAN_TRACKERS = [ // thus it doesn't work on mochs. // So it's better to exclude them and try to download through DHT, // as the torrent won't start anyway. -const RUSSIAN_PROVIDERS = [ - 'Rutor', - 'Rutracker' -]; -const ANIME_PROVIDERS = [ - 'HorribleSubs', - 'NyaaSi', - 'NyaaPantsu' -]; +const RUSSIAN_PROVIDERS = Providers.options + .filter(provider => provider.foreign === '🇷🇺') + .map(provider => provider.label); +const ANIME_PROVIDERS = Providers.options + .filter(provider => provider.anime) + .map(provider => provider.label); let BEST_TRACKERS = []; let ALL_ANIME_TRACKERS = []; let ALL_RUSSIAN_TRACKERS = []; @@ -84,8 +82,7 @@ export async function initBestTrackers() { async function getBestTrackers(retry = 2) { const options = { timeout: 30000, headers: { 'User-Agent': getRandomUserAgent() } }; return axios.get(TRACKERS_URL, options) - .then(response => response.data && response.data.trim()) - .then(body => body && body.split('\n\n') || []) + .then(response => response?.data?.trim()?.split('\n\n') || []) .catch(error => { if (retry === 0) { console.log(`Failed retrieving best trackers: ${error.message}`); diff --git a/addon/moch/moch.js b/addon/moch/moch.js index 5c6b413..2171f8b 100644 --- a/addon/moch/moch.js +++ b/addon/moch/moch.js @@ -6,12 +6,10 @@ import * as alldebrid from './alldebrid.js'; import * as debridlink from './debridlink.js'; import * as offcloud from './offcloud.js'; import * as putio from './putio.js'; -import StaticResponse from './static.js'; +import StaticResponse, { isStaticUrl } from './static.js'; import { cacheWrapResolvedUrl } from '../lib/cache.js'; import { timeout } from '../lib/promises.js'; import { BadTokenError, streamFilename, AccessDeniedError, enrichMeta } from './mochHelper.js'; -import { isStaticUrl } from './static.js'; -import { toCommonError } from "./realdebrid.js"; const RESOLVE_TIMEOUT = 2 * 60 * 1000; // 2 minutes const MIN_API_KEY_SYMBOLS = 15;