mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
enable tokyotosho and anidex providers
This commit is contained in:
@@ -45,6 +45,16 @@ export const Providers = {
|
|||||||
label: 'NyaaSi',
|
label: 'NyaaSi',
|
||||||
anime: true
|
anime: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'tokyotosho',
|
||||||
|
label: 'TokyoTosho',
|
||||||
|
anime: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'anidex',
|
||||||
|
label: 'AniDex',
|
||||||
|
anime: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'rutor',
|
key: 'rutor',
|
||||||
label: 'Rutor',
|
label: 'Rutor',
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { getRandomUserAgent } from './requestHelper.js';
|
|||||||
import { getTorrent } from './repository.js';
|
import { getTorrent } from './repository.js';
|
||||||
import { Type } from './types.js';
|
import { Type } from './types.js';
|
||||||
import { extractProvider } from "./titleHelper.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 TRACKERS_URL = 'https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt';
|
||||||
const DEFAULT_TRACKERS = [
|
const DEFAULT_TRACKERS = [
|
||||||
@@ -49,15 +50,12 @@ const RUSSIAN_TRACKERS = [
|
|||||||
// thus it doesn't work on mochs.
|
// thus it doesn't work on mochs.
|
||||||
// So it's better to exclude them and try to download through DHT,
|
// So it's better to exclude them and try to download through DHT,
|
||||||
// as the torrent won't start anyway.
|
// as the torrent won't start anyway.
|
||||||
const RUSSIAN_PROVIDERS = [
|
const RUSSIAN_PROVIDERS = Providers.options
|
||||||
'Rutor',
|
.filter(provider => provider.foreign === '🇷🇺')
|
||||||
'Rutracker'
|
.map(provider => provider.label);
|
||||||
];
|
const ANIME_PROVIDERS = Providers.options
|
||||||
const ANIME_PROVIDERS = [
|
.filter(provider => provider.anime)
|
||||||
'HorribleSubs',
|
.map(provider => provider.label);
|
||||||
'NyaaSi',
|
|
||||||
'NyaaPantsu'
|
|
||||||
];
|
|
||||||
let BEST_TRACKERS = [];
|
let BEST_TRACKERS = [];
|
||||||
let ALL_ANIME_TRACKERS = [];
|
let ALL_ANIME_TRACKERS = [];
|
||||||
let ALL_RUSSIAN_TRACKERS = [];
|
let ALL_RUSSIAN_TRACKERS = [];
|
||||||
@@ -84,8 +82,7 @@ export async function initBestTrackers() {
|
|||||||
async function getBestTrackers(retry = 2) {
|
async function getBestTrackers(retry = 2) {
|
||||||
const options = { timeout: 30000, headers: { 'User-Agent': getRandomUserAgent() } };
|
const options = { timeout: 30000, headers: { 'User-Agent': getRandomUserAgent() } };
|
||||||
return axios.get(TRACKERS_URL, options)
|
return axios.get(TRACKERS_URL, options)
|
||||||
.then(response => response.data && response.data.trim())
|
.then(response => response?.data?.trim()?.split('\n\n') || [])
|
||||||
.then(body => body && body.split('\n\n') || [])
|
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (retry === 0) {
|
if (retry === 0) {
|
||||||
console.log(`Failed retrieving best trackers: ${error.message}`);
|
console.log(`Failed retrieving best trackers: ${error.message}`);
|
||||||
|
|||||||
@@ -6,12 +6,10 @@ import * as alldebrid from './alldebrid.js';
|
|||||||
import * as debridlink from './debridlink.js';
|
import * as debridlink from './debridlink.js';
|
||||||
import * as offcloud from './offcloud.js';
|
import * as offcloud from './offcloud.js';
|
||||||
import * as putio from './putio.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 { cacheWrapResolvedUrl } from '../lib/cache.js';
|
||||||
import { timeout } from '../lib/promises.js';
|
import { timeout } from '../lib/promises.js';
|
||||||
import { BadTokenError, streamFilename, AccessDeniedError, enrichMeta } from './mochHelper.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 RESOLVE_TIMEOUT = 2 * 60 * 1000; // 2 minutes
|
||||||
const MIN_API_KEY_SYMBOLS = 15;
|
const MIN_API_KEY_SYMBOLS = 15;
|
||||||
|
|||||||
Reference in New Issue
Block a user