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

Coverage check #1123

Merged
merged 6 commits into from
May 5, 2024
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.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
38 changes: 16 additions & 22 deletions recipe_scrapers/joshuaweissman.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,26 @@ class JoshuaWeissman(AbstractScraper):
def host(cls):
return "joshuaweissman.com"

def total_time(self):
# Get all spans and get their text
def prep_time(self):
spans = self.soup.findAll(name="span")
spans_texts = [tag.get_text().lower() for tag in spans]
# Filter out all spans that don't contain time
time_texts = [tag for tag in spans_texts if "time" in tag]

# Find first string that contains the text
def check_text(check_string):
return next(
(string for string in time_texts if check_string in string), None
)

total = check_text("total time")
if total:
total = get_minutes(total)
if total:
return total
prep = check_text("prep time")
prep = next((tag for tag in spans_texts if "prep time" in tag), None)
if prep:
prep = get_minutes(prep)
cook = check_text("cook time")
return get_minutes(prep)
return None

def cook_time(self):
spans = self.soup.findAll(name="span")
spans_texts = [tag.get_text().lower() for tag in spans]
cook = next((tag for tag in spans_texts if "cook time" in tag), None)
if cook:
cook = get_minutes(cook)
if prep + cook:
return prep + cook
return get_minutes(cook)
return None

def total_time(self):
total = self.prep_time() or 0
total += self.cook_time() or 0
return total if total > 0 else None

def yields(self):
spans = self.soup.findAll(name="span")
Expand Down
3 changes: 3 additions & 0 deletions recipe_scrapers/usapears.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ def ingredients(self):
normalize_string(paragraph.get_text().strip())
for paragraph in ingredient_elements
]

def ratings(self):
return None
5 changes: 4 additions & 1 deletion tests/test_data/750g.com/g750g.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@
"keywords": [
"salade de carottes",
"salade de carottes cuites"
]
],
"description": "La petite salade détox parfaite pour un déjeuner vitaminé au coeur de l'hiver",
"cook_time": 15,
"prep_time": 20
}
21 changes: 20 additions & 1 deletion tests/test_data/aberlehome.com/aberlehome.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,24 @@
"sourdough croissant",
"homemade croissants",
"sourdough croissants no yeast"
]
],
"category": "Sourdough Recipes",
"cook_time": 15,
"prep_time": 60,
"cuisine": "French",
"nutrients": {
"calories": "288 calories",
"carbohydrateContent": "52 grams carbohydrates",
"cholesterolContent": "29 milligrams cholesterol",
"fatContent": "5 grams fat",
"fiberContent": "2 grams fiber",
"proteinContent": "9 grams protein",
"saturatedFatContent": "2 grams saturated fat",
"servingSize": "1",
"sodiumContent": "436 milligrams sodium",
"sugarContent": "6 grams sugar",
"transFatContent": "0 grams trans fat",
"unsaturatedFatContent": "2 grams unsaturated fat"
},
"ratings": 4.8
}
4 changes: 3 additions & 1 deletion tests/test_data/abuelascounter.com/abuelascounter_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,7 @@
"yields": "6 servings",
"keywords": [
"abuela's"
]
],
"cook_time": 90,
"prep_time": 15
}
4 changes: 3 additions & 1 deletion tests/test_data/abuelascounter.com/abuelascounter_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,7 @@
"yields": "10 servings",
"keywords": [
"abuelau0026#039;s"
]
],
"cook_time": 30,
"prep_time": 15
}
6 changes: 5 additions & 1 deletion tests/test_data/acouplecooks.com/acouplecooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,9 @@
"cooking_method": "Stovetop",
"keywords": [
"Garlic Butter Shrimp"
]
],
"cook_time": 3,
"description": "This garlic butter shrimp has HUGE flavor in under 10 minutes! A fast and easy dinner for weeknights or entertaining, it will become your go-to.",
"cuisine": "Shrimp",
"prep_time": 5
}
4 changes: 3 additions & 1 deletion tests/test_data/addapinch.com/addapinch_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,7 @@
"easy chocolate cake",
"egg free chocolate cake",
"gluten-free chocolate cake"
]
],
"cook_time": 30,
"prep_time": 15
}
4 changes: 3 additions & 1 deletion tests/test_data/addapinch.com/addapinch_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,7 @@
],
"keywords": [
"citrus scones"
]
],
"cook_time": 20,
"prep_time": 10
}
4 changes: 3 additions & 1 deletion tests/test_data/akispetretzikis.com/akispetretzikis.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,7 @@
"yields": "10 servings",
"keywords": [
"Lemon"
]
],
"cook_time": 25,
"prep_time": 15
}
17 changes: 16 additions & 1 deletion tests/test_data/alittlebityummy.com/alittlebityummy_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,20 @@
"title": "Low FODMAP Creamy Ham and Potato Soup",
"category": "christmas, lunch, dinner",
"total_time": 2400,
"yields": "4 servings"
"yields": "4 servings",
"cook_time": 1800,
"prep_time": 600,
"keywords": [
"gluten free",
"low fodmap",
"dairy free",
"egg free",
"nut free",
"soup",
"family classics",
"pork",
"christmas",
"lunch",
"dinner"
]
}
5 changes: 4 additions & 1 deletion tests/test_data/alltommat.se/alltomat_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,8 @@
"yields": "12 servings",
"keywords": [
"sections/recept"
]
],
"cook_time": 135,
"description": "Recept på briochehamburgerbröd. Perfekta hamburgerbröd som är lätt söta och fluffiga. Inkråmet är mjukt och luftigt och tar upp smakerna från en saftig ­ham­burgare bra.",
"prep_time": 20
}
3 changes: 2 additions & 1 deletion tests/test_data/alltommat.se/alltomat_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,6 @@
"yields": "4 servings",
"keywords": [
"sections/recept"
]
],
"description": "Recept på köttbullar med potatismos. Klassisk husmanskost när den är som allra bäst. Blir det köttbullar över är det goda att ha kalla på en macka. Vill du äta vegetariskt byts nötfärsen ut mot fryst och tinad, formbar vegofärs och kalvfonden mot koncentrerad grönsaksfond."
}
3 changes: 2 additions & 1 deletion tests/test_data/altonbrown.com/altonbrown_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@
"Baking",
"Desserts",
"Entertaining"
]
],
"prep_time": 120
}
4 changes: 3 additions & 1 deletion tests/test_data/altonbrown.com/altonbrown_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,7 @@
"Grill",
"Pork",
"skewer"
]
],
"cook_time": 10,
"prep_time": 30
}
6 changes: 5 additions & 1 deletion tests/test_data/amazingribs.com/amazingribs_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,9 @@
"brisket sausage",
"sausage",
"smoked sausage"
]
],
"cook_time": 120,
"description": "In the Lone Star state, smoked sausage is as central to barbecue as brisket. There is no standard recipe, but natural casing (the guts) always hold the ground meat mixture. My favorite blend leans more on pork than beef and includes lots of black pepper. IMPORTANT: Before you get started, read our article on The Science of Sausage Making.",
"cuisine": "American",
"prep_time": 45
}
6 changes: 5 additions & 1 deletion tests/test_data/amazingribs.com/amazingribs_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,9 @@
"brisket burnt ends",
"burnt ends",
"burnt ends recipe"
]
],
"cook_time": 600,
"description": "Make mouthwatering smoked burnt end nuggets with this easy-to-follow recipe.",
"cuisine": "American",
"prep_time": 10
}
5 changes: 4 additions & 1 deletion tests/test_data/ambitiouskitchen.com/ambitiouskitchen.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,8 @@
"yields": "12 servings",
"keywords": [
"pumpkin lasagna"
]
],
"cook_time": 40,
"description": "Incredible vegetarian spinach pumpkin lasagna with layers of melty cheese and pumpkin flavors. This healthy pumpkin lasagna recipe has a full bag of spinach for extra veggies and makes the best freezer-friendly dinner!",
"prep_time": 30
}
9 changes: 8 additions & 1 deletion tests/test_data/archanaskitchen.com/archanaskitchen_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,12 @@
"site_name": "Archana's Kitchen",
"title": "Roasted Peppers And Mushroom Tortilla Pizza Recipe",
"total_time": 30,
"yields": "2 items"
"yields": "2 items",
"cook_time": 15,
"description": "Tortilla Pizza is a quicker version pizza to satisfy your cravings. It is a very quick and easy recipe for days that you do not feel like cooking a full fledged meal. With the preference of toppings of your choice this pizza recipe is definitely a winner at any home. The toppings used in this Roasted Peppers And Mushroom Tortilla Pizza has some roasted peppers, mushroom with loaded cheese and marinara sauce. Enjoy this easy recipe with your favorite toppings. This is a great recipe, if you are looking for an Indian/Fusion Pizza or a Homemade Pizza recipe. Serve Roasted Peppers And Mushroom Tortilla Pizza along with One Pot Tex-Mex Penne Pasta and Fennel Infused Mango Sorbet for a weekend night dinner. If you like this recipe, you can also try other Pizza recipes for your weekend dinner: Tortilla Pizza Recipe Egg and Spinach Breakfast Pizza Recipe Pan Pizza Recipe From Scratch",
"cuisine": "Mexican",
"prep_time": 15,
"keywords": [
"Dinner"
]
}
8 changes: 7 additions & 1 deletion tests/test_data/archanaskitchen.com/archanaskitchen_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,11 @@
"site_name": "Archana's Kitchen",
"title": "Classic Greek salad Recipe",
"total_time": 30,
"yields": "4 items"
"yields": "4 items",
"description": "Classic Greek salad Recipe is a must try salad if you love vegetables. The salad is a simple assortment of fresh and crunchy vegetables and lettuce which is tossed in a tangy and citrus dressing. The salad is then sprinkled with a light and creamy feta cheese in order to balance the flavor. Olives are also one of the key ingredient in Greek Cooking. Olives are added as a whole in the salad or it can also be halved. Normally this salad is considered as a breakfast or lunch dish for Greek Farmers were they always consume fresh in what they grow. Serve the Classic Greek salad Recipe as a Party Appetizer followed by a Vegan Moussaka to relish a Greek Meal. If you are looking for Greek dishes here are some : Greek Style Briami Recipe (Simple Vegetable Stew Recipe) Greek Style Grilled Pita Pizza Recipe Greek Style Vegan Moussaka Recipe",
"cuisine": "Greek",
"prep_time": 30,
"keywords": [
"Appetizer"
]
}
4 changes: 3 additions & 1 deletion tests/test_data/argiro.gr/argiro.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,7 @@
"Κατσαρόλα",
"Λαβίδα",
"Μαχαίρι"
]
],
"cook_time": 30,
"prep_time": 10
}
5 changes: 4 additions & 1 deletion tests/test_data/atelierdeschefs.fr/atelierdeschefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@
"site_name": "https://www.atelierdeschefs.fr",
"title": "Crêpe savoyarde",
"total_time": 30,
"yields": "6 Servings"
"yields": "6 Servings",
"cook_time": 20,
"description": "Une crêpe aux saveurs de la Savoie : des pommes de terre, du lard, de la crème et du fromage à raclette.",
"prep_time": 10
}
6 changes: 5 additions & 1 deletion tests/test_data/averiecooks.com/averiecooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,9 @@
"watermelon and cucumber salad",
"watermelon salad balsamic",
"watermelon arugula salad"
]
],
"cook_time": 15,
"description": "An EASY, healthy, and light salad with watermelon, cucumber, arugula, goat cheese, candied nuts, and drizzled with a homemade balsamic glaze!! A PERFECT summer salad for those days when it's too hot to cook!!",
"cuisine": "American",
"prep_time": 5
}
4 changes: 3 additions & 1 deletion tests/test_data/baking-sense.com/bakingsense_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,7 @@
"keywords": [
"buttermilk",
"sourdough"
]
],
"cook_time": 40,
"prep_time": 20
}
4 changes: 3 additions & 1 deletion tests/test_data/baking-sense.com/bakingsense_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,7 @@
"chocolate cake",
"mousse",
"strawberry cake"
]
],
"cook_time": 30,
"prep_time": 120
}
4 changes: 3 additions & 1 deletion tests/test_data/bakingmischief.com/bakingmischief_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,7 @@
"yields": "4 servings",
"keywords": [
"Barbacoa Burrito Bowl"
]
],
"cook_time": 160,
"prep_time": 30
}
4 changes: 3 additions & 1 deletion tests/test_data/bakingmischief.com/bakingmischief_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,7 @@
"keywords": [
"Mini Carrot Cake",
"Small Carrot Cake"
]
],
"cook_time": 25,
"prep_time": 20
}
3 changes: 2 additions & 1 deletion tests/test_data/barefootcontessa.com/barefootcontessa_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@
"language": "en",
"site_name": "Barefoot Contessa",
"title": "Roasted Vegetable Lasagna | Recipes",
"yields": "10 servings"
"yields": "10 servings",
"description": "Roasted Vegetable Lasagna from Barefoot Contessa. Preheat the oven to 375 degrees. Arrange the eggplant and zucchini in single layers on 3 sheet pans lined with parchment paper. Brush them generously with the olive oil on both sides, using all of the oil. Sprinkle with the oregano (I crush it in my hands), 1 tablespoon salt, and 1½ teaspoons pepper. Roast for 25 minutes, sprinkle the garlic evenly on the vegetables, and roast for another 5 minutes, until the vegetables are cooked through. Remove from the oven and lower the temperature to 350 degrees. Meanwhile, fill a very large bowl with the hottest tap water and add enough boiling water to bring the temperature to 140 degrees. One at a time, place the noodles in the water and soak them for 15 -minutes, swirling occasionally so they don’t stick together. Drain and slide the noodles around again. Combine the ricotta, goat cheese, eggs, basil, ½ cup of the Parmesan, 1½ teaspoons salt, and ¾ teaspoon pepper in the bowl of an electric mixer fitted with the paddle attachment and mix on low speed. Spread 1 cup of the marinara in a 9 × 13 × 2-inch baking dish. Arrange a third of the vegetables on top, then a layer of the noodles (cut to fit), a third of the mozzarella, and a third of the ricotta mixture in large dollops between the mozzarella. Repeat twice, starting with the marinara. Spread the last 1½ cups of marinara on top and sprinkle with the remaining ½ cup of Parmesan. Place the dish on a sheet pan lined with parchment paper and bake for 60 to 70 minutes, until the lasagna is browned and bubbly. Allow to rest for 10 minutes and serve hot."
}
3 changes: 2 additions & 1 deletion tests/test_data/barefootcontessa.com/barefootcontessa_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
"language": "en",
"site_name": "Barefoot Contessa",
"title": "Parmesan Chicken | Recipes",
"yields": "6 servings"
"yields": "6 servings",
"description": "Parmesan Chicken from Barefoot Contessa. Pound the chicken breasts until they are ¼-inch thick. You can use either a meat mallet or a rolling pin. Combine the flour, 2 teaspoons salt, and 1 teaspoon pepper on a dinner plate. Beat the eggs with 1 tablespoon of water in a large shallow bowl. On a second dinner plate, combine the bread crumbs and the ½ cup grated Parmesan cheese. Coat the chicken breasts on both sides with the flour mixture, dusting off the excess, then dip both sides into the egg mixture and finally dredge both sides in the breadcrumb mixture, pressing lightly. Heat 1 tablespoon of butter and 1 tablespoon of olive oil in a large (12-inch) sauté pan over medium-low heat and cook 2 chicken breasts at a time for 2 to 3 minutes on each side, until just cooked through. Remove the cooked chicken to a plate (or keep warm in the oven; see below). Add more butter and oil and cook the rest of the chicken breasts. Toss the salad greens with the lemon vinaigrette. Place each chicken breast on a plate and pile mound of salad on top. Serve hot with shaved or grated Parmesan on top. Notes: You can pound the meat between two sheets of wax paper, plastic wrap, or directly on a board. To keep the cooked chicken breasts warm, place on a sheet pan in a 200-degree oven for up to 15 minutes."
}
5 changes: 4 additions & 1 deletion tests/test_data/bbc.com/bbcfood.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,8 @@
"site_name": "BBC Food",
"title": "Irish cream and chocolate cheesecake",
"total_time": 130,
"yields": "1 item"
"yields": "1 item",
"description": "The smooth, creamy liqueur gives this celebration cheesecake the wow factor. Top with grated chocolate and a dusting of cocoa.",
"cook_time": 10,
"prep_time": 120
}
4 changes: 3 additions & 1 deletion tests/test_data/bbcgoodfood.com/bbcgoodfood.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,7 @@
"Midweek meals",
"Quick",
"Spaghetti"
]
],
"cook_time": 20,
"prep_time": 10
}
5 changes: 4 additions & 1 deletion tests/test_data/bbcgoodfood.com/bbcgoodfood_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,8 @@
"Sweet recipes",
"Sweets",
"Vanilla extract"
]
],
"cook_time": 20,
"cuisine": "British",
"prep_time": 15
}
6 changes: 5 additions & 1 deletion tests/test_data/bestrecipes.com.au/bestrecipes.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,9 @@
"winter",
"worcestershire sauce",
"budget club"
]
],
"category": "dinner, lunch, main",
"cuisine": "australian",
"ratings": 4.8,
"ratings_count": 2
}
4 changes: 3 additions & 1 deletion tests/test_data/bettybossi.ch/bettybossi.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,7 @@
"farine",
"myrtilles surgelées",
"jus de citron"
]
],
"cook_time": 50,
"prep_time": 40
}
Loading
Loading