Skip to content

Commit

Permalink
feat: add rosanna pansino (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
wengtad committed Oct 15, 2022
1 parent f55e235 commit e1bfb74
Show file tree
Hide file tree
Showing 5 changed files with 1,341 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.rst
Expand Up @@ -248,6 +248,7 @@ Scrapers available for:
- `https://redhousespice.com/ <https://redhousespice.com/>`_
- `https://reishunger.de/ <https://www.reishunger.de/>`_
- `https://rezeptwelt.de/ <https://rezeptwelt.de>`_
- `https://rosannapansino.com <https://rosannapansino.com>`_
- `https://sallysbakingaddiction.com <https://sallysbakingaddiction.com/>`_
- `https://sallys-blog.de <https://sallys-blog.de/>`_
- `https://www.saveur.com/ <https://www.saveur.com/>`_
Expand Down
2 changes: 2 additions & 0 deletions recipe_scrapers/__init__.py
Expand Up @@ -164,6 +164,7 @@
from .redhousespice import RedHouseSpice
from .reishunger import Reishunger
from .rezeptwelt import Rezeptwelt
from .rosannapansino import RosannaPansino
from .sallysbakingaddiction import SallysBakingAddiction
from .sallysblog import SallysBlog
from .saveur import Saveur
Expand Down Expand Up @@ -389,6 +390,7 @@
RedHouseSpice.host(): RedHouseSpice,
Reishunger.host(): Reishunger,
Rezeptwelt.host(): Rezeptwelt,
RosannaPansino.host(): RosannaPansino,
SallysBakingAddiction.host(): SallysBakingAddiction,
SallysBlog.host(): SallysBlog,
Saveur.host(): Saveur,
Expand Down
43 changes: 43 additions & 0 deletions recipe_scrapers/rosannapansino.py
@@ -0,0 +1,43 @@
# mypy: allow-untyped-defs

from ._abstract import AbstractScraper
from ._utils import normalize_string


class RosannaPansino(AbstractScraper):
@classmethod
def host(cls):
return "rosannapansino.com"

def title(self):
return self.soup.find("meta", {"property": "og:title"})["content"]

def image(self):
return self.schema.image()

def ingredients(self):
ingredients = (
self.soup.find("div", {"class": "recipe-left"})
.find_next("em", string="Ingredients")
.find_next_sibling("ul")
.find_all("li")
)
return [normalize_string(ingredient.get_text()) for ingredient in ingredients]

def instructions(self):
instructions = (
self.soup.find("div", {"class": "recipe-right"})
.find_next("ol")
.find_all("li")
)
return "\n".join(
[normalize_string(instruction.get_text()) for instruction in instructions]
)

def description(self):
descriptions = self.soup.find(
"div", {"class": "recipe-main-image-caption"}
).find_all("p")
return "\n".join(
[normalize_string(description.get_text()) for description in descriptions]
)

0 comments on commit e1bfb74

Please sign in to comment.