diff --git a/services/torrent-search/src/torrents/providers/rarbg/index.ts b/services/torrent-search/src/torrents/providers/rarbg/index.ts index 65a3bf4..d7c3947 100644 --- a/services/torrent-search/src/torrents/providers/rarbg/index.ts +++ b/services/torrent-search/src/torrents/providers/rarbg/index.ts @@ -1,7 +1,7 @@ import { IMovieSearchInfo } from "@autoplex-api/torrent-search"; import { jsonRequest } from "../../util"; import Provider, { MediaType } from "../Provider"; -import { ISearchResult, ITokenResponse } from "./schema"; +import { ErrorCode, ISearchResult, ITokenResponse } from "./schema"; /** * The Base URL for the API @@ -57,7 +57,9 @@ export default class Rarbg extends Provider */ protected async authenticate() { let now = Date.now(); - let [status, response] = await jsonRequest(`${URL_BASE}&get_token=get_token`); + let [status, response] = await jsonRequest( + `${URL_BASE}&get_token=get_token` + ); if (status !== 200) { return false; } @@ -76,7 +78,7 @@ export default class Rarbg extends Provider + "&format=json_extended&limit=100" ); if (response.error_code !== undefined) { - if (response.error_code === 10) { + if (response.error_code === ErrorCode.ImdbNotFound) { return []; // Successful search, no results found } throw new Error("No results found"); // API most likely broke, we need to retry.