add Name and Instruction automation to YouTube importer

This commit is contained in:
smilerz 2023-09-01 07:49:10 -05:00
parent c907da84c1
commit 4620ebaf30
No known key found for this signature in database
GPG Key ID: 39444C7606D47126

View File

@ -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