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

Adds support for krollskorner #1279

Merged
merged 3 commits into from
Oct 22, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ Scrapers available for:
- `https://kochbucher.com/ <https://kochbucher.com/>`_
- `http://koket.se/ <http://koket.se>`_
- `https://kristineskitchenblog.com/ <https://kristineskitchenblog.com>`_
- `https://krollskorner.com/ <https://krollskorner.com/>`_
- `https://kuchnia-domowa.pl/ <https://www.kuchnia-domowa.pl/>`_
- `https://kuchynalidla.sk/ <https://www.kuchynalidla.sk/>`_
- `https://www.kwestiasmaku.com/ <https://www.kwestiasmaku.com/>`_
Expand Down
2 changes: 2 additions & 0 deletions recipe_scrapers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
from .kochbucher import Kochbucher
from .koket import Koket
from .kristineskitchenblog import KristinesKitchenBlog
from .krollskorner import KrollsKorner
from .kuchniadomowa import KuchniaDomowa
from .kuchynalidla import KuchynaLidla
from .kwestiasmaku import KwestiaSmaku
Expand Down Expand Up @@ -496,6 +497,7 @@
KitchenAidAustralia.host(): KitchenAidAustralia,
KitchenDreaming.host(): KitchenDreaming,
KristinesKitchenBlog.host(): KristinesKitchenBlog,
KrollsKorner.host(): KrollsKorner,
KuchynaLidla.host(): KuchynaLidla,
LittleSunnyKitchen.host(): LittleSunnyKitchen,
LeitesCulinaria.host(): LeitesCulinaria,
Expand Down
35 changes: 35 additions & 0 deletions recipe_scrapers/krollskorner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from ._abstract import AbstractScraper
from ._grouping_utils import group_ingredients
from ._utils import get_equipment


class KrollsKorner(AbstractScraper):
@classmethod
def host(cls):
return "krollskorner.com"

def author(self):
author_tag = self.soup.select_one(
".wprm-recipe-details.wprm-recipe-author.wprm-block-text-normal a"
)
return author_tag.get_text(strip=True)

def ingredient_groups(self):
return group_ingredients(
self.ingredients(),
self.soup,
".wprm-recipe-ingredient-group h4",
".wprm-recipe-ingredient",
)

def equipment(self):
equipment_container = self.soup.select_one(".wprm-recipe-equipment-container")
if not equipment_container:
return None

equipment_items = [
item.select_one(".wprm-recipe-equipment-name").get_text(strip=True)
for item in equipment_container.select(".wprm-recipe-equipment-item")
if item.select_one(".wprm-recipe-equipment-name")
]
return get_equipment(equipment_items)
jknndy marked this conversation as resolved.
Show resolved Hide resolved
48 changes: 48 additions & 0 deletions tests/test_data/krollskorner.com/krollskorner_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"author": "Tawnie Graham of Kroll’s Korner",
"canonical_url": "https://krollskorner.com/dietary/vegetarian/kung-pao-pasta/",
"site_name": "Kroll's Korner",
"host": "krollskorner.com",
"language": "en-US",
"title": "Spicy Sesame Noodles",
"ingredients": [
"1 pound spaghetti (or egg noodles, ramen noodles, etc. )",
"1/2 cup sesame oil",
"1/3 cup avocado oil or canola oil",
"2 tsp. red pepper chili flakes",
"1/2 cup soy sauce",
"1/3 heaping cup honey",
"2 Tbsp. chili garlic sauce (or your favorite chili crunch)",
"2 tsp. rice vinegar",
"1 Tbsp. cornstarch + 1 Tbsp. water (optional )",
"3/4 cup unsalted roasted peanuts, chopped",
"1/2 cup fresh cilantro, chopped",
"1/2 cup green onions, chopped",
"2 Tbsp. toasted sesame seeds"
],
"instructions_list": [
"Cook spaghetti, or noodle of choice. Drain and set aside in a large bowl.",
"Add sesame oil, avocado oil, and red pepper chili flakes to a saucepan over medium heat. Cook for just a few minutes or until the chili flakes begin to pop. The longer the chili flakes pop, the spicer the noodles will be.",
"Turn the heat down to low and add the soy sauce, honey, chili garlic sauce, and rice vinegar. Stir and bring the sauce to a simmer.",
"Optional to thicken the sauce add in cornstarch slurry: Start with 1 Tbsp. cornstarch mixed with 1 Tbsp. water and whisk into sauce. You will notice the consistency change. If you want it thicker, add more cornstarch slurry. I don't like my sauce very thick (but that's up to you!)",
"Combine the cooked noodles with the sauce.",
"Add in the peanuts, cilantro, green onions, and sesame seeds. Toss to combine. Garnish with more sesame seeds and green onions. Taste and adjust any seasonings to taste. Enjoy warm or chilled!"
],
"category": "Side Dish",
"yields": "8 servings",
"description": "These Spicy Sesame Noodles feature the nutty depth of flavor from the toasted sesame oil and a savory umami punch from the soy sauce. The chili garlic sauce and red pepper chili flakes add the fiery spice, balanced by the sweetness of honey and a little rice vinegar for a tangy finish. The cilantro and green onions add freshness and vibrancy and the peanuts add texture and crunch. Serve it cold or warm, you can't go wrong with these noodles; perfect for a main meal or side dish!",
"total_time": 30,
"cook_time": 10,
"prep_time": 20,
"ratings": 4.41,
"ratings_count": 5,
"nutrients": {
"servingSize": "1 serving",
"calories": "432 kcal",
"fatContent": "22 g",
"carbohydrateContent": "48 g",
"proteinContent": "13 g",
"fiberContent": "5 g"
},
"image": "https://krollskorner.com/wp-content/uploads/2019/06/sesamenoodlesupdate_20-1-of-1.jpg"
}
3,574 changes: 3,574 additions & 0 deletions tests/test_data/krollskorner.com/krollskorner_1.testhtml

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions tests/test_data/krollskorner.com/krollskorner_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"author": "Tawnie Graham of Kroll’s Korner",
"canonical_url": "https://krollskorner.com/recipes/dinner/chopped-chicken-salad/",
"site_name": "Kroll's Korner",
"host": "krollskorner.com",
"language": "en-US",
"title": "Chopped Chicken Salad with Sesame Dressing",
"ingredients": [
"2 cups shredded romaine lettuce",
"2 cups shredded Napa cabbage",
"2 cups shredded red cabbage",
"2 large carrots, julienned (about 1 cup) or you can use the pre shredded carrots",
"1 cup shelled edamame",
"3 cups shredded chicken (~1 1/2 lbs. chicken)",
"3.5 oz. bag crunchy wonton strips or crunchy chow mein noodles",
"1 cup mandarin orange slices, drained",
"1 bunch scallions, chopped (~1/2 cup)",
"1/2 cup sliced almonds",
"1/4 cup grapeseed oil (or canola oil or any other neutral flavored oil)",
"2 Tbsp. sesame oil",
"2 Tbsp. rice wine vinegar",
"2 Tbsp. soy sauce",
"1 Tbsp. brown sugar",
"1 tsp. ginger, minced",
"1 tsp. garlic, minced or pressed thru a garlic press",
"1 tsp. chili garlic sauce",
"1/4 tsp. salt & pepper, or to taste"
],
"ingredient_groups": [
{
"ingredients": [
"2 cups shredded romaine lettuce",
"2 cups shredded Napa cabbage",
"2 cups shredded red cabbage",
"2 large carrots, julienned (about 1 cup) or you can use the pre shredded carrots",
"1 cup shelled edamame",
"3 cups shredded chicken (~1 1/2 lbs. chicken)",
"3.5 oz. bag crunchy wonton strips or crunchy chow mein noodles",
"1 cup mandarin orange slices, drained",
"1 bunch scallions, chopped (~1/2 cup)",
"1/2 cup sliced almonds"
],
"purpose": "For the salad"
},
{
"ingredients": [
"1/4 cup grapeseed oil (or canola oil or any other neutral flavored oil)",
"2 Tbsp. sesame oil",
"2 Tbsp. rice wine vinegar",
"2 Tbsp. soy sauce",
"1 Tbsp. brown sugar",
"1 tsp. ginger, minced",
"1 tsp. garlic, minced or pressed thru a garlic press",
"1 tsp. chili garlic sauce",
"1/4 tsp. salt & pepper, or to taste"
],
"purpose": "For the dressing"
}
],
"instructions_list": [
"In a large salad bowl, combine the romaine, Napa cabbage, red cabbage, carrots, edamame, shredded chicken and wonton noodles.",
"Gently toss in or garnish the salad with mandarin oranges, scallions and slivered almonds.",
"Whisk together the dressing ingredients in a bowl or mason jar and toss the salad with the dressing. Serve. (That's it!?)",
"Serve. (That's it!?) ENJOY!"
],
"category": "Main Course",
"yields": "6 servings",
"description": "This Chopped Chicken Salad is incredibly delicious and equally simple to make!",
"total_time": 20,
"cook_time": 5,
"prep_time": 15,
"cuisine": "Chinese",
"ratings": 4.81,
"ratings_count": 47,
"equipment": [
"Cutting board",
"Chefs Knife",
"Measuring cups & spoons"
],
"nutrients": {
"servingSize": "1 serving",
"calories": "544 kcal",
"fatContent": "35 g",
"saturatedFatContent": "5 g",
"carbohydrateContent": "20 g",
"sugarContent": "10 g",
"proteinContent": "41 g",
"sodiumContent": "757 mg",
"fiberContent": "6 g",
"cholesterolContent": "114 mg"
},
"image": "https://krollskorner.com/wp-content/uploads/2020/05/Choppedchickensalad-9-scaled.jpg",
"keywords": [
"chicken salad"
]
}
Loading
Loading