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

added simplycookit scraper #618

Merged
merged 2 commits into from Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions recipe_scrapers/__init__.py
@@ -1,4 +1,5 @@
from __future__ import annotations

import contextlib
from typing import Any, Optional

Expand Down Expand Up @@ -166,6 +167,7 @@
from .sallysblog import SallysBlog
from .saveur import Saveur
from .seriouseats import SeriousEats
from .simplycookit import SimplyCookit
from .simplyquinoa import SimplyQuinoa
from .simplyrecipes import SimplyRecipes
from .simplywhisked import SimplyWhisked
Expand Down Expand Up @@ -389,6 +391,7 @@
SallysBlog.host(): SallysBlog,
Saveur.host(): Saveur,
SeriousEats.host(): SeriousEats,
SimplyCookit.host(): SimplyCookit,
SimplyQuinoa.host(): SimplyQuinoa,
SimplyRecipes.host(): SimplyRecipes,
SimplyWhisked.host(): SimplyWhisked,
Expand Down
50 changes: 50 additions & 0 deletions recipe_scrapers/simplycookit.py
@@ -0,0 +1,50 @@
from ._abstract import AbstractScraper
from ._utils import normalize_string


class SimplyCookit(AbstractScraper):
@classmethod
def host(cls):
return "simply-cookit.com"

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

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

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

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

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

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

def ingredients(self):
ingredients = []
for li in self.soup.find("ul", {"class": "recipe_ingredients"}).findAll("li"):
ingredients.append(normalize_string(li.get_text()))

return ingredients

def instructions(self):
instructions = []
for li in self.soup.find("ul", {"class": "recipe_steps"}).findAll("li"):
li.find("span", {"class": "number"}).clear()
vabene1111 marked this conversation as resolved.
Show resolved Hide resolved
instructions.append(li.get_text())

return "\n".join(instructions)

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

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

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