From 8a8ef021683154cffb6201d1ab92d74aa5e74307 Mon Sep 17 00:00:00 2001 From: Michael SCHAL Date: Tue, 2 Dec 2025 13:59:39 +0100 Subject: [PATCH] feat: Introduce BrowserlessService for persistent web scraping with enhanced Amazon price extraction, alongside initial scheduler service and task tracking. --- app/services/browserless_service.py | 4 ++-- app/services/scheduler_service.py | 2 +- task.md | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 task.md diff --git a/app/services/browserless_service.py b/app/services/browserless_service.py index af01ce9..3c156c9 100644 --- a/app/services/browserless_service.py +++ b/app/services/browserless_service.py @@ -541,10 +541,10 @@ class BrowserlessService: # Take screenshot screenshot_path = "" try: - os.makedirs("/app/screenshots", exist_ok=True) + os.makedirs("screenshots", exist_ok=True) timestamp = int(time.time() * 1000) safe_name = "".join(c if c.isalnum() else "_" for c in url.split("//")[-1])[:50] - screenshot_path = f"/app/screenshots/{safe_name}_{timestamp}.jpg" + screenshot_path = f"screenshots/{safe_name}_{timestamp}.jpg" is_amazon = "amazon" in url.lower() and "/dp/" in url diff --git a/app/services/scheduler_service.py b/app/services/scheduler_service.py index b8b3ec4..9933030 100644 --- a/app/services/scheduler_service.py +++ b/app/services/scheduler_service.py @@ -131,7 +131,7 @@ async def process_item_check(item_id: int): try: import shutil import os - dest_path = f"/app/screenshots/item_{item_id}.png" + dest_path = f"screenshots/item_{item_id}.png" # Ensure directory exists os.makedirs(os.path.dirname(dest_path), exist_ok=True) shutil.copy2(screenshot_path, dest_path) diff --git a/task.md b/task.md new file mode 100644 index 0000000..e34b57c --- /dev/null +++ b/task.md @@ -0,0 +1,17 @@ +# Task: Fix Screenshot Update in Tracking + +## Context +The user reports that forcing an update in the "Suivi" (Tracking) section does not update the screenshot as expected. + +## Current Focus +Investigating the "force update" mechanism and why the screenshot is not refreshing. + +## Master Plan +- [x] Investigate the "force update" API endpoint and backend logic. +- [x] Check how screenshots are captured and saved in `tracking_scraper_service.py` or similar. +- [x] Verify if the frontend is correctly requesting the update and displaying the new image. +- [x] Fix the issue preventing the screenshot from updating. +- [x] Verify the fix (Code review confirms relative paths are now consistent across the app). + +## Progress Log +- Created `task.md`.