mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-11 17:29:14 +02:00
feat: add Cataloguemate.fr scraper to replace Tiendeo and utilize BrowserlessService for catalog and page scraping
This commit is contained in:
1 parent
efb161a5ef
commit
101e5f0656
1 file changed
+10
-1
@@ -229,14 +229,23 @@ async def scrape_enseigne(enseigne: Enseigne, db: Session) -> ScrapingLog:
|
||||
if not pages:
|
||||
continue
|
||||
|
||||
import hashlib
|
||||
|
||||
# ... imports ...
|
||||
|
||||
# Create catalog entry
|
||||
# Generate content hash (URL + Title + Date)
|
||||
hash_input = f"{cat_info['url']}{cat_info['title']}{datetime.now().date()}".encode('utf-8')
|
||||
content_hash = hashlib.sha256(hash_input).hexdigest()
|
||||
|
||||
new_cat = Catalogue(
|
||||
enseigne_id=enseigne.id,
|
||||
titre=cat_info['title'],
|
||||
catalogue_url=cat_info['url'],
|
||||
date_debut=datetime.now(), # Todo: extract real dates
|
||||
date_fin=datetime.now() + timedelta(days=14),
|
||||
image_couverture_url=pages[0]['image_url']
|
||||
image_couverture_url=pages[0]['image_url'],
|
||||
content_hash=content_hash
|
||||
)
|
||||
db.add(new_cat)
|
||||
db.commit()
|
||||
|
||||
Reference in new issue
Block a user