From 4620ebaf30570b70b6909ad1259c224db08bfdaa Mon Sep 17 00:00:00 2001 From: smilerz Date: Fri, 1 Sep 2023 07:49:10 -0500 Subject: [PATCH] add Name and Instruction automation to YouTube importer --- cookbook/helper/recipe_url_import.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index 3f7b65f4..8794c01a 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -261,10 +261,12 @@ def get_from_youtube_scraper(url, request): # TODO add automation here try: + automation_engine = AutomationEngine(request, source=url) video = YouTube(url=url) - default_recipe_json['name'] = video.title + default_recipe_json['name'] = automation_engine.apply_regex_replace_automation(video.title, Automation.NAME_REPLACE) default_recipe_json['image'] = video.thumbnail_url - default_recipe_json['steps'][0]['instruction'] = video.description + default_recipe_json['steps'][0]['instruction'] = automation_engine.apply_regex_replace_automation(video.description, Automation.INSTRUCTION_REPLACE) + except Exception: pass