mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-17 12:18:17 +02:00
feat: add debug_catalog_images.py to analyze catalog image selectors and update task.md to reflect the new focus on catalog image fixes.
This commit is contained in:
1 parent
d2fe4bf22b
commit
7842eead4a
3 files changed
+29
-19
No files matched your search
@@ -207,11 +207,13 @@ async def scrape_catalog_pages(catalog_url: str) -> list[dict[str, Any]]:
|
||||
|
||||
all_imgs = soup.find_all('img')
|
||||
for img in all_imgs:
|
||||
src = img.get('src')
|
||||
# Check multiple attributes for the real image URL (lazy loading)
|
||||
src = img.get('data-src') or img.get('data-original') or img.get('src')
|
||||
|
||||
if not src: continue
|
||||
|
||||
# Skip common UI elements
|
||||
if any(x in src.lower() for x in ['logo', 'icon', 'facebook', 'twitter', 'instagram']):
|
||||
if any(x in src.lower() for x in ['logo', 'icon', 'facebook', 'twitter', 'instagram', 'loader']):
|
||||
continue
|
||||
|
||||
# Calculate area if dimensions exist
|
||||
@@ -226,7 +228,7 @@ async def scrape_catalog_pages(catalog_url: str) -> list[dict[str, Any]]:
|
||||
|
||||
# Heuristic: Catalog pages are usually large vertical images
|
||||
# Check src for keywords
|
||||
is_likely_catalog = any(k in src.lower() for k in ['page', 'flyer', 'catalog', 'upload', 'images', 'leaflet'])
|
||||
is_likely_catalog = any(k in src.lower() for k in ['page', 'flyer', 'catalog', 'upload', 'images', 'leaflet', 'thumbor'])
|
||||
|
||||
# Logic:
|
||||
# 1. If keyword match AND decent size -> Strong candidate
|
||||
|
||||
Reference in new issue
Block a user