Skip to content

Commit

Permalink
code changes from mlduff
Browse files Browse the repository at this point in the history
  • Loading branch information
heathrampazis committed Apr 26, 2024
1 parent 857e575 commit 261ecc8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions recipe_scrapers/bakels.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ def cuisine(self):
return self.schema.cuisine()

def description(self):
if self.soup.find("main", class_="content").find("p"):
return self.soup.find("main", class_="content").find("p").get_text()
return "None"
description_meta = self.soup.find("meta", {"property": "og:title"})
if description_meta:
return description_meta.get("content")
return None

def category(self):
category_h4 = self.soup.find("h4", string="Category")
category_p = category_h4.find_next_sibling("p")
return category_p.text
5 changes: 3 additions & 2 deletions tests/test_data/bakels.com.au/bakels.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Australian Bakels",
"canonical_url": "https://www.bakels.com.au/recipes/donut-glaze/",
"host": "bakels.com.au",
"description": "Using Bakels Powdered Donut Glaze.",
"description": "Donut Glaze - Australian Bakels",
"image": "https://www.bakels.com.au/wp-content/uploads/sites/21/2021/11/i-QrWDhMX-X3-1.jpg",
"ingredients": [
"Boiling water (~100°C)",
Expand All @@ -25,5 +25,6 @@
],
"language": "en",
"site_name": "Australian Bakels",
"title": "Donut Glaze"
"title": "Donut Glaze",
"category": "Bakery"
}

0 comments on commit 261ecc8

Please sign in to comment.