Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rosanna pansino #639

Merged
merged 1 commit into from Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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]
)