Ensuring USE_DB_AUTHENTICATION is true in single URL scraper.

This commit is contained in:
Kevin Swiber 2024-08-09 15:29:18 -07:00
parent 5a778f2c22
commit ba2af74adf
No known key found for this signature in database
GPG Key ID: D31500F61C91A451

View File

@ -23,11 +23,13 @@ import { clientSideError } from "../../strings";
dotenv.config();
const useDatabaseAuth = process.env.USE_DB_AUTHENTICATION === "true";
export const baseScrapers = [
"fire-engine",
"fire-engine;chrome-cdp",
"scrapingBee",
process.env.USE_DB_AUTHENTICATION ? undefined : "playwright",
useDatabaseAuth ? undefined : "playwright",
"scrapingBeeLoad",
"fetch",
].filter(Boolean);
@ -85,10 +87,10 @@ function getScrapingFallbackOrder(
});
let defaultOrder = [
!process.env.USE_DB_AUTHENTICATION ? undefined : "fire-engine",
!process.env.USE_DB_AUTHENTICATION ? undefined : "fire-engine;chrome-cdp",
!useDatabaseAuth ? undefined : "fire-engine",
!useDatabaseAuth ? undefined : "fire-engine;chrome-cdp",
"scrapingBee",
process.env.USE_DB_AUTHENTICATION ? undefined : "playwright",
useDatabaseAuth ? undefined : "playwright",
"scrapingBeeLoad",
"fetch",
].filter(Boolean);
@ -96,7 +98,7 @@ function getScrapingFallbackOrder(
if (isWaitPresent || isScreenshotPresent || isHeadersPresent) {
defaultOrder = [
"fire-engine",
process.env.USE_DB_AUTHENTICATION ? undefined : "playwright",
useDatabaseAuth ? undefined : "playwright",
...defaultOrder.filter(
(scraper) => scraper !== "fire-engine" && scraper !== "playwright"
),