mirror of
https://github.com/guezoloic/millesima-ai-engine.git
synced 2026-03-28 18:03:47 +00:00
fix(scraper): recherche _getproduitslist actualisé
Suite à une refont de l'UI et du backend, la structure de données JSON envoyé par la page web a été simplifié. Ancienne structure: - `"props"->"pageProps"->"initialReduxState"->"categ"->"content->"produits"` Nouvelle structure: - `"props"->"pageProps"->"produits"`
This commit is contained in:
@@ -377,13 +377,18 @@ class Scraper:
|
||||
try:
|
||||
data: dict[str, object] = self.getjsondata(subdir).getdata()
|
||||
|
||||
for element in ["initialReduxState", "categ", "content"]:
|
||||
data = cast(dict[str, object], data.get(element))
|
||||
# Changement dans la maniere du site stocke ses données.
|
||||
#
|
||||
# for element in ["initialReduxState", "categ", "content"]:
|
||||
# data = cast(dict[str, object], data.get(element))
|
||||
# print(data)
|
||||
|
||||
products: list[dict[str, Any]] = cast(
|
||||
list[dict[str, Any]], data.get("products")
|
||||
)
|
||||
|
||||
print(products)
|
||||
|
||||
return products
|
||||
|
||||
except (JSONDecodeError, HTTPError):
|
||||
|
||||
Reference in New Issue
Block a user