refactor of browser.py into object model

This commit is contained in:
2025-08-21 10:29:45 -05:00
parent b69c2be85c
commit 05cf23ad67
5 changed files with 527 additions and 529 deletions

View File

@@ -5,8 +5,9 @@ from pathlib import Path
from datetime import datetime
from flask import Blueprint, render_template, request, redirect, url_for, flash, current_app, send_file, abort
from .browser import fetch_page_artifacts
from .enrichment import enrich_url
# from .browser import fetch_page_artifacts
from .utils.browser import get_browser
from .utils.enrichment import enrich_url
from .utils.settings import get_settings
from .utils.io_helpers import get_recent_results
@@ -64,9 +65,8 @@ def analyze():
storage.mkdir(parents=True, exist_ok=True)
try:
engine = current_app.config.get("RULE_ENGINE")
result = asyncio.run(fetch_page_artifacts(url, storage))
# result = asyncio.run(fetch_page_artifacts(url, storage))
browser = get_browser()
result = asyncio.run(browser.fetch_page_artifacts(url))
current_app.logger.info(f"[+] Analysis done for {url}")
except Exception as e:
flash(f"Analysis failed: {e}", "error")