Klappe Geizhals-Filtergruppen beim Lernen auf und nimm neue Kategorien ueber den Quellpfad auf.
Deploy Development / deploy (push) Successful in 1m34s
Test Suite / pytest-backend (push) Failing after 16s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-checks (push) Successful in 33s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-04 15:04:19 +02:00
1 parent 46857715df
commit 2117ca6b54
10 files changed
+203 -25

No files matched your search

+7 -4
View File
@@ -8,6 +8,7 @@ from urllib.parse import parse_qs, urlparse
from app.discovery.enums import FilterType
from app.errors import AppError
from app.settings import get_settings
from app.sources.geizhals.category_url import parse_category_key, with_extended_filters
from app.sources.geizhals.live_page import load_category_page, load_result_page
from app.sources.geizhals.result_parser import parse_result_html, with_page
from app.sources.geizhals.taxonomy_parser import parse_taxonomy_html
@@ -23,16 +24,17 @@ class GeizhalsAdapter:
settings = get_settings()
self.live = (not settings.geizhals_use_fixtures) if live is None else live
def discover_taxonomy(self, category_ref: str) -> dict[str, Any]:
def discover_taxonomy(self, category_ref: str, source_url: str | None = None) -> dict[str, Any]:
if not self.live:
return self._load(f"{category_ref}-taxonomy.json")
url = f"https://geizhals.de/?cat={category_ref}&promode=true"
url = with_extended_filters(source_url or f"https://geizhals.de/?cat={category_ref}")
category_ref = parse_category_key(url)
html, mode, status = load_category_page(
url,
category_ref=category_ref,
playwright=get_settings().geizhals_playwright,
)
payload = parse_taxonomy_html(html, category_ref=category_ref, source_url=url)
payload = parse_taxonomy_html(html, category_ref=category_ref, source_url=source_url or url)
if payload.get("blocked") or not payload.get("filters"):
raise AppError(
422,
@@ -48,7 +50,8 @@ class GeizhalsAdapter:
def build_query(self, criteria: list[dict[str, Any]], mappings: list[dict[str, Any]]) -> dict[str, Any]:
from app.discovery.urlgen import generate_search_url
category_url = f"https://geizhals.de/?cat={self._category(mappings, criteria)}"
category_url = next((str(item["category_url"]) for item in mappings if item.get("category_url")), None)
category_url = category_url or f"https://geizhals.de/?cat={self._category(mappings, criteria)}"
url, internal_only = generate_search_url(
category_url=category_url,
criteria_items=criteria,