From 949791049f722f4cd93e986378813ffb7a9aea2a Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 12 Jul 2024 23:20:26 -0400 Subject: [PATCH] Nick: --- .../src/scraper/WebScraper/scrapers/fireEngine.ts | 12 +++++++++--- .../WebScraper/utils/custom/website_params.ts | 10 ++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/apps/api/src/scraper/WebScraper/scrapers/fireEngine.ts b/apps/api/src/scraper/WebScraper/scrapers/fireEngine.ts index 94d49598..30412f40 100644 --- a/apps/api/src/scraper/WebScraper/scrapers/fireEngine.ts +++ b/apps/api/src/scraper/WebScraper/scrapers/fireEngine.ts @@ -47,13 +47,18 @@ export async function scrapWithFireEngine({ const reqParams = await generateRequestParams(url); const waitParam = reqParams["params"]?.wait ?? waitFor; const screenshotParam = reqParams["params"]?.screenshot ?? screenshot; - const fireEngineOptionsParam = reqParams["params"]?.fireEngineOptions ?? fireEngineOptions; + const fireEngineOptionsParam : FireEngineOptions = reqParams["params"]?.fireEngineOptions ?? fireEngineOptions; + + let endpoint = fireEngineOptionsParam.method === "get" ? "/request" : "/scrape"; + console.log( - `[Fire-Engine] Scraping ${url} with wait: ${waitParam} and screenshot: ${screenshotParam}` + `[Fire-Engine] Scraping ${url} with wait: ${waitParam} and screenshot: ${screenshotParam} and method: ${fireEngineOptionsParam?.method ?? "null"}` ); + console.log(fireEngineOptionsParam) + const response = await axios.post( - process.env.FIRE_ENGINE_BETA_URL + "/scrape", + process.env.FIRE_ENGINE_BETA_URL + endpoint, { url: url, wait: waitParam, @@ -74,6 +79,7 @@ export async function scrapWithFireEngine({ console.error( `[Fire-Engine] Error fetching url: ${url} with status: ${response.status}` ); + logParams.error_message = response.data?.pageError; logParams.response_code = response.data?.pageStatusCode; diff --git a/apps/api/src/scraper/WebScraper/utils/custom/website_params.ts b/apps/api/src/scraper/WebScraper/utils/custom/website_params.ts index f86f085f..a1c256cc 100644 --- a/apps/api/src/scraper/WebScraper/utils/custom/website_params.ts +++ b/apps/api/src/scraper/WebScraper/utils/custom/website_params.ts @@ -192,4 +192,14 @@ export const urlSpecificParams = { "ir.veeva.com":{ defaultScraper: "fire-engine", }, + "eonhealth.com":{ + defaultScraper: "fire-engine", + params:{ + fireEngineOptions:{ + mobileProxy: true, + method: "get", + engine: "request", + }, + }, + }, };