fixed youtube import and handle resize without ingredients
This commit is contained in:
parent
2cb010c8b4
commit
11c8422fbb
@ -258,12 +258,13 @@ def get_from_youtube_scraper(url, request):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO add automation here
|
|
||||||
try:
|
try:
|
||||||
automation_engine = AutomationEngine(request, source=url)
|
automation_engine = AutomationEngine(request, source=url)
|
||||||
video = YouTube(url=url)
|
video = YouTube(url)
|
||||||
|
video.streams.first() # this is required to execute some kind of generator/web request that fetches the description
|
||||||
default_recipe_json['name'] = automation_engine.apply_regex_replace_automation(video.title, Automation.NAME_REPLACE)
|
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['image'] = video.thumbnail_url
|
||||||
|
if video.description:
|
||||||
default_recipe_json['steps'][0]['instruction'] = automation_engine.apply_regex_replace_automation(video.description, Automation.INSTRUCTION_REPLACE)
|
default_recipe_json['steps'][0]['instruction'] = automation_engine.apply_regex_replace_automation(video.description, Automation.INSTRUCTION_REPLACE)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -277,9 +277,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleResize: function () {
|
handleResize: function () {
|
||||||
if (document.getElementById('nutrition_container') !== null) {
|
if (document.getElementById('ingredient_container') !== null) {
|
||||||
this.ingredient_height = document.getElementById('ingredient_container').clientHeight - document.getElementById('nutrition_container').clientHeight
|
|
||||||
} else {
|
|
||||||
this.ingredient_height = document.getElementById('ingredient_container').clientHeight
|
this.ingredient_height = document.getElementById('ingredient_container').clientHeight
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user