mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-01-11 22:40:22 +00:00
return auth blocked error for ad
This commit is contained in:
parent
029f956563
commit
a2c126e072
3 changed files with 13 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ import { Type } from '../lib/types.js';
|
|||
import { isVideo, isArchive } from '../lib/extension.js';
|
||||
import StaticResponse from './static.js';
|
||||
import { getMagnetLink } from '../lib/magnetHelper.js';
|
||||
import { BadTokenError, AccessDeniedError, sameFilename, streamFilename } from './mochHelper.js';
|
||||
import { BadTokenError, AccessDeniedError, sameFilename, streamFilename, AccessBlockedError } from './mochHelper.js';
|
||||
|
||||
const KEY = 'alldebrid';
|
||||
const AGENT = 'torrentio';
|
||||
|
|
@ -167,6 +167,9 @@ export function toCommonError(error) {
|
|||
if (error && error.code === 'AUTH_USER_BANNED') {
|
||||
return AccessDeniedError;
|
||||
}
|
||||
if (error && error.code === 'AUTH_BLOCKED') {
|
||||
return AccessBlockedError;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import * as putio from './putio.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 { BadTokenError, streamFilename, AccessDeniedError, enrichMeta, AccessBlockedError } from './mochHelper.js';
|
||||
import { createNamedQueue } from "../lib/namedQueue.js";
|
||||
|
||||
const RESOLVE_TIMEOUT = 2 * 60 * 1000; // 2 minutes
|
||||
|
|
@ -232,5 +232,12 @@ function errorStreamResponse(mochKey, error, config) {
|
|||
url: `${config.host}/${StaticResponse.FAILED_ACCESS}`
|
||||
};
|
||||
}
|
||||
if (error === AccessBlockedError) {
|
||||
return {
|
||||
name: `Torrentio\n${MochOptions[mochKey].shortName} error`,
|
||||
title: `Access to ${MochOptions[mochKey].name} is blocked!\nCheck you account or email.`,
|
||||
url: `${config.host}/${StaticResponse.FAILED_ACCESS}`
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import * as repository from '../lib/repository.js';
|
|||
const METAHUB_URL = 'https://images.metahub.space'
|
||||
export const BadTokenError = { code: 'BAD_TOKEN' }
|
||||
export const AccessDeniedError = { code: 'ACCESS_DENIED' }
|
||||
export const AccessBlockedError = { code: 'ACCESS_BLOCKED' }
|
||||
|
||||
export function chunkArray(arr, size) {
|
||||
return arr.length > size
|
||||
|
|
|
|||
Loading…
Reference in a new issue