Finding recipes by a given criteria

# Recipe descriptions as seen on Used for illustrative purposes only. recipe_str = """ German Potato Salad|10|25|5|1 1/2 pounds (about 8) small red potatoes; 3 slices (about 4 ounces) thick cut bacon, diced; 2 medium (3/4 pound) red onions, diced; 2 tablespoons white wine vinegar; 1/3 cup low sodium vegetable or chicken broth (store-bought or homemade); 1 tablespoon prepared yellow mustard 1/4 teaspoon salt; 1/4 teaspoon ground black pepper; 1/3 cup chopped fresh herbs (I like a mixture of chives and parsley)| Vietnamese-Style Noodle Bowls with Chicken|30|40|4|2 tablespoons granulated sugar, or more to taste; 1/2 cup seasoned rice vinegar; 1 tablespoons fish sauce; 1 piece (1-inch) fresh ginger, cut into 2 thick slices; 1 clove garlic, halved; 2 tablespoons hoisin sauce; 2 tablespoons oyster sauce; 2 tablespoons canola oil; 2 large skinless, boneless chicken breasts (about 1 pound or 1/2 kilo); 8 ounces rice vermicelli noodles; 2 carrots, grated; 2 cups fresh bean sprouts (6 ounces or 170 grams); 1 jalapeno or other chili pepper, cored and thinly sliced; 2 scallions, thinly sliced; 3 tablespoons chopped fresh cilantro leaves; 3 tablespoons chopped fresh mint leaves; 1/4 cup peanuts, coarsely chopped; 1 lime, quartered, for garnish| Iced Chai Latte|5|-1|4|4 tea bags of chai; 1 quart water; 1/4 cup honey; 1/4 cup water| Grilled Fish Tacos with Strawberry Pineapple Salsa|30|10|5|1 cup finely diced strawberries; 1 cup finely diced pineapple; 1/2 cup finely diced red onion; 1 clove minced garlic; 1 cup roughly chopped cilantro, loosely packed; 1 small red chili, diced (optional); 1 lime, juiced (about 1 1/2 tablespoons juice); 1/4 teaspoon salt; 1/4 teaspoon pepper; 1/2 teaspoon sugar (optional if the salsa is tart); 1 pound firm-fleshed fish (like sea bass, swordfish, halibut, mahi mahi or salmon); 1 teaspoon ground cumin; 1 teaspoon sweet paprika; 1 teaspoon smoked paprika; Heavy pinch of cayenne (optional); 1/4 teaspoon salt; 1/4 teaspoon pepper; 1 tablespoon olive oil; Grapeseed or other high heat oil for grill; 12 small (4- to 6-inch) corn tortillas; Shredded red cabbage; Sliced radishes; Avocado; Sour Cream; Lime wedges; Cilantro| Roasted Zucchini with Garlic|10|15|4|1 lb zucchini, each cut in half across the middle, then each half quartered lengthwise; 1 teaspoon fresh minced garlic cloves; 1 Tbsp olive oil; Kosher salt; Freshly ground black pepper; 1/2 teaspoon Herbes de Provence or dried thyme, or 1 teaspoon of fresh chopped thyme| One Pot Chicken and Orzo|5|30|5|2 1/2 to 3 pounds bone-in, skin-on chicken thighs, trimmed of excess fat; 2 teaspoons olive oil 1 teaspoon butter; 12 ounces (2 cups) orzo pasta; 1 1/2 cups chopped onion (about 1 medium onion); 2 cloves garlic, minced; 2 1/4 cups chicken stock; 3/4 cup canned crushed tomatoes (including juices); 1/2 teaspoon black pepper; 1 teaspoon salt; 2 Tbsp chopped fresh parsley| Cilantro Lime Rice|30|30|6|2 Tbps olive oil; 1 1/2 cups basmati long grain white rice; 1 clove garlic, minced; 2 1/4 cup water; 1 teaspoon salt; Zest of one lime; 3 Tbsp lime juice; 1 cup lightly packed chopped cilantro, leaves and tender stems| """ class Recipe: def __init__(self, name, prep_time, cook_time, servings_yield, ingredients, recipe_url): = name self.prep_time = prep_time self.cook_time = cook_time self.servings_yield = servings_yield self.ingredients = ingredients self.recipe_url = recipe_url def get_name(self): return def get_link(self): return "%s" % (self.recipe_url, def has_ingredient(self, ingredient_name): for ingredient in self.ingredients: if ingredient_name.lower() in ingredient.lower(): return True return False def list_ingredients(): for ingredient in self.ingredients: print(ingredient) # Generate recipes recipes = [] for line in recipe_str.split('\n')[1:-1]: name, prep_time, cook_time, servings_yield, ingredients_str, recipe_url = line.split('|') prep_time, cook_time, servings_yield = int(prep_time), int(cook_time), int(servings_yield) ingredients = ingredients_str.split('; ') recipes.append(Recipe(name, prep_time, cook_time, servings_yield, ingredients, recipe_url)) # Query for recipe in recipes: if recipe.prep_time < 20 and recipe.servings_yield >= 5: print( """ German Potato Salad One Pot Chicken and Orzo """ for recipe in recipes: if recipe.has_ingredient('Cilantro'): print(recipe.get_link()) """ Vietnamese-Style Noodle Bowls with Chicken Grilled Fish Tacos with Strawberry Pineapple Salsa Cilantro Lime Rice """ for recipe in recipes: if recipe.has_ingredient('Potatoes') and recipe.cook_time < 30: print(recipe.get_link()) # German Potato Salad

For more recipes, visit Simply Recipes.