mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-06 22:58:19 -05:00
fixed description length limit
This commit is contained in:
@@ -40,7 +40,6 @@ def get_from_scraper(scrape, request):
|
|||||||
except Exception:
|
except Exception:
|
||||||
description = ''
|
description = ''
|
||||||
|
|
||||||
recipe_json['description'] = parse_description(description)[:512]
|
|
||||||
recipe_json['internal'] = True
|
recipe_json['internal'] = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -131,6 +130,11 @@ def get_from_scraper(scrape, request):
|
|||||||
if len(recipe_json['steps']) == 0:
|
if len(recipe_json['steps']) == 0:
|
||||||
recipe_json['steps'].append({'instruction': '', 'ingredients': [], })
|
recipe_json['steps'].append({'instruction': '', 'ingredients': [], })
|
||||||
|
|
||||||
|
if len(parse_description(description)) > 256: # split at 256 as long descriptions dont look good on recipe cards
|
||||||
|
recipe_json['steps'][0]['instruction'] = f'*{parse_description(description)}* \n\n' + recipe_json['steps'][0]['instruction']
|
||||||
|
else:
|
||||||
|
recipe_json['description'] = parse_description(description)[:512]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for x in scrape.ingredients():
|
for x in scrape.ingredients():
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user