Skip to content

Commit

Permalink
Revert "Add 'keywords' to the available scraper fields (#1059)" (#1125)
Browse files Browse the repository at this point in the history
This reverts commit c3128fa.
  • Loading branch information
jayaddison authored May 6, 2024
1 parent b7c5ad9 commit 117081c
Show file tree
Hide file tree
Showing 239 changed files with 31 additions and 1,678 deletions.
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ then:
scraper.canonical_url() # not always available
scraper.equipment() # not always available
scraper.cooking_method() # not always available
scraper.keywords() # not always available
You also have an option to scrape html-like content

Expand Down
4 changes: 0 additions & 4 deletions recipe_scrapers/_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ def nutrients(self):
"""Nutrients of the recipe."""
raise NotImplementedError("This should be implemented.")

def keywords(self):
"""Keywords or tags used to describe the recipe"""
raise NotImplementedError("This should be implemented.")

def language(self):
"""Language the recipe is written in."""
candidate_languages = OrderedDict()
Expand Down
13 changes: 1 addition & 12 deletions recipe_scrapers/_schemaorg.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from recipe_scrapers.settings import settings

from ._exceptions import SchemaOrgException
from ._utils import csv_to_tags, get_minutes, get_yields, normalize_string
from ._utils import get_minutes, get_yields, normalize_string

SCHEMA_ORG_HOST = "schema.org"

Expand Down Expand Up @@ -322,14 +322,3 @@ def cooking_method(self):
if cooking_method and isinstance(cooking_method, list):
cooking_method = cooking_method[0]
return normalize_string(cooking_method)

def keywords(self):
keywords = self.data.get("keywords")
if keywords is None:
raise SchemaOrgException("No cooking method data in SchemaOrg")
if keywords:
if isinstance(keywords, list):
keywords = keywords[0]
keywords = normalize_string(keywords)
keywords = csv_to_tags(keywords)
return keywords
12 changes: 0 additions & 12 deletions recipe_scrapers/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,6 @@ def normalize_string(string):
)


def csv_to_tags(csv, lowercase=False):
raw_tags = csv.split(",")
seen = set()
tags = []
for raw_tag in raw_tags:
tag = raw_tag.strip()
if tag.lower() not in seen:
seen.add(tag.lower())
tags.append(tag.lower() if lowercase else tag)
return tags


def url_path_to_dict(path):
pattern = (
r"^"
Expand Down
1 change: 0 additions & 1 deletion recipe_scrapers/plugins/schemaorg_fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class SchemaOrgFillPlugin(PluginInterface):
"description",
"cook_time",
"prep_time",
"keywords",
"ratings_count",
)

Expand Down
1 change: 0 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"nutrients",
"prep_time",
"cooking_method",
"keywords",
"ratings",
"reviews",
"equipment",
Expand Down
1 change: 0 additions & 1 deletion tests/library/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def test_list_public_methods(self):
"ingredients",
"instructions",
"instructions_list",
"keywords",
"language",
"nutrients",
"prep_time",
Expand Down
5 changes: 1 addition & 4 deletions tests/test_data/101cookbooks.com/onehundredonecookbooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,5 @@
"site_name": "101 Cookbooks",
"title": "Broccoli Soup with Coconut Milk",
"total_time": 20,
"yields": "8 servings",
"keywords": [
"broccoli soup"
]
"yields": "8 servings"
}
4 changes: 0 additions & 4 deletions tests/test_data/750g.com/g750g.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@
"title": "Salade de carottes cuites et crues à l'orange",
"total_time": 35,
"yields": "6 servings",
"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
Expand Down
6 changes: 0 additions & 6 deletions tests/test_data/aberlehome.com/aberlehome.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@
"title": "Sourdough Croissants",
"total_time": 1335,
"yields": "10 servings",
"keywords": [
"sourdough croissants",
"sourdough croissant",
"homemade croissants",
"sourdough croissants no yeast"
],
"category": "Sourdough Recipes",
"cook_time": 15,
"prep_time": 60,
Expand Down
3 changes: 0 additions & 3 deletions tests/test_data/abuelascounter.com/abuelascounter_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@
"title": "Alita Oliva’s Roast Chicken",
"total_time": 105,
"yields": "6 servings",
"keywords": [
"abuela's"
],
"cook_time": 90,
"prep_time": 15
}
3 changes: 0 additions & 3 deletions tests/test_data/abuelascounter.com/abuelascounter_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@
"title": "Pecan Pie Bars",
"total_time": 45,
"yields": "10 servings",
"keywords": [
"abuelau0026#039;s"
],
"cook_time": 30,
"prep_time": 15
}
3 changes: 0 additions & 3 deletions tests/test_data/acouplecooks.com/acouplecooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
"total_time": 8,
"yields": "4 servings",
"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",
Expand Down
10 changes: 0 additions & 10 deletions tests/test_data/addapinch.com/addapinch_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@
"title": "The Best Chocolate Cake Recipe {Ever}",
"total_time": 45,
"yields": "24 servings",
"keywords": [
"best chocolate cake",
"chocolate cake",
"chocolate cake recipe",
"classic chocolate cake",
"dairy free chocolate cake",
"easy chocolate cake",
"egg free chocolate cake",
"gluten-free chocolate cake"
],
"cook_time": 30,
"prep_time": 15
}
3 changes: 0 additions & 3 deletions tests/test_data/addapinch.com/addapinch_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@
"Pastry Blender",
"Grater/ Zester"
],
"keywords": [
"citrus scones"
],
"cook_time": 20,
"prep_time": 10
}
9 changes: 1 addition & 8 deletions tests/test_data/ah.nl/albertheijn.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,5 @@
"site_name": null,
"title": "Rijkgevulde vegan pastasalade",
"total_time": 20,
"yields": "4 servings",
"keywords": [
"veganistisch",
"vooraf te maken",
"salade",
"hoofdgerecht",
"koken"
]
"yields": "4 servings"
}
3 changes: 0 additions & 3 deletions tests/test_data/akispetretzikis.com/akispetretzikis.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@
"title": "Lemon chicken with artichokes",
"total_time": 40,
"yields": "10 servings",
"keywords": [
"Lemon"
],
"cook_time": 25,
"prep_time": 15
}
15 changes: 1 addition & 14 deletions tests/test_data/alittlebityummy.com/alittlebityummy_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,5 @@
"total_time": 2400,
"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"
]
"prep_time": 600
}
3 changes: 0 additions & 3 deletions tests/test_data/alltommat.se/alltomat_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
"title": "Brioche-hamburgerbröd",
"total_time": 155,
"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
Expand Down
3 changes: 0 additions & 3 deletions tests/test_data/alltommat.se/alltomat_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,5 @@
"title": "Köttbullar med potatismos, gräddsås, gurka och lingon",
"total_time": 50,
"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."
}
5 changes: 0 additions & 5 deletions tests/test_data/altonbrown.com/altonbrown_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,5 @@
"Digital instant-read thermometer",
"2 (9-inch) round aluminum cake pans"
],
"keywords": [
"Baking",
"Desserts",
"Entertaining"
],
"prep_time": 120
}
5 changes: 0 additions & 5 deletions tests/test_data/altonbrown.com/altonbrown_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@
"Charcoal grill (See note)",
"12 8-inch wooden skewers, smoked in water (See other note)"
],
"keywords": [
"Grill",
"Pork",
"skewer"
],
"cook_time": 10,
"prep_time": 30
}
6 changes: 0 additions & 6 deletions tests/test_data/amazingribs.com/amazingribs_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@
"sausage grinder",
"sausage stuffer"
],
"keywords": [
"brisket",
"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",
Expand Down
5 changes: 0 additions & 5 deletions tests/test_data/amazingribs.com/amazingribs_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
"equipment": [
"4 cups wood chunks or chips (about 8 ounces (226 g))"
],
"keywords": [
"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",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_data/ambitiouskitchen.com/ambitiouskitchen.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@
"title": "Vegetarian Spinach Pumpkin Lasagna",
"total_time": 70,
"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
Expand Down
5 changes: 1 addition & 4 deletions tests/test_data/archanaskitchen.com/archanaskitchen_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,5 @@
"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"
]
"prep_time": 15
}
5 changes: 1 addition & 4 deletions tests/test_data/archanaskitchen.com/archanaskitchen_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,5 @@
"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"
]
"prep_time": 30
}
5 changes: 1 addition & 4 deletions tests/test_data/arla.se/arla_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,5 @@
"site_name": "Arla",
"title": "Reuben sandwich",
"total_time": 40,
"yields": "4 servings",
"keywords": [
"Smörgås"
]
"yields": "4 servings"
}
5 changes: 1 addition & 4 deletions tests/test_data/arla.se/arla_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,5 @@
"site_name": "Arla",
"title": "Trifle på äpple med smulkrisp och vaniljglass",
"total_time": null,
"yields": "4 servings",
"keywords": [
"Smulpaj"
]
"yields": "4 servings"
}
7 changes: 0 additions & 7 deletions tests/test_data/averiecooks.com/averiecooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@
"title": "Balsamic Watermelon Cucumber Salad",
"total_time": 20,
"yields": "2 servings",
"keywords": [
"watermelon cucumber salad",
"watermelon goat cheese salad",
"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",
Expand Down
4 changes: 0 additions & 4 deletions tests/test_data/baking-sense.com/bakingsense_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@
"Cooling Rack",
"Half Sheet Pans"
],
"keywords": [
"buttermilk",
"sourdough"
],
"cook_time": 40,
"prep_time": 20
}
5 changes: 0 additions & 5 deletions tests/test_data/baking-sense.com/bakingsense_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@
"Cake Boards",
"Sieve"
],
"keywords": [
"chocolate cake",
"mousse",
"strawberry cake"
],
"cook_time": 30,
"prep_time": 120
}
3 changes: 0 additions & 3 deletions tests/test_data/bakingmischief.com/bakingmischief_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@
"title": "Barbacoa Burrito Bowls",
"total_time": 190,
"yields": "4 servings",
"keywords": [
"Barbacoa Burrito Bowl"
],
"cook_time": 160,
"prep_time": 30
}
4 changes: 0 additions & 4 deletions tests/test_data/bakingmischief.com/bakingmischief_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@
"title": "Small Carrot Cake",
"total_time": 90,
"yields": "4 servings",
"keywords": [
"Mini Carrot Cake",
"Small Carrot Cake"
],
"cook_time": 25,
"prep_time": 20
}
Loading

0 comments on commit 117081c

Please sign in to comment.