def parse_soup_epicurious(soup): r = Recipe() r.title = soup.find('h1', {'class': 'fn'}).next.strip() try: r.servings = extract_int_from_string(soup.find('span', {'class': 'yield'}).next) except AttributeError: pass r.ingredients = [i.next.string for i in soup.findAll('li', {'class': 'ingredient'})] par = soup.find('div', {'id': 'at_a_glance'}) r.tags = [t.next.string.lower() for t in par.findAll('a')] r.directions = [p.next.strip().replace('\r\n',' ') for p in soup.findAll('p', {'class': 'instruction'})] try: r.cooking_time = extract_int_from_string(soup.find('span', {'class': 'prepTime'}).next) except AttributeError: pass try: r.prep_time = extract_int_from_string(soup.find('span', {'class': 'duration'}).next) except AttributeError: pass return r