Skip to content

Commit

Permalink
Revert "Fixup: remove overwrite of schema.org data with 'mainEntity' …
Browse files Browse the repository at this point in the history
…contents during schema.org processing (#666)" (#670)

This reverts commit 557cfd9.
  • Loading branch information
jayaddison committed Oct 24, 2022
1 parent aacd321 commit 743d7cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 7 additions & 1 deletion recipe_scrapers/_schemaorg.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,21 @@ def __init__(self, page_data, raw=False):
if in_context and item_type.lower() in low_schema:
self.format = syntax
self.data = item
if item_type.lower() == "webpage":
self.data = self.data.get("mainEntity")
return
elif in_context and "@graph" in item:
for graph_item in item.get("@graph", ""):
graph_item_type = graph_item.get("@type", "")
if not isinstance(graph_item_type, str):
continue
if graph_item_type.lower() in low_schema:
in_graph = SCHEMA_ORG_HOST in graph_item.get("@context", "")
self.format = syntax
if graph_item_type.lower() == "recipe":
if graph_item_type.lower() == "webpage" and in_graph:
self.data = self.data.get("mainEntity")
return
elif graph_item_type.lower() == "recipe":
self.data = graph_item
return

Expand Down
4 changes: 0 additions & 4 deletions recipe_scrapers/sallysblog.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,3 @@ def instructions(self):
for instruction in instructions
]
)

def image(self):
image = self.soup.find("meta", {"property", "og:image"})
return image["content"] if image else None

0 comments on commit 743d7cd

Please sign in to comment.