diff --git a/plugins/recipe.py b/plugins/recipe.py index 8b4438c..c9c1c90 100644 --- a/plugins/recipe.py +++ b/plugins/recipe.py @@ -52,13 +52,16 @@ def recipe(inp): return "Could not get recipe: {}".format(e) # find the list of results - results = search.find('div', {'class': 'found_results'}) + result_list = search.find('div', {'class': 'found_results'}) - if results: - result = results.find('div', {'class': 'recipe_result'}) + if result_list: + results = result_list.find_all('div', {'class': 'recipe_result'}) else: return "No results" + # pick a random front page result + result = random.choice(results) + # extract the URL from the result url = BASE_URL + result.find('div', {'class': 'image-wrapper'}).find('a')['href']