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

Update amazingribs scraper #688

Merged
merged 2 commits into from Nov 22, 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
10 changes: 9 additions & 1 deletion recipe_scrapers/amazingribs.py
@@ -1,12 +1,20 @@
# mypy: disallow_untyped_defs=False
# mypy: allow_untyped_defs

from ._abstract import AbstractScraper
from ._utils import normalize_string


class AmazingRibs(AbstractScraper):
@classmethod
def host(cls):
return "amazingribs.com"

def author(self):
author_container = self.soup.find("p", {"class": "author-attribution"})
if author_container and author_container.find("a"):
return normalize_string(author_container.find("a").text)
return self.schema.author()

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

Expand Down
24 changes: 14 additions & 10 deletions tests/test_amazingribs.py
Expand Up @@ -11,21 +11,21 @@ def test_host(self):

def test_canonical_url(self):
self.assertEqual(
"https://amazingribs.com/tested-recipes/sausage-recipes/texas-hot-guts-smoked-sausage",
"https://amazingribs.com/tested-recipes/sausage-recipes/texas-hot-guts-smoked-sausage/",
self.harvester_class.canonical_url(),
)

def test_title(self):
self.assertEqual("Texas Hot Guts Recipe", self.harvester_class.title())

def test_author(self):
self.assertEqual(self.harvester_class.author(), "Meathead Goldwyn")
self.assertEqual(self.harvester_class.author(), "Meathead")

def test_total_time(self):
self.assertEqual(165, self.harvester_class.total_time())

def test_yields(self):
self.assertEqual("2 servings", self.harvester_class.yields())
self.assertEqual("8 servings", self.harvester_class.yields())

def test_ingredients(self):
self.assertEqual(
Expand All @@ -34,22 +34,26 @@ def test_ingredients(self):
"2 teaspoons fresh ground black pepper",
"1 tablespoon mild American paprika",
"2 teaspoons garlic powder",
"2 teaspoons Morton’s kosher salt",
"2 teaspoons Morton Coarse Kosher Salt",
"2 teaspoons rubbed sage",
"2 teaspoons cayenne, chipotle, or other hot chile powder or flakes",
"1 medium green jalapeno",
"1/2 small onion",
"1 medium green jalapeño",
"½ small onion",
"3 garlic cloves",
"20 ounces ground pork butt",
"12 ounces ground beef chuck",
"1/3 cup very cold water",
"4 pork sausage casings",
" cup very cold water",
"4 feet pork sausage casings",
],
self.harvester_class.ingredients(),
)

def test_instructions(self):
return self.assertEqual(
"Method\n\n1) Prep. Put the whole black peppercorns into a plastic bag and smash the heck outta them with a small frying pan until you have chunks of cracked peppercorns. Mix them with the rest of the black pepper, paprika, garlic powder, salt, sage, and chile powder in a small bowl. Remove the seeds and stems from the jalapeno and mince it into tiny bits. Peel the onion and garlic and mince them too. Now, go to our article on the Science of Making Sausage and follow steps (1) through (16).\n\n17) Smoke. Set up your grill or smoker and maintain a steady 225ºF. Smoke the sausages at 225°F until they hit 160°F internal temperature, about 1 to 2 hours. As long as they hit that internal temp, you can experiment with the time to get your preferred level of smoke on the sausage.\n\n18) Serve. You can serve Hot Guts nekkid on a plate with some saltine crackers and hot sauce (traditional Texas style) or with some potatoes and a salad, or on a bun, or incorporate them into a dish like German Potato Salad or Choucroute Garnie, the classic Alsatian hot dish of sauerkraut, potatoes, various charcuterie, and mustard.",
self.harvester_class.instructions(),
[
"Prep. Put the whole black peppercorns into a plastic bag and smash the heck outta them with a small frying pan until you have chunks of cracked peppercorns. Mix them with the rest of the black pepper, paprika, garlic powder, salt, sage, and chile powder in a small bowl. Remove the seeds and stems from the jalapeño and mince it into tiny bits. Peel the onion and garlic and mince them too. Now, go to our article on the Science of Making Sausage and follow steps (1) through (16).",
"Smoke. Set up your grill or smoker and maintain a steady 225°F (107.2°C). Smoke the sausages at 225°F (107.2°C) until they hit 160°F (71.1°C) internal temperature, about 1 to 2 hours. As long as they hit that internal temp, you can experiment with the time to get your preferred level of smoke on the sausage.",
"Serve. You can serve Hot Guts nekkid on a plate with some saltine crackers and hot sauce (traditional Texas style) or with some potatoes and a salad, or on a bun, or incorporate them into a dish like German Potato Salad or Choucroute Garnie, the classic Alsatian hot dish of sauerkraut, potatoes, various charcuterie, and mustard.",
],
self.harvester_class.instructions_list(),
)