mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-12 09:49:39 +02:00
Merge pull request #178 from R0m1k3/antigravity
feat: Implement new search service with comprehensive configuration f…
This commit is contained in:
2 files changed
+17
-15
No files matched your search
@@ -120,9 +120,9 @@ SITE_CONFIGS = {
|
||||
"fnac.com": {
|
||||
"name": "Fnac",
|
||||
"search_url": "https://www.fnac.com/SearchResult/ResultList.aspx?Search={query}",
|
||||
"product_selector": "a.Article-title[href*='/a']",
|
||||
"product_image_selector": "img.Article-itemVisual, img[data-src], img[src*='product'], picture img",
|
||||
"wait_selector": ".Article-item, .Article-list",
|
||||
"product_selector": "a[href*='/a'], a.Article-title, article a",
|
||||
"product_image_selector": "img, picture source",
|
||||
"wait_selector": ".Article-item",
|
||||
"category": "Culture & Tech",
|
||||
"requires_proxy": False,
|
||||
},
|
||||
@@ -158,9 +158,9 @@ SITE_CONFIGS = {
|
||||
"e-leclerc.com": {
|
||||
"name": "E.Leclerc",
|
||||
"search_url": "https://www.e-leclerc.com/recherche?text={query}",
|
||||
"product_selector": "a[data-testid='product-link'], a[href*='/cat/'][href*='/sku/']",
|
||||
"product_image_selector": "img[data-testid='product-image'], img[src*='scene7'], img[loading='eager']",
|
||||
"wait_selector": "[data-testid='product-card'], [data-testid='product-link']",
|
||||
"product_selector": "a[href*='/cat'], a[href*='/produit'], article a, div[class*='product'] a",
|
||||
"product_image_selector": "img, picture source",
|
||||
"wait_selector": None,
|
||||
"category": "Grande Surface",
|
||||
"requires_proxy": False,
|
||||
},
|
||||
@@ -176,9 +176,9 @@ SITE_CONFIGS = {
|
||||
"carrefour.fr": {
|
||||
"name": "Carrefour",
|
||||
"search_url": "https://www.carrefour.fr/s?q={query}",
|
||||
"product_selector": "a[data-testid='product-card-link'], a.product-card__link",
|
||||
"product_image_selector": "img[data-testid='product-card-image'], img[fetchpriority], img.ds-product-image__img",
|
||||
"wait_selector": "[data-testid='product-card'], article[data-testid]",
|
||||
"product_selector": "a[href*='/p/'], a[href*='/produit'], article a, div[class*='product'] a",
|
||||
"product_image_selector": "img, picture source",
|
||||
"wait_selector": None,
|
||||
"category": "Grande Surface",
|
||||
"requires_proxy": False,
|
||||
},
|
||||
|
||||
@@ -314,16 +314,18 @@ class ImprovedSearchService:
|
||||
if not title or len(title) < 3:
|
||||
continue
|
||||
|
||||
# STRICT FILTERING: Check if all query words are in the title
|
||||
# RELAXED FILTERING: Check if at least ONE query word is in the title
|
||||
# (instead of ALL words, which was too strict)
|
||||
title_lower = title.lower()
|
||||
if query_words:
|
||||
all_words_found = True
|
||||
at_least_one_word_found = False
|
||||
for word in query_words:
|
||||
if word not in title_lower:
|
||||
all_words_found = False
|
||||
if word in title_lower:
|
||||
at_least_one_word_found = True
|
||||
break
|
||||
|
||||
if not all_words_found:
|
||||
|
||||
# Only keep results with at least one matching word
|
||||
if not at_least_one_word_found:
|
||||
continue
|
||||
|
||||
# Extract Image URL - PRIORITIZE CONFIGURED SELECTOR
|
||||
|
||||
Reference in new issue
Block a user