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));