mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 04:39:54 -05:00
Update recipe_url_import.py
This commit is contained in:
@@ -378,7 +378,7 @@ def get_minutes(time_text):
|
|||||||
re.IGNORECASE,
|
re.IGNORECASE,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
return int(element)
|
return int(time_text)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -388,6 +388,10 @@ def get_minutes(time_text):
|
|||||||
time_text = time_text.split("-", 2)[
|
time_text = time_text.split("-", 2)[
|
||||||
1
|
1
|
||||||
] # sometimes formats are like this: '12-15 minutes'
|
] # sometimes formats are like this: '12-15 minutes'
|
||||||
|
if " to " in time_text:
|
||||||
|
time_text = time_text.split("to", 2)[
|
||||||
|
1
|
||||||
|
] # sometimes formats are like this: '12 to 15 minutes'
|
||||||
|
|
||||||
empty = ''
|
empty = ''
|
||||||
for x in time_text:
|
for x in time_text:
|
||||||
@@ -401,7 +405,7 @@ def get_minutes(time_text):
|
|||||||
|
|
||||||
minutes = int(matched.groupdict().get("minutes") or 0)
|
minutes = int(matched.groupdict().get("minutes") or 0)
|
||||||
|
|
||||||
if "/" in (hours := matched.groupdict().get("hours")):
|
if "/" in (hours := matched.groupdict().get("hours") or ''):
|
||||||
number = hours.split(" ")
|
number = hours.split(" ")
|
||||||
if len(number) == 2:
|
if len(number) == 2:
|
||||||
minutes += 60*int(number[0])
|
minutes += 60*int(number[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user