Skip to content

Commit

Permalink
Update hellofresh.py
Browse files Browse the repository at this point in the history
Removed "return 0" and implemented recommended adjustments.
  • Loading branch information
jknndy committed Oct 1, 2023
1 parent 02b9f48 commit f876d1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions recipe_scrapers/hellofresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def cook_time(self):
if total_time_match:
total_time_str = total_time_match.group(1)
return get_minutes(total_time_str)
return 0

def prep_time(self):
script_tag = self.soup.find("script", {"id": "__NEXT_DATA__"})
Expand All @@ -31,12 +30,13 @@ def prep_time(self):
if prep_time_match:
prep_time_str = prep_time_match.group(1)
return get_minutes(prep_time_str)
return 0

# Note: HelloFresh uses the 'totalTime' metadata field to represent only the cook time.
# To get the actual total time, the 'prepTime' and 'totalTime' (which is the cook time) need to be added.
def total_time(self):
return self.cook_time() + self.prep_time()
prep_time, cook_time = self.prep_time(), self.cook_time()
if prep_time or cook_time:
return (prep_time or 0) + (cook_time or 0)

def yields(self):
return self.schema.yields()
Expand Down

0 comments on commit f876d1e

Please sign in to comment.