RECIPE SCRAPER

In [ ]:
import requests
from bs4 import BeautifulSoup
import re
import pandas as pd
In [ ]:
# We don't need the navigation links
def not_nav(href):
    return href and not re.compile("category").search(href)

# Get the recipes
def get_recipe_links(url):
    all_links = []
    r = requests.get(url)
    soup = BeautifulSoup(r.content, 'html.parser')
    recipes = soup.find("div", "recipe-archive")
    recipe_links = recipes.find_all(href=not_nav)
    for link in recipe_links:
        all_links.append(link.get('href'))
    return all_links

all_links_from_site = []
for num in range(0,184):
    links_from_page = get_recipe_links("https://www.halfbakedharvest.com/category/recipes/page/" + str(num))
    all_links_from_site.extend(links_from_page)

df = pd.DataFrame({'links': all_links_from_site})
df.to_csv('halfbakedharvest_links.csv')

We need this for ingredient scraping

In [ ]:
def get_recipe_id(link):
    try:
        r = requests.get(link)
        soup = BeautifulSoup(r.content, 'html.parser')
        recipe_id = soup.find_all("div", {"class": "wprm-recipe-container"})[0]['data-recipe-id']

        url = "https://www.halfbakedharvest.com/wprm_print/" + recipe_id
        return url
    except:
        print(link)
        return('no data')
    
df['recipe_id_url'] = df.apply(lambda x: get_recipe_id(x['links']), axis=1)

STEP 3: Get Ingredients from Recipe URL

In [ ]:
df.to_csv('halfbakedharvest_links_with_ids.csv')
In [ ]:
mega_list_of_ingredients = []
def get_recipe_ingredients(url):
    if url == "no data":
        return "no data"
    
    r = requests.get(url)
    soup = BeautifulSoup(r.content, 'html.parser')
    recipe_name = soup.find_all('h2', 'wprm-recipe-name')[0].text.strip()
    ingredients = soup.find_all(itemprop="recipeIngredient")
    all_ingredients = []

    for i in ingredients:
        try:
            amount = i.find_all("span","wprm-recipe-ingredient-amount")
            amount = amount[0].text
        except:
            amount = 'no amount'
        
        try:
            unit = i.find_all("span","wprm-recipe-ingredient-unit")
            unit = unit[0].text
        except:
            unit = 'no unit'

        try:
            name = i.find_all("span","wprm-recipe-ingredient-name")
            name = name[0].text
        except:
            name = 'no name'

        all_ingredients.append({'url': url, 
                                'recipe_name': recipe_name,
                                'amount': amount, 
                                'unit': unit, 
                                'name': name})
        mega_list_of_ingredients.append({'url': url, 
                                'recipe_name': recipe_name,
                                'amount': amount, 
                                'unit': unit, 
                                'name': name})

    return all_ingredients
In [ ]:
df = pd.read_csv('halfbakedharvest_links_with_ids.csv')
df
# df['ingredients'] = df.apply(lambda x: get_recipe_ingredients(x['recipe_id_url']), axis=1)
In [ ]:
# df = df[:5]
df = pd.read_csv('halfbakedharvest_links_with_ids.csv')
df['ingredients'] = df.apply(lambda x: get_recipe_ingredients(x['recipe_id_url']), axis=1)
In [ ]:
df.to_csv('halfbakedharvest_links_with_ingredients.csv', index=False)
In [ ]:
mloi = pd.DataFrame(mega_list_of_ingredients)
mloi.to_csv('halfbakedharvest_all_ingredients.csv', index=False)
In [ ]:
df
In [ ]:
mloi
In [ ]:
df = pd.read_csv('halfbakedharvest_links_with_ingredients.csv')
df = df[:100]
In [ ]:
# def get_names(all_ingredients):
#     ingredients_obj = eval(all_ingredients)
#     names = []
#     for ingredient in ingredients_obj:
#         names.append(ingredient['name'])
#     return names


# not_compliant = ['pasta', 'bean', 'flour', 'wine', 'dough']
# def check_if_compliant(ingredient_names):
# #     print(ingredients)
#     ingredients_str = ''.join(ingredient_names)
#     for item in not_compliant:
#         if item in ingredients_str.lower():
#             return 'no'
#     else:
#         return 'yes'
    
df['names'] = df.apply(lambda x: get_names(x['ingredients']), axis=1)
In [ ]:
def get_names(all_ingredients):
#     print('getting here')
#     ingredients_obj = eval(all_ingredients)
    print(type(all_ingredients))
    
df['names'] = df.apply(lambda x: get_names(x['ingredients']), axis=1)
In [ ]:
df['ingredients'].to_dict()
type(df['ingredients'])
In [ ]:
# df = df[:5]
df.iloc[0]['ingredients'][1]
In [ ]:
df
In [ ]:
type(df.iloc[0]['ingredients'])

11-10-20

In [4]:
import pandas as pd
df = pd.read_csv('halfbakedharvest_links_with_ingredients.csv')
/Users/kendraryan/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pandas/compat/__init__.py:117: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.
  warnings.warn(msg)
In [5]:
og_df = df.copy()
sm_df = df[:5]
In [6]:
eval(df.iloc[0]['ingredients'])
Out[6]:
[{'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '2',
  'unit': 'ounces',
  'name': 'vodka'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': 'no amount',
  'unit': 'no unit',
  'name': 'juice from 1/2 of a lime'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '1/3',
  'unit': 'cup',
  'name': 'apple cider'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '1',
  'unit': 'tablespoon',
  'name': 'apple butter'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '1-2',
  'unit': 'teaspoons',
  'name': 'fresh grated ginger'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': 'no amount',
  'unit': 'no unit',
  'name': 'ginger beer, for topping'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': 'no amount',
  'unit': 'no unit',
  'name': 'pomegranate arils and cinnamon sticks, for serving'}]
In [7]:
# ATTEMPTING TO FORMAT INGREDIENTS 
for ing in eval(df.iloc[0]['ingredients']):
    name = ing['name']
    amount = '' if ing['amount'] == 'no amount' else '(' + ing['amount'] 
    unit = '' if ing['unit'] == 'no unit' else ing['unit'] + ')'
    tidy_text = '{} {} {}'.format(name, amount, unit)
    print(tidy_text)
vodka (2 ounces)
juice from 1/2 of a lime  
apple cider (1/3 cup)
apple butter (1 tablespoon)
fresh grated ginger (1-2 teaspoons)
ginger beer, for topping  
pomegranate arils and cinnamon sticks, for serving  
In [8]:
def format_ingredients(ingredients_list):
    formatted_ingredients = []
    for ing in eval(ingredients_list):
        name = ing['name']
        amount = '' if (ing['amount'] == 'no amount' and ing['unit'] == 'no unit') else '(' + ing['amount'] 
        unit = '' if ing['unit'] == 'no unit' else ing['unit'] + ')'
        tidy_text = '{} {} {}'.format(name, amount, unit)
        print(tidy_text)
        formatted_ingredients.append(tidy_text)
    return formatted_ingredients
In [10]:
sm_df
Out[10]:
Unnamed: 0 links recipe_id_url ingredients
0 0 https://www.halfbakedharvest.com/ginger-apple-... https://www.halfbakedharvest.com/wprm_print/97228 [{'url': 'https://www.halfbakedharvest.com/wpr...
1 1 https://www.halfbakedharvest.com/brown-sugar-m... https://www.halfbakedharvest.com/wprm_print/97182 [{'url': 'https://www.halfbakedharvest.com/wpr...
2 2 https://www.halfbakedharvest.com/skillet-chick... https://www.halfbakedharvest.com/wprm_print/97147 [{'url': 'https://www.halfbakedharvest.com/wpr...
3 3 https://www.halfbakedharvest.com/brussels-spro... https://www.halfbakedharvest.com/wprm_print/97107 [{'url': 'https://www.halfbakedharvest.com/wpr...
4 4 https://www.halfbakedharvest.com/cider-pumpkin... https://www.halfbakedharvest.com/wprm_print/96340 [{'url': 'https://www.halfbakedharvest.com/wpr...
In [11]:
result = [format_ingredients(x) for x in sm_df['ingredients']]
results_flattened = [item for sublist in result for item in sublist]
results_flattened
vodka (2 ounces)
juice from 1/2 of a lime  
apple cider (1/3 cup)
apple butter (1 tablespoon)
fresh grated ginger (1-2 teaspoons)
ginger beer, for topping  
pomegranate arils and cinnamon sticks, for serving  
salted butter, at room temperature (1 sticks (1/2 cup))
packed dark brown sugar (1/2 cup)
pure maple syrup (1/4 cup)
vanilla extract (1 teaspoon)
egg, at room temperature (1 
all-purpose flour (1 1/2 cups)
baking soda (1/2 teaspoon)
kosher salt (1/2 teaspoon)
salted butter, at room temperature (4 tablespoons)
packed dark brown sugar (1/2 cup)
real maple syrup (1/2 cup)
vanilla extract (2 teaspoons)
eggs, at room temperature (2 
bourbon (1 tablespoon)
roughly chopped pecans (2 cups)
semi-sweet chocolate chips (1 - 1 1/2 cups)
extra virgin olive oil (2 tablespoons)
salted butter (8 tablespoons)
shallots, thinly sliced (2 
chopped fresh thyme (2 tablespoons)
chopped fresh sage, + 8 whole sage leaves (1 tablespoon  )
all-purpose flour (1/2 cup)
dry white wine, such as Pinot Grigio or Sauvignon Blanc (1/2 cup)
low sodium chicken broth (4 cups)
boneless skinless chicken breast, sliced in half  (2 small)
kosher salt and black pepper  
celery,  chopped (2 ribs)
carrots, chopped (4 
roughly chopped broccoli florets (1 1/2 cups)
cayenne pepper (1/4 teaspoon)
garlic, grated (2-4 cloves)
chopped fresh rosemary (1 tablespoon)
sheets frozen phyllo dough thawed (12-18 
fettuccine pasta (1 pound)
thick-cut slices bacon, chopped (4 
extra virgin olive oil (2 tablespoons)
Brussels sprouts, thinly sliced or halved, if small (3/4 pound)
kosher salt and black pepper  
salted butter (4 tablespoons)
garlic, minced or grated (3 cloves)
chopped fresh oregano (1 tablespoon)
chopped fresh sage (1 tablespoon)
crushed red pepper flakes (1  pinch)
whole milk or canned coconut milk (2 cups)
heavy cream or canned coconut milk (1/2 cup)
cream cheese, at room temperature  (2 ounces)
grated Parmesan or Pecorino Romano  (1 1/2 cups)
ground nutmeg (1/4 teaspoon)
Land O Lakes® Salted Butter (6 tablespoons)
pumpkin puree (1 cup)
spiced apple cider (1 1/2 cups)
large eggs (2 
pure maple syrup (2 tablespoons)
vanilla extract (2 teaspoons)
all-purpose flour (2 cups)
baking powder (1 tablespoon)
baking soda (1/2 teaspoon)
cinnamon (1 1/2 teaspoons)
ground ginger (1/2 teaspoon)
ground nutmeg (1/4 teaspoon)
kosher salt (1/2 teaspoon)
Land O Lakes® Salted Butter (6 tablespoons)
maple syrup (1/2 cup)
flaky sea salt (1 pinch)
Out[11]:
['vodka (2 ounces)',
 'juice from 1/2 of a lime  ',
 'apple cider (1/3 cup)',
 'apple butter (1 tablespoon)',
 'fresh grated ginger (1-2 teaspoons)',
 'ginger beer, for topping  ',
 'pomegranate arils and cinnamon sticks, for serving  ',
 'salted butter, at room temperature (1 sticks (1/2 cup))',
 'packed dark brown sugar (1/2 cup)',
 'pure maple syrup (1/4 cup)',
 'vanilla extract (1 teaspoon)',
 'egg, at room temperature (1 ',
 'all-purpose flour (1 1/2 cups)',
 'baking soda (1/2 teaspoon)',
 'kosher salt (1/2 teaspoon)',
 'salted butter, at room temperature (4 tablespoons)',
 'packed dark brown sugar (1/2 cup)',
 'real maple syrup (1/2 cup)',
 'vanilla extract (2 teaspoons)',
 'eggs, at room temperature (2 ',
 'bourbon (1 tablespoon)',
 'roughly chopped pecans (2 cups)',
 'semi-sweet chocolate chips (1 - 1 1/2 cups)',
 'extra virgin olive oil (2 tablespoons)',
 'salted butter (8 tablespoons)',
 'shallots, thinly sliced (2 ',
 'chopped fresh thyme (2 tablespoons)',
 'chopped fresh sage, + 8 whole sage leaves (1 tablespoon  )',
 'all-purpose flour (1/2 cup)',
 'dry white wine, such as Pinot Grigio or Sauvignon Blanc (1/2 cup)',
 'low sodium chicken broth (4 cups)',
 'boneless skinless chicken breast, sliced in half  (2 small)',
 'kosher salt and black pepper  ',
 'celery,  chopped (2 ribs)',
 'carrots, chopped (4 ',
 'roughly chopped broccoli florets (1 1/2 cups)',
 'cayenne pepper (1/4 teaspoon)',
 'garlic, grated (2-4 cloves)',
 'chopped fresh rosemary (1 tablespoon)',
 'sheets frozen phyllo dough thawed (12-18 ',
 'fettuccine pasta (1 pound)',
 'thick-cut slices bacon, chopped (4 ',
 'extra virgin olive oil (2 tablespoons)',
 'Brussels sprouts, thinly sliced or halved, if small (3/4 pound)',
 'kosher salt and black pepper  ',
 'salted butter (4 tablespoons)',
 'garlic, minced or grated (3 cloves)',
 'chopped fresh oregano (1 tablespoon)',
 'chopped fresh sage (1 tablespoon)',
 'crushed red pepper flakes (1  pinch)',
 'whole milk or canned coconut milk (2 cups)',
 'heavy cream or canned coconut milk (1/2 cup)',
 'cream cheese, at room temperature  (2 ounces)',
 'grated Parmesan or Pecorino Romano\xa0 (1 1/2 cups)',
 'ground nutmeg (1/4 teaspoon)',
 'Land O Lakes® Salted Butter (6 tablespoons)',
 'pumpkin puree (1 cup)',
 'spiced apple cider (1 1/2 cups)',
 'large eggs (2 ',
 'pure maple syrup (2 tablespoons)',
 'vanilla extract (2 teaspoons)',
 'all-purpose flour (2 cups)',
 'baking powder (1 tablespoon)',
 'baking soda (1/2 teaspoon)',
 'cinnamon (1 1/2 teaspoons)',
 'ground ginger (1/2 teaspoon)',
 'ground nutmeg (1/4 teaspoon)',
 'kosher salt (1/2 teaspoon)',
 'Land O Lakes® Salted Butter (6 tablespoons)',
 'maple syrup (1/2 cup)',
 'flaky sea salt (1 pinch)']
In [13]:
# result = [format_ingredients(x) for x in sm_df['ingredients']]
shopping_list = {}
def add_ingredients_to_dictionary(formatted_ingredient):
    print(formatted_ingredient)
    ing_split = formatted_ingredient.split('(')
    print(ing_split)
    ingredient = ing_split[0]
    amount;
    try:
        amount = ing_split[1].split(')')[0]
    except:
        amount = ''
    print(ingredient, amount)
#     if ingredient in shopping_list:
#         shopping_list[ingredient] = shopping_list[ingredient] + 
In [34]:
# result = [format_ingredients(x) for x in sm_df['ingredients']]
shopping_list = {}
def add_ingredients_to_dictionary(formatted_ingredient):
    ing_split = formatted_ingredient.split(' (')
    try:
        ingredient = ing_split[0].strip()
        amount = ing_split[1].split(')')[0].strip()
    except:
        ingredient = formatted_ingredient.strip()
        amount = ''
#     print('ingredient', ingredient, 'amount', amount)
    if ingredient in shopping_list:
        shopping_list[ingredient] = shopping_list[ingredient] + ' + ' +amount
    else:
        shopping_list[ingredient] = amount
In [35]:
my_list = [add_ingredients_to_dictionary(x) for x in results_flattened]
In [32]:
"vodka (2 ounces)".split(' (')[0]
Out[32]:
'vodka'
In [36]:
shopping_list
Out[36]:
{'vodka': '2 ounces',
 'juice from 1/2 of a lime': '',
 'apple cider': '1/3 cup',
 'apple butter': '1 tablespoon',
 'fresh grated ginger': '1-2 teaspoons',
 'ginger beer, for topping': '',
 'pomegranate arils and cinnamon sticks, for serving': '',
 'salted butter, at room temperature': '1 sticks + 4 tablespoons',
 'packed dark brown sugar': '1/2 cup + 1/2 cup',
 'pure maple syrup': '1/4 cup + 2 tablespoons',
 'vanilla extract': '1 teaspoon + 2 teaspoons + 2 teaspoons',
 'egg, at room temperature': '1',
 'all-purpose flour': '1 1/2 cups + 1/2 cup + 2 cups',
 'baking soda': '1/2 teaspoon + 1/2 teaspoon',
 'kosher salt': '1/2 teaspoon + 1/2 teaspoon',
 'real maple syrup': '1/2 cup',
 'eggs, at room temperature': '2',
 'bourbon': '1 tablespoon',
 'roughly chopped pecans': '2 cups',
 'semi-sweet chocolate chips': '1 - 1 1/2 cups',
 'extra virgin olive oil': '2 tablespoons + 2 tablespoons',
 'salted butter': '8 tablespoons + 4 tablespoons',
 'shallots, thinly sliced': '2',
 'chopped fresh thyme': '2 tablespoons',
 'chopped fresh sage, + 8 whole sage leaves': '1 tablespoon',
 'dry white wine, such as Pinot Grigio or Sauvignon Blanc': '1/2 cup',
 'low sodium chicken broth': '4 cups',
 'boneless skinless chicken breast, sliced in half': '2 small',
 'kosher salt and black pepper': ' + ',
 'celery,  chopped': '2 ribs',
 'carrots, chopped': '4',
 'roughly chopped broccoli florets': '1 1/2 cups',
 'cayenne pepper': '1/4 teaspoon',
 'garlic, grated': '2-4 cloves',
 'chopped fresh rosemary': '1 tablespoon',
 'sheets frozen phyllo dough thawed': '12-18',
 'fettuccine pasta': '1 pound',
 'thick-cut slices bacon, chopped': '4',
 'Brussels sprouts, thinly sliced or halved, if small': '3/4 pound',
 'garlic, minced or grated': '3 cloves',
 'chopped fresh oregano': '1 tablespoon',
 'chopped fresh sage': '1 tablespoon',
 'crushed red pepper flakes': '1  pinch',
 'whole milk or canned coconut milk': '2 cups',
 'heavy cream or canned coconut milk': '1/2 cup',
 'cream cheese, at room temperature': '2 ounces',
 'grated Parmesan or Pecorino Romano': '1 1/2 cups',
 'ground nutmeg': '1/4 teaspoon + 1/4 teaspoon',
 'Land O Lakes® Salted Butter': '6 tablespoons + 6 tablespoons',
 'pumpkin puree': '1 cup',
 'spiced apple cider': '1 1/2 cups',
 'large eggs': '2',
 'baking powder': '1 tablespoon',
 'cinnamon': '1 1/2 teaspoons',
 'ground ginger': '1/2 teaspoon',
 'maple syrup': '1/2 cup',
 'flaky sea salt': '1 pinch'}

PROBLEM: "eggs at room tempterature" & "Large eggs", "real maple syrup" and "maple syrup"

In [144]:
# result = [format_ingredients(x) for x in sm_df['ingredients']]
shopping_list = {}
def add_ingredients_to_dictionary(formatted_ingredient):
    ing_split = formatted_ingredient.split(' (')
    try:
        ingredient = ing_split[0].strip()
        try:
            sm_ingredient = ingredient.split(',')[0]
            instructions = ingredient.split(',')[1]
            amount = ing_split[1].split(')')[0].strip() + '(' +instructions+')'
        except:
            amount = ing_split[1].split(')')[0].strip()
    except:
        ingredient = formatted_ingredient.strip()
        amount = ''
#     print('ingredient', ingredient, 'amount', amount)
    if ingredient in shopping_list:
        shopping_list[ingredient] = shopping_list[ingredient] + ' + ' +amount
    else:
        shopping_list[ingredient] = amount
In [145]:
my_list = [add_ingredients_to_dictionary(x) for x in results_flattened]
my_list
Out[145]:
[None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None,
 None]
In [42]:
ingredient = 'eggs, at room temperature'
In [43]:
sm_ingredient = ingredient.split(',')[0]
instructions = ingredient.split(',')[1]
amount = ing_split[1].split(')')[0].strip() + '(' +instructions+')'
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-43-6ab31b762452> in <module>
      1 sm_ingredient = ingredient.split(',')[0]
      2 instructions = ingredient.split(',')[1]
----> 3 amount = ing_split[1].split(')')[0].strip() + '(' +instructions+')'

NameError: name 'ing_split' is not defined

PROBLEM: Instructions "Garlic, minced or grated"

In [49]:
for ing in eval(df.iloc[3]['ingredients']):
    name = ing['name']
    amount = '' if ing['amount'] == 'no amount' else '(' + ing['amount'] 
    unit = '' if ing['unit'] == 'no unit' else ing['unit'] + ')'
    tidy_text = '{} {} {}'.format(name, amount, unit)
    print(tidy_text)
fettuccine pasta (1 pound)
thick-cut slices bacon, chopped (4 
extra virgin olive oil (2 tablespoons)
Brussels sprouts, thinly sliced or halved, if small (3/4 pound)
kosher salt and black pepper  
salted butter (4 tablespoons)
garlic, minced or grated (3 cloves)
chopped fresh oregano (1 tablespoon)
chopped fresh sage (1 tablespoon)
crushed red pepper flakes (1  pinch)
whole milk or canned coconut milk (2 cups)
heavy cream or canned coconut milk (1/2 cup)
cream cheese, at room temperature  (2 ounces)
grated Parmesan or Pecorino Romano  (1 1/2 cups)
ground nutmeg (1/4 teaspoon)
In [59]:
for ing in eval(df.iloc[3]['ingredients']):
    tidy_text = ''
    name = ing['name']
    amount = ing['amount']
    unit = ing['unit']
    instructions = ''
    if ',' in name:
        new_name = name.split(',')[0]
        instructions = name.split(',')[1]
        name = new_name
        
    if unit == 'no unit' and amount == 'no amount' and instructions == '':
        tidy_text = name
        
    if unit == 'no unit' and amount != 'no amount' and instructions == '':
        tidy_text = '{} ({})'.format(name, amount)
        
    if unit == 'no unit' and amount != 'no amount' and instructions != '':
        tidy_text = '{} ({}, {})'.format(name, amount, instructions)    
        
    if unit != 'no unit' and amount != 'no amount' and instructions == '':
        tidy_text = '{} ({} {})'.format(name, amount, unit)

    if unit != 'no unit' and amount != 'no amount' and instructions != '':
        tidy_text = '{} ({} {}, {})'.format(name, amount, unit, instructions)
        
    print(tidy_text)
        
   
fettuccine pasta (1 pound)
thick-cut slices bacon (4,  chopped)
extra virgin olive oil (2 tablespoons)
Brussels sprouts (3/4 pound,  thinly sliced or halved)
kosher salt and black pepper
salted butter (4 tablespoons)
garlic (3 cloves,  minced or grated)
chopped fresh oregano (1 tablespoon)
chopped fresh sage (1 tablespoon)
crushed red pepper flakes (1  pinch)
whole milk or canned coconut milk (2 cups)
heavy cream or canned coconut milk (1/2 cup)
cream cheese (2 ounces,  at room temperature )
grated Parmesan or Pecorino Romano  (1 1/2 cups)
ground nutmeg (1/4 teaspoon)
In [69]:
methods = ['chopped', 'crushed', 'grated', 'ground']

def format_ingredients(ingredients_list):
    formatted_ingredients = []
    for ing in eval(ingredients_list):
        tidy_text = ''
        name = ing['name']
        amount = ing['amount']
        unit = ing['unit']
        instructions = ''
        if ',' in name:
            new_name = name.split(',')[0]
            instructions = name.split(',')[1]
            name = new_name

        for method in methods:
            if method in name:
                instructions = method
                new_name = name.replace(method + ' ', '')
                name = new_name

        if unit == 'no unit' and amount == 'no amount' and instructions == '':
            tidy_text = name

        if unit == 'no unit' and amount != 'no amount' and instructions == '':
            tidy_text = '{} ({})'.format(name, amount)

        if unit == 'no unit' and amount != 'no amount' and instructions != '':
            tidy_text = '{} ({}, {})'.format(name, amount, instructions)    

        if unit != 'no unit' and amount != 'no amount' and instructions == '':
            tidy_text = '{} ({} {})'.format(name, amount, unit)

        if unit != 'no unit' and amount != 'no amount' and instructions != '':
            tidy_text = '{} ({} {}, {})'.format(name, amount, unit, instructions)

        formatted_ingredients.append(tidy_text)
        
   
In [70]:
result = [format_ingredients(x) for x in sm_df['ingredients']]
# results_flattened = [item for sublist in result for item in sublist]
# results_flattened
In [74]:
def get_tidy_text_from_ingredient_dict(ing):
    tidy_text = ''
    name = ing['name']
    amount = ing['amount']
    unit = ing['unit']
    instructions = ''
    if ',' in name:
        new_name = name.split(',')[0]
        instructions = name.split(',')[1]
        name = new_name

    for method in methods:
        if method in name:
            instructions = method
            new_name = name.replace(method + ' ', '')
            name = new_name

    if unit == 'no unit' and amount == 'no amount' and instructions == '':
        tidy_text = name

    if unit == 'no unit' and amount != 'no amount' and instructions == '':
        tidy_text = '{} ({})'.format(name, amount)

    if unit == 'no unit' and amount != 'no amount' and instructions != '':
        tidy_text = '{} ({}, {})'.format(name, amount, instructions)    

    if unit != 'no unit' and amount != 'no amount' and instructions == '':
        tidy_text = '{} ({} {})'.format(name, amount, unit)

    if unit != 'no unit' and amount != 'no amount' and instructions != '':
        tidy_text = '{} ({} {}, {})'.format(name, amount, unit, instructions)

    return tidy_text
        
In [83]:
test = eval(df.iloc[0]['ingredients'])[0]
test2 = eval(df.iloc[0]['ingredients'])
get_tidy_text_from_ingredient_dict(test)
Out[83]:
'vodka (2 ounces)'
In [86]:
result = [get_tidy_text_from_ingredient_dict(x) for x in test2]
In [87]:
result
Out[87]:
['vodka (2 ounces)',
 'juice from 1/2 of a lime',
 'apple cider (1/3 cup)',
 'apple butter (1 tablespoon)',
 'fresh ginger (1-2 teaspoons, grated)',
 '',
 '']

PROBLEM Dealing with the "ORs"

11-12-20

In [93]:
import pandas as pd
df = pd.read_csv('halfbakedharvest_links_with_ingredients.csv')
og_df = df.copy()
In [94]:
df = og_df[:10]
In [96]:
eval(df.iloc[0]['ingredients'])
Out[96]:
[{'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '2',
  'unit': 'ounces',
  'name': 'vodka'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': 'no amount',
  'unit': 'no unit',
  'name': 'juice from 1/2 of a lime'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '1/3',
  'unit': 'cup',
  'name': 'apple cider'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '1',
  'unit': 'tablespoon',
  'name': 'apple butter'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '1-2',
  'unit': 'teaspoons',
  'name': 'fresh grated ginger'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': 'no amount',
  'unit': 'no unit',
  'name': 'ginger beer, for topping'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': 'no amount',
  'unit': 'no unit',
  'name': 'pomegranate arils and cinnamon sticks, for serving'}]
In [99]:
ing_df = [eval(x) for x in df['ingredients']]
In [101]:
test = pd.DataFrame(ing_df)
test
Out[101]:
0 1 2 3 4 5 6 7 8 9 ... 13 14 15 16 17 18 19 20 21 22
0 {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... None None None ... None None None None None None None None None None
1 {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... ... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... None None None None None None None
2 {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... ... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... None None None None None None
3 {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... ... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... None None None None None None None None
4 {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... ... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... None None None None None None None
5 {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... ... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... None None None None None None None None
6 {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... None ... None None None None None None None None None None
7 {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... ... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm...
8 {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... ... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... None None None None
9 {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... {'url': 'https://www.halfbakedharvest.com/wprm... ... {'url': 'https://www.halfbakedharvest.com/wprm... None None None None None None None None None

10 rows × 23 columns

In [103]:
 
Out[103]:
[{'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '2',
  'unit': 'ounces',
  'name': 'vodka'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': 'no amount',
  'unit': 'no unit',
  'name': 'juice from 1/2 of a lime'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '1/3',
  'unit': 'cup',
  'name': 'apple cider'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '1',
  'unit': 'tablespoon',
  'name': 'apple butter'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': '1-2',
  'unit': 'teaspoons',
  'name': 'fresh grated ginger'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': 'no amount',
  'unit': 'no unit',
  'name': 'ginger beer, for topping'},
 {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
  'recipe_name': 'Ginger Apple Moscow Mule',
  'amount': 'no amount',
  'unit': 'no unit',
  'name': 'pomegranate arils and cinnamon sticks, for serving'}]
In [106]:
for ing in eval(df.iloc[3]['ingredients']):
    tidy_text = ''
    name = ing['name']
    amount = ing['amount']
    unit = ing['unit']
    instructions = ''
    if ',' in name:
        new_name = name.split(',')[0]
        instructions = name.split(',')[1]
        name = new_name
    print(instructions)
 chopped

 thinly sliced or halved


 minced or grated





 at room temperature 


In [220]:
meats = ['chicken', 'chicken broth', 'broccoli', 'bacon']
methods = ['chopped', 'roughly chopped', 'crushed', 'grated', 'ground', 'freshly ground']
to_remove = ['fresh']

def format_ingredients(ingredients_list):
    ing_dict = eval(ingredients_list)
    for ing in ing_dict:
        tidy_text = ''
        name = ing['name']
        amount = ing['amount']
        unit = ing['unit']
        instructions = ''
        simple_name = ''
        
        new_name = ''
        
        for word in to_remove:
            if word in name:
                name = name.replace(word + ' ', '')
                
                
        if ',' in name:
            new_name = name.split(',')[0]
            instructions = name.split(',')[1].strip()
            simple_name = new_name


        for method in methods:
            if method in name:
                instructions = method.strip()
                new_name = name.split(',')[0]
                new_name = new_name.replace(method + ' ', '').strip()
                print(new_name)
                simple_name = new_name
                ing['simple_name'] = simple_name
                ing['instructions'] = instructions   

        for meat in meats:
            if meat in name:
                name = name.replace(',', '')
#                 print(name)
                instructions = name.replace(meat, '').strip()
                simple_name = meat.strip() 
                ing['simple_name'] = simple_name
                ing['instructions'] = instructions                
#         print(instructions)
        ing['instructions'] = instructions
        
        
        if simple_name == '':
            simple_name = name

        ing['simple_name'] = simple_name
    return ing_dict
result = [format_ingredients(x) for x in df['ingredients']]
result
ginger
roughly pecans
pecans
thyme
sage
celery
carrots
roughly broccoli florets
broccoli florets
garlic
rosemary
thick-cut slices bacon
garlic
oregano
sage
red pepper flakes
Parmesan or Pecorino Romano
nutmeg
ginger
nutmeg
medium yellow onion
garlic
poblano peppers
chipotle peppers in adobo
cumin
cilantro
ginger
cinnamon
cinnamon
ginger
cardamom
freshly nutmeg
cloves
black pepper
yellow onion
ginger
garlic
cilantro
kale
red pepper flakes
cumin seed
parmesan cheese
garlic
sage
fennel seed
red pepper flakes
Out[220]:
[[{'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
   'recipe_name': 'Ginger Apple Moscow Mule',
   'amount': '2',
   'unit': 'ounces',
   'name': 'vodka',
   'instructions': '',
   'simple_name': 'vodka'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
   'recipe_name': 'Ginger Apple Moscow Mule',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'juice from 1/2 of a lime',
   'instructions': '',
   'simple_name': 'juice from 1/2 of a lime'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
   'recipe_name': 'Ginger Apple Moscow Mule',
   'amount': '1/3',
   'unit': 'cup',
   'name': 'apple cider',
   'instructions': '',
   'simple_name': 'apple cider'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
   'recipe_name': 'Ginger Apple Moscow Mule',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'apple butter',
   'instructions': '',
   'simple_name': 'apple butter'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
   'recipe_name': 'Ginger Apple Moscow Mule',
   'amount': '1-2',
   'unit': 'teaspoons',
   'name': 'fresh grated ginger',
   'simple_name': 'ginger',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
   'recipe_name': 'Ginger Apple Moscow Mule',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'ginger beer, for topping',
   'instructions': 'for topping',
   'simple_name': 'ginger beer'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97228',
   'recipe_name': 'Ginger Apple Moscow Mule',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'pomegranate arils and cinnamon sticks, for serving',
   'instructions': 'for serving',
   'simple_name': 'pomegranate arils and cinnamon sticks'}],
 [{'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1',
   'unit': 'sticks (1/2 cup)',
   'name': 'salted butter, at room temperature',
   'instructions': 'at room temperature',
   'simple_name': 'salted butter'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'packed dark brown sugar',
   'instructions': '',
   'simple_name': 'packed dark brown sugar'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1/4',
   'unit': 'cup',
   'name': 'pure maple syrup',
   'instructions': '',
   'simple_name': 'pure maple syrup'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1',
   'unit': 'teaspoon',
   'name': 'vanilla extract',
   'instructions': '',
   'simple_name': 'vanilla extract'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1',
   'unit': 'no unit',
   'name': 'egg, at room temperature',
   'instructions': 'at room temperature',
   'simple_name': 'egg'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1 1/2',
   'unit': 'cups',
   'name': 'all-purpose flour',
   'instructions': '',
   'simple_name': 'all-purpose flour'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1/2',
   'unit': 'teaspoon',
   'name': 'baking soda',
   'instructions': '',
   'simple_name': 'baking soda'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1/2',
   'unit': 'teaspoon',
   'name': 'kosher salt',
   'instructions': '',
   'simple_name': 'kosher salt'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '4',
   'unit': 'tablespoons',
   'name': 'salted butter, at room temperature',
   'instructions': 'at room temperature',
   'simple_name': 'salted butter'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'packed dark brown sugar',
   'instructions': '',
   'simple_name': 'packed dark brown sugar'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'real maple syrup',
   'instructions': '',
   'simple_name': 'real maple syrup'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '2',
   'unit': 'teaspoons',
   'name': 'vanilla extract',
   'instructions': '',
   'simple_name': 'vanilla extract'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '2',
   'unit': 'no unit',
   'name': 'eggs, at room temperature',
   'instructions': 'at room temperature',
   'simple_name': 'eggs'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'bourbon',
   'instructions': '',
   'simple_name': 'bourbon'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '2',
   'unit': 'cups',
   'name': 'roughly chopped pecans',
   'simple_name': 'pecans',
   'instructions': 'roughly chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97182',
   'recipe_name': 'Brown Sugar Maple Chocolate Pecan Pie Bars',
   'amount': '1 - 1 1/2',
   'unit': 'cups',
   'name': 'semi-sweet chocolate chips',
   'instructions': '',
   'simple_name': 'semi-sweet chocolate chips'}],
 [{'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '2',
   'unit': 'tablespoons',
   'name': 'extra virgin olive oil',
   'instructions': '',
   'simple_name': 'extra virgin olive oil'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '8',
   'unit': 'tablespoons',
   'name': 'salted butter',
   'instructions': '',
   'simple_name': 'salted butter'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '2',
   'unit': 'no unit',
   'name': 'shallots, thinly sliced',
   'instructions': 'thinly sliced',
   'simple_name': 'shallots'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '2',
   'unit': 'tablespoons',
   'name': 'chopped fresh thyme',
   'simple_name': 'thyme',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '1',
   'unit': 'tablespoon  ',
   'name': 'chopped fresh sage, + 8 whole sage leaves',
   'simple_name': 'sage',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'all-purpose flour',
   'instructions': '',
   'simple_name': 'all-purpose flour'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'dry white wine, such as Pinot Grigio or Sauvignon Blanc',
   'instructions': 'such as Pinot Grigio or Sauvignon Blanc',
   'simple_name': 'dry white wine'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '4',
   'unit': 'cups',
   'name': 'low sodium chicken broth',
   'simple_name': 'chicken broth',
   'instructions': 'low sodium'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '2',
   'unit': 'small',
   'name': 'boneless skinless chicken breast, sliced in half ',
   'simple_name': 'chicken',
   'instructions': 'boneless skinless  breast sliced in half'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'kosher salt and black pepper',
   'instructions': '',
   'simple_name': 'kosher salt and black pepper'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '2',
   'unit': 'ribs',
   'name': 'celery,  chopped',
   'simple_name': 'celery',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '4',
   'unit': 'no unit',
   'name': 'carrots, chopped',
   'simple_name': 'carrots',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '1 1/2',
   'unit': 'cups',
   'name': 'roughly chopped broccoli florets',
   'simple_name': 'broccoli',
   'instructions': 'roughly chopped  florets'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '1/4',
   'unit': 'teaspoon',
   'name': 'cayenne pepper',
   'instructions': '',
   'simple_name': 'cayenne pepper'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '2-4',
   'unit': 'cloves',
   'name': 'garlic, grated',
   'simple_name': 'garlic',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'chopped fresh rosemary',
   'simple_name': 'rosemary',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '12-18',
   'unit': 'no unit',
   'name': 'sheets frozen phyllo dough thawed',
   'instructions': '',
   'simple_name': 'sheets frozen phyllo dough thawed'}],
 [{'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '1',
   'unit': 'pound',
   'name': 'fettuccine pasta',
   'instructions': '',
   'simple_name': 'fettuccine pasta'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '4',
   'unit': 'no unit',
   'name': 'thick-cut slices bacon, chopped',
   'simple_name': 'bacon',
   'instructions': 'thick-cut slices  chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '2',
   'unit': 'tablespoons',
   'name': 'extra virgin olive oil',
   'instructions': '',
   'simple_name': 'extra virgin olive oil'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '3/4',
   'unit': 'pound',
   'name': 'Brussels sprouts, thinly sliced or halved, if small',
   'instructions': 'thinly sliced or halved',
   'simple_name': 'Brussels sprouts'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'kosher salt and black pepper',
   'instructions': '',
   'simple_name': 'kosher salt and black pepper'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '4',
   'unit': 'tablespoons',
   'name': 'salted butter',
   'instructions': '',
   'simple_name': 'salted butter'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '3',
   'unit': 'cloves',
   'name': 'garlic, minced or grated',
   'simple_name': 'garlic',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'chopped fresh oregano',
   'simple_name': 'oregano',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'chopped fresh sage',
   'simple_name': 'sage',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '1 ',
   'unit': 'pinch',
   'name': 'crushed red pepper flakes',
   'simple_name': 'red pepper flakes',
   'instructions': 'crushed'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '2',
   'unit': 'cups',
   'name': 'whole milk or canned coconut milk',
   'instructions': '',
   'simple_name': 'whole milk or canned coconut milk'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'heavy cream or canned coconut milk',
   'instructions': '',
   'simple_name': 'heavy cream or canned coconut milk'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '2',
   'unit': 'ounces',
   'name': 'cream cheese, at room temperature ',
   'instructions': 'at room temperature',
   'simple_name': 'cream cheese'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '1 1/2',
   'unit': 'cups',
   'name': 'grated Parmesan or Pecorino Romano\xa0',
   'simple_name': 'Parmesan or Pecorino Romano',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '1/4',
   'unit': 'teaspoon',
   'name': 'ground nutmeg',
   'simple_name': 'nutmeg',
   'instructions': 'ground'}],
 [{'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '6',
   'unit': 'tablespoons',
   'name': 'Land O Lakes® Salted Butter',
   'instructions': '',
   'simple_name': 'Land O Lakes® Salted Butter'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '1',
   'unit': 'cup',
   'name': 'pumpkin puree',
   'instructions': '',
   'simple_name': 'pumpkin puree'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '1 1/2',
   'unit': 'cups',
   'name': 'spiced apple cider',
   'instructions': '',
   'simple_name': 'spiced apple cider'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '2',
   'unit': 'no unit',
   'name': 'large eggs',
   'instructions': '',
   'simple_name': 'large eggs'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '2',
   'unit': 'tablespoons',
   'name': 'pure maple syrup',
   'instructions': '',
   'simple_name': 'pure maple syrup'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '2',
   'unit': 'teaspoons',
   'name': 'vanilla extract',
   'instructions': '',
   'simple_name': 'vanilla extract'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '2',
   'unit': 'cups',
   'name': 'all-purpose flour',
   'instructions': '',
   'simple_name': 'all-purpose flour'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'baking powder',
   'instructions': '',
   'simple_name': 'baking powder'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '1/2',
   'unit': 'teaspoon',
   'name': 'baking soda',
   'instructions': '',
   'simple_name': 'baking soda'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '1 1/2',
   'unit': 'teaspoons',
   'name': 'cinnamon',
   'instructions': '',
   'simple_name': 'cinnamon'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '1/2',
   'unit': 'teaspoon',
   'name': 'ground ginger',
   'simple_name': 'ginger',
   'instructions': 'ground'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '1/4',
   'unit': 'teaspoon',
   'name': 'ground nutmeg',
   'simple_name': 'nutmeg',
   'instructions': 'ground'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '1/2',
   'unit': 'teaspoon',
   'name': 'kosher salt',
   'instructions': '',
   'simple_name': 'kosher salt'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '6',
   'unit': 'tablespoons',
   'name': 'Land O Lakes® Salted Butter',
   'instructions': '',
   'simple_name': 'Land O Lakes® Salted Butter'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'maple syrup',
   'instructions': '',
   'simple_name': 'maple syrup'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96340',
   'recipe_name': 'Cider Pumpkin Waffles with Salted Maple Butter',
   'amount': '1',
   'unit': 'pinch',
   'name': 'flaky sea salt',
   'instructions': '',
   'simple_name': 'flaky sea salt'}],
 [{'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '2',
   'unit': 'tablespoons',
   'name': 'extra virgin olive oil',
   'instructions': '',
   'simple_name': 'extra virgin olive oil'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '1',
   'unit': 'no unit',
   'name': 'medium yellow onion, chopped',
   'simple_name': 'medium yellow onion',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '4',
   'unit': 'cloves',
   'name': 'garlic, minced or grated',
   'simple_name': 'garlic',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '2',
   'unit': 'no unit',
   'name': 'poblano peppers, seeded and chopped',
   'simple_name': 'poblano peppers',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '2-4',
   'unit': 'no unit',
   'name': 'chipotle peppers in adobo, finely chopped',
   'simple_name': 'chipotle peppers in adobo',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'smoked paprika',
   'instructions': '',
   'simple_name': 'smoked paprika'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '2',
   'unit': 'teaspoons',
   'name': 'ground cumin',
   'simple_name': 'cumin',
   'instructions': 'ground'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'kosher salt and black pepper',
   'instructions': '',
   'simple_name': 'kosher salt and black pepper'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '1',
   'unit': 'pound',
   'name': 'boneless skinless, chicken breast',
   'simple_name': 'chicken',
   'instructions': 'boneless skinless  breast'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '2',
   'unit': '(14 ounce) cans',
   'name': 'fire-roasted diced tomatoes',
   'instructions': '',
   'simple_name': 'fire-roasted diced tomatoes'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '4',
   'unit': 'cups',
   'name': 'low-sodium chicken broth',
   'simple_name': 'chicken broth',
   'instructions': 'low-sodium'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'juice of 2 limes, plus lime zest for serving',
   'instructions': 'plus lime zest for serving',
   'simple_name': 'juice of 2 limes'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'fresh cilantro, chopped, plus more for serving',
   'simple_name': 'cilantro',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'sliced avocado, cheddar, and yogurt, for serving',
   'instructions': 'cheddar',
   'simple_name': 'sliced avocado'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/97009',
   'recipe_name': 'Slow Cooker Chipotle Chicken Tortilla Soup with Salty Lime Chips',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'salty lime chips',
   'instructions': '',
   'simple_name': 'salty lime chips'}],
 [{'url': 'https://www.halfbakedharvest.com/wprm_print/96927',
   'recipe_name': 'Nightmare on Bourbon Street',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'cinnamon sugar, for rim ',
   'instructions': 'for rim',
   'simple_name': 'cinnamon sugar'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96927',
   'recipe_name': 'Nightmare on Bourbon Street',
   'amount': '1 1/2',
   'unit': 'ounces',
   'name': 'bourbon',
   'instructions': '',
   'simple_name': 'bourbon'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96927',
   'recipe_name': 'Nightmare on Bourbon Street',
   'amount': '1',
   'unit': 'ounce',
   'name': 'fresh lemon juice',
   'instructions': '',
   'simple_name': 'lemon juice'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96927',
   'recipe_name': 'Nightmare on Bourbon Street',
   'amount': '1/4',
   'unit': 'cup',
   'name': 'apple cider',
   'instructions': '',
   'simple_name': 'apple cider'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96927',
   'recipe_name': 'Nightmare on Bourbon Street',
   'amount': '1-2',
   'unit': 'teaspoons',
   'name': 'real maple syrup',
   'instructions': '',
   'simple_name': 'real maple syrup'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96927',
   'recipe_name': 'Nightmare on Bourbon Street',
   'amount': '1',
   'unit': 'teaspoon',
   'name': 'fresh grated ginger ',
   'simple_name': 'ginger',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96927',
   'recipe_name': 'Nightmare on Bourbon Street',
   'amount': '1/8',
   'unit': 'teaspoon',
   'name': 'ground cinnamon',
   'simple_name': 'cinnamon',
   'instructions': 'ground'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96927',
   'recipe_name': 'Nightmare on Bourbon Street',
   'amount': '5',
   'unit': 'ounces',
   'name': 'sparkling hard Honeycrisp apple cider',
   'instructions': '',
   'simple_name': 'sparkling hard Honeycrisp apple cider'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96927',
   'recipe_name': 'Nightmare on Bourbon Street',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'cinnamon sticks, rosemary, and apple slices, for serving',
   'instructions': 'rosemary',
   'simple_name': 'cinnamon sticks'}],
 [{'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '4',
   'unit': 'teaspoons',
   'name': 'ground cinnamon',
   'simple_name': 'cinnamon',
   'instructions': 'ground'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '2',
   'unit': 'teaspoon',
   'name': 'ground ginger',
   'simple_name': 'ginger',
   'instructions': 'ground'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1',
   'unit': 'teaspoon',
   'name': 'ground cardamom',
   'simple_name': 'cardamom',
   'instructions': 'ground'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1/2',
   'unit': 'teaspoon',
   'name': 'freshly grated nutmeg',
   'simple_name': 'freshly nutmeg',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1/2',
   'unit': 'teaspoon',
   'name': 'all-spice',
   'instructions': '',
   'simple_name': 'all-spice'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1/2',
   'unit': 'teaspoon',
   'name': 'ground cloves',
   'simple_name': 'cloves',
   'instructions': 'ground'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1/8',
   'unit': 'teaspoon',
   'name': 'ground black pepper',
   'simple_name': 'black pepper',
   'instructions': 'ground'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1/3',
   'unit': 'cup',
   'name': 'granulated sugar',
   'instructions': '',
   'simple_name': 'granulated sugar'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'melted coconut oil',
   'instructions': '',
   'simple_name': 'melted coconut oil'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '3/4',
   'unit': 'cup',
   'name': 'packed dark brown sugar',
   'instructions': '',
   'simple_name': 'packed dark brown sugar'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'vanilla extract',
   'instructions': '',
   'simple_name': 'vanilla extract'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '2',
   'unit': 'no unit',
   'name': 'large eggs, at room temperature',
   'instructions': 'at room temperature',
   'simple_name': 'large eggs'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1 1/2',
   'unit': 'cups',
   'name': 'pumpkin puree',
   'instructions': '',
   'simple_name': 'pumpkin puree'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1 1/2',
   'unit': 'cups',
   'name': 'all-purpose flour',
   'instructions': '',
   'simple_name': 'all-purpose flour'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1 1/4',
   'unit': 'teaspoons',
   'name': 'baking powder',
   'instructions': '',
   'simple_name': 'baking powder'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1/2',
   'unit': 'teaspoon',
   'name': 'baking soda',
   'instructions': '',
   'simple_name': 'baking soda'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '3/4',
   'unit': 'teaspoon',
   'name': 'kosher salt',
   'instructions': '',
   'simple_name': 'kosher salt'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '8',
   'unit': 'tablespoons',
   'name': 'salted butter, at room temperature',
   'instructions': 'at room temperature',
   'simple_name': 'salted butter'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1/4',
   'unit': 'cup',
   'name': 'heavy cream',
   'instructions': '',
   'simple_name': 'heavy cream'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'packed dark brown sugar',
   'instructions': '',
   'simple_name': 'packed dark brown sugar'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '2',
   'unit': 'teaspoons',
   'name': 'vanilla extract',
   'instructions': '',
   'simple_name': 'vanilla extract'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1/4',
   'unit': 'teaspoon',
   'name': 'cinnamon',
   'instructions': '',
   'simple_name': 'cinnamon'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96884',
   'recipe_name': 'Vanilla Chai Pumpkin Latte Cupcakes with Cinnamon Brown Sugar Frosting',
   'amount': '1 1/2',
   'unit': 'cups',
   'name': 'powdered sugar',
   'instructions': '',
   'simple_name': 'powdered sugar'}],
 [{'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '3',
   'unit': 'tablespoons',
   'name': 'extra virgin olive oil',
   'instructions': '',
   'simple_name': 'extra virgin olive oil'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '1',
   'unit': 'no unit',
   'name': 'yellow onion, chopped',
   'simple_name': 'yellow onion',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '2',
   'unit': 'inches',
   'name': 'fresh ginger, grated',
   'simple_name': 'ginger',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '4',
   'unit': 'cloves',
   'name': 'garlic, minced or grated',
   'simple_name': 'garlic',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '2',
   'unit': 'no unit',
   'name': 'sweet potatoes, peeled and cubed',
   'instructions': 'peeled and cubed',
   'simple_name': 'sweet potatoes'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '2',
   'unit': 'teaspoons',
   'name': 'garam masala',
   'instructions': '',
   'simple_name': 'garam masala'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '1',
   'unit': 'teaspoon',
   'name': 'turmeric',
   'instructions': '',
   'simple_name': 'turmeric'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '1/4- 1/2',
   'unit': 'teaspoon',
   'name': 'cayenne pepper',
   'instructions': '',
   'simple_name': 'cayenne pepper'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '1/3',
   'unit': 'cup',
   'name': 'fresh cilantro, chopped, plus more for serving',
   'simple_name': 'cilantro',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'kosher salt and black pepper',
   'instructions': '',
   'simple_name': 'kosher salt and black pepper'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '1',
   'unit': '(14 ounce) can',
   'name': 'coconut milk',
   'instructions': '',
   'simple_name': 'coconut milk'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '3',
   'unit': 'cups',
   'name': 'chopped kale',
   'simple_name': 'kale',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '2',
   'unit': 'cups',
   'name': 'cooked basmati rice',
   'instructions': '',
   'simple_name': 'cooked basmati rice'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '1/3',
   'unit': 'cup',
   'name': 'extra virgin olive oil',
   'instructions': '',
   'simple_name': 'extra virgin olive oil'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '4',
   'unit': 'cloves',
   'name': 'garlic lightly smashed',
   'instructions': '',
   'simple_name': 'garlic lightly smashed'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'raw sesame seeds ',
   'instructions': '',
   'simple_name': 'raw sesame seeds '},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '2-3',
   'unit': 'teaspoons',
   'name': 'crushed red pepper flakes',
   'simple_name': 'red pepper flakes',
   'instructions': 'crushed'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '1',
   'unit': 'teaspoon',
   'name': 'ground cumin seed',
   'simple_name': 'cumin seed',
   'instructions': 'ground'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96843',
   'recipe_name': 'Ginger Coconut Sweet Potato and Rice Stew with Spiced Chili Oil',
   'amount': '1',
   'unit': 'teaspoon',
   'name': 'paprika',
   'instructions': '',
   'simple_name': 'paprika'}],
 [{'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '2',
   'unit': 'no unit',
   'name': 'large eggs, beaten',
   'instructions': 'beaten',
   'simple_name': 'large eggs'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'plain breadcrumbs',
   'instructions': '',
   'simple_name': 'plain breadcrumbs'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '1/2',
   'unit': 'cup',
   'name': 'grated parmesan cheese',
   'simple_name': 'parmesan cheese',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '1',
   'unit': 'clove',
   'name': 'garlic, grated',
   'simple_name': 'garlic',
   'instructions': 'grated'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'dried basil',
   'instructions': '',
   'simple_name': 'dried basil'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'dried oregano',
   'instructions': '',
   'simple_name': 'dried oregano'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'fresh thyme leaves ',
   'instructions': '',
   'simple_name': 'thyme leaves '},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '2',
   'unit': 'teaspoons',
   'name': 'chopped fresh sage ',
   'simple_name': 'sage',
   'instructions': 'chopped'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '1',
   'unit': 'teaspoon',
   'name': 'crushed fennel seed',
   'simple_name': 'fennel seed',
   'instructions': 'crushed'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '1',
   'unit': 'pinch',
   'name': 'crushed red pepper flakes',
   'simple_name': 'red pepper flakes',
   'instructions': 'crushed'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'kosher salt and black pepper',
   'instructions': '',
   'simple_name': 'kosher salt and black pepper'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': '1',
   'unit': 'pound',
   'name': 'cheese ravioli',
   'instructions': '',
   'simple_name': 'cheese ravioli'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'olive oil, for drizzling',
   'instructions': 'for drizzling',
   'simple_name': 'olive oil'},
  {'url': 'https://www.halfbakedharvest.com/wprm_print/96803',
   'recipe_name': 'Oven Toasted Garlic Herb Cheese Ravioli',
   'amount': 'no amount',
   'unit': 'no unit',
   'name': 'marinara sauce',
   'instructions': '',
   'simple_name': 'marinara sauce'}]]
In [221]:
# result = [format_ingredients(x) for x in sm_df['ingredients']]
# result = [format_ingredients(x) for x in sm_df['ingredients']]
results_flattened = [item for sublist in result for item in sublist]
# results_flattened
shopping_list = {}
for i,list_item in enumerate(results_flattened): 
    r = list_item['simple_name']
    name = list_item['name']
    amount = list_item['amount']
    unit = list_item['unit']
    instructions = list_item['instructions']
    tidy_text = ''
    recipe_number = list_item['url'].split('/')[-1]
    
#     WITH RECIPE "NUMBER"
    if unit == 'no unit' and amount == 'no amount' and instructions == '':
        tidy_text = '1'

    if unit == 'no unit' and amount != 'no amount' and instructions == '':
        tidy_text = 'R{}-({})'.format(recipe_number, amount)

    if unit == 'no unit' and amount != 'no amount' and instructions != '':
        tidy_text = 'R{}-({}, {})'.format(recipe_number, amount, instructions)    

    if unit != 'no unit' and amount != 'no amount' and instructions == '':
        tidy_text = 'R{}-({} {})'.format(recipe_number, amount, unit)

    if unit != 'no unit' and amount != 'no amount' and instructions != '':
        tidy_text = 'R{}-({} {}, {})'.format(recipe_number, amount, unit, instructions)

#     WITHOUT RECIPE "NUMBER"
    if unit == 'no unit' and amount == 'no amount' and instructions == '':
        tidy_text = '1'

    if unit == 'no unit' and amount != 'no amount' and instructions == '':
        tidy_text = '({})'.format(amount)

    if unit == 'no unit' and amount != 'no amount' and instructions != '':
        tidy_text = '({}, {})'.format(amount, instructions)    

    if unit != 'no unit' and amount != 'no amount' and instructions == '':
        tidy_text = '({} {})'.format(amount, unit)

    if unit != 'no unit' and amount != 'no amount' and instructions != '':
        tidy_text = '({} {}, {})'.format(amount, unit, instructions)
    
    if r in shopping_list:
        shopping_list[r] = shopping_list[r] +  ', ' + tidy_text 
    else:
        shopping_list[r] = tidy_text
In [222]:
shopping_list
Out[222]:
{'vodka': '(2 ounces)',
 'juice from 1/2 of a lime': '1',
 'apple cider': '(1/3 cup), (1/4 cup)',
 'apple butter': '(1 tablespoon)',
 'ginger': '(1-2 teaspoons, grated), (1/2 teaspoon, ground), (1 teaspoon, grated), (2 teaspoon, ground), (2 inches, grated)',
 'ginger beer': '',
 'pomegranate arils and cinnamon sticks': '',
 'salted butter': '(1 sticks (1/2 cup), at room temperature), (4 tablespoons, at room temperature), (8 tablespoons), (4 tablespoons), (8 tablespoons, at room temperature)',
 'packed dark brown sugar': '(1/2 cup), (1/2 cup), (3/4 cup), (1/2 cup)',
 'pure maple syrup': '(1/4 cup), (2 tablespoons)',
 'vanilla extract': '(1 teaspoon), (2 teaspoons), (2 teaspoons), (1 tablespoon), (2 teaspoons)',
 'egg': '(1, at room temperature)',
 'all-purpose flour': '(1 1/2 cups), (1/2 cup), (2 cups), (1 1/2 cups)',
 'baking soda': '(1/2 teaspoon), (1/2 teaspoon), (1/2 teaspoon)',
 'kosher salt': '(1/2 teaspoon), (1/2 teaspoon), (3/4 teaspoon)',
 'real maple syrup': '(1/2 cup), (1-2 teaspoons)',
 'eggs': '(2, at room temperature)',
 'bourbon': '(1 tablespoon), (1 1/2 ounces)',
 'pecans': '(2 cups, roughly chopped)',
 'semi-sweet chocolate chips': '(1 - 1 1/2 cups)',
 'extra virgin olive oil': '(2 tablespoons), (2 tablespoons), (2 tablespoons), (3 tablespoons), (1/3 cup)',
 'shallots': '(2, thinly sliced)',
 'thyme': '(2 tablespoons, chopped)',
 'sage': '(1 tablespoon  , chopped), (1 tablespoon, chopped), (2 teaspoons, chopped)',
 'dry white wine': '(1/2 cup, such as Pinot Grigio or Sauvignon Blanc)',
 'chicken broth': '(4 cups, low sodium), (4 cups, low-sodium)',
 'chicken': '(2 small, boneless skinless  breast sliced in half), (1 pound, boneless skinless  breast)',
 'kosher salt and black pepper': '1, 1, 1, 1, 1',
 'celery': '(2 ribs, chopped)',
 'carrots': '(4, chopped)',
 'broccoli': '(1 1/2 cups, roughly chopped  florets)',
 'cayenne pepper': '(1/4 teaspoon), (1/4- 1/2 teaspoon)',
 'garlic': '(2-4 cloves, grated), (3 cloves, grated), (4 cloves, grated), (4 cloves, grated), (1 clove, grated)',
 'rosemary': '(1 tablespoon, chopped)',
 'sheets frozen phyllo dough thawed': '(12-18)',
 'fettuccine pasta': '(1 pound)',
 'bacon': '(4, thick-cut slices  chopped)',
 'Brussels sprouts': '(3/4 pound, thinly sliced or halved)',
 'oregano': '(1 tablespoon, chopped)',
 'red pepper flakes': '(1  pinch, crushed), (2-3 teaspoons, crushed), (1 pinch, crushed)',
 'whole milk or canned coconut milk': '(2 cups)',
 'heavy cream or canned coconut milk': '(1/2 cup)',
 'cream cheese': '(2 ounces, at room temperature)',
 'Parmesan or Pecorino Romano': '(1 1/2 cups, grated)',
 'nutmeg': '(1/4 teaspoon, ground), (1/4 teaspoon, ground)',
 'Land O Lakes® Salted Butter': '(6 tablespoons), (6 tablespoons)',
 'pumpkin puree': '(1 cup), (1 1/2 cups)',
 'spiced apple cider': '(1 1/2 cups)',
 'large eggs': '(2), (2, at room temperature), (2, beaten)',
 'baking powder': '(1 tablespoon), (1 1/4 teaspoons)',
 'cinnamon': '(1 1/2 teaspoons), (1/8 teaspoon, ground), (4 teaspoons, ground), (1/4 teaspoon)',
 'maple syrup': '(1/2 cup)',
 'flaky sea salt': '(1 pinch)',
 'medium yellow onion': '(1, chopped)',
 'poblano peppers': '(2, chopped)',
 'chipotle peppers in adobo': '(2-4, chopped)',
 'smoked paprika': '(1 tablespoon)',
 'cumin': '(2 teaspoons, ground)',
 'fire-roasted diced tomatoes': '(2 (14 ounce) cans)',
 'juice of 2 limes': '',
 'cilantro': '(1/2 cup, chopped), (1/3 cup, chopped)',
 'sliced avocado': '',
 'salty lime chips': '1',
 'cinnamon sugar': '',
 'lemon juice': '(1 ounce)',
 'sparkling hard Honeycrisp apple cider': '(5 ounces)',
 'cinnamon sticks': '',
 'cardamom': '(1 teaspoon, ground)',
 'freshly nutmeg': '(1/2 teaspoon, grated)',
 'all-spice': '(1/2 teaspoon)',
 'cloves': '(1/2 teaspoon, ground)',
 'black pepper': '(1/8 teaspoon, ground)',
 'granulated sugar': '(1/3 cup)',
 'melted coconut oil': '(1/2 cup)',
 'heavy cream': '(1/4 cup)',
 'powdered sugar': '(1 1/2 cups)',
 'yellow onion': '(1, chopped)',
 'sweet potatoes': '(2, peeled and cubed)',
 'garam masala': '(2 teaspoons)',
 'turmeric': '(1 teaspoon)',
 'coconut milk': '(1 (14 ounce) can)',
 'kale': '(3 cups, chopped)',
 'cooked basmati rice': '(2 cups)',
 'garlic lightly smashed': '(4 cloves)',
 'raw sesame seeds ': '(1 tablespoon)',
 'cumin seed': '(1 teaspoon, ground)',
 'paprika': '(1 teaspoon)',
 'plain breadcrumbs': '(1/2 cup)',
 'parmesan cheese': '(1/2 cup, grated)',
 'dried basil': '(1 tablespoon)',
 'dried oregano': '(1 tablespoon)',
 'thyme leaves ': '(1 tablespoon)',
 'fennel seed': '(1 teaspoon, crushed)',
 'cheese ravioli': '(1 pound)',
 'olive oil': '',
 'marinara sauce': '1'}

PROBLEM: Egg, eggs, large eggs

In [223]:
test = 'https://www.halfbakedharvest.com/wprm_print/97107'
test.split('/')[-1]
Out[223]:
'97107'
In [224]:
test = {'url': 'https://www.halfbakedharvest.com/wprm_print/97147',
   'recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust',
   'amount': '2-4',
   'unit': 'cloves',
   'name': 'garlic, grated',
   'simple_name': 'garlic, grated',
   'instructions': 'grated'}

test2 = {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'chopped fresh sage',
   'simple_name': 'chopped sage',
   'instructions': 'chopped'}
In [225]:
# test = "{'url': 'https://www.halfbakedharvest.com/wprm_print/97147','recipe_name': 'Skillet Chicken and Broccoli Pot Pie with Garlic Butter Phyllo Crust','amount': '2-4','unit': 'cloves','name': 'garlic, grated','simple_name': 'garlic, grated','instructions': 'grated'}"
In [226]:
meats = ['chicken', 'chicken broth', 'broccoli', 'bacon']
methods = ['chopped', 'roughly chopped', 'crushed', 'grated','ground']
to_remove = ['fresh']


ing = test2

tidy_text = ''
name = ing['name']
amount = ing['amount']
unit = ing['unit']
instructions = ''
simple_name = ''


new_name = ''

if ',' in name:

    new_name = name.split(',')[0]
    instructions = name.split(',')[1].strip()
    simple_name = new_name
    ing['simple_name'] = simple_name
    ing['instructions'] = instructions   



for method in methods:
    if method in name:
        instructions = method.strip()
        new_name = name.split(',')[0]
        new_name = new_name.replace(method + ' ', '').strip()
        print(new_name)
        simple_name = new_name
        ing['simple_name'] = simple_name
        ing['instructions'] = instructions   


for meat in meats:
    if meat in name:
        name = name.replace(',', '')
#                 print(name)
        instructions = name.replace(meat, '').strip()
        simple_name = meat.strip() 
        ing['simple_name'] = simple_name
        ing['instructions'] = instructions                
#         print(instructions)
ing['instructions'] = instructions


if simple_name == '':
    simple_name = name

ing['simple_name'] = simple_name
print(ing)
fresh sage
{'url': 'https://www.halfbakedharvest.com/wprm_print/97107', 'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo', 'amount': '1', 'unit': 'tablespoon', 'name': 'chopped fresh sage', 'simple_name': 'fresh sage', 'instructions': 'chopped'}
In [ ]:
 test2 = {'url': 'https://www.halfbakedharvest.com/wprm_print/97107',
   'recipe_name': 'Brown Butter Brussels Sprout and Bacon Fettuccine Alfredo',
   'amount': '1',
   'unit': 'tablespoon',
   'name': 'chopped fresh sage',
   'simple_name': 'chopped sage',
   'instructions': 'chopped'},