From f8a5b1b5efaa185d3d1a8f16da618b2fe502a48f Mon Sep 17 00:00:00 2001 From: zwitschi Date: Sun, 30 Nov 2025 10:51:16 +0100 Subject: [PATCH] fix: update scrape function to handle HTML response and improve status messages --- web/static/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/static/index.js b/web/static/index.js index 2c1d207..ff1ca4b 100644 --- a/web/static/index.js +++ b/web/static/index.js @@ -41,12 +41,16 @@ function scrape(event) { event.preventDefault(); // Prevent the default form submission updateScrapeInfo("Scraping in progress...", "blue"); fetch("/scrape") - .then((response) => response.json()) + // expect HTML response containing "Scraping completed successfully!" + .then((response) => response.text()) .then((data) => { - if (data.status) { - updateScrapeInfo(data.status, "green"); + if (data.includes("Scraping completed successfully!")) { + updateScrapeInfo("Scraping completed successfully!", "green"); } else { - updateScrapeInfo("Scraping failed. Please try again.", "red"); + updateScrapeInfo( + "Scraping failed or timed out. Please try again.", + "red" + ); } }) .catch((error) => console.error("Error:", error));