40def response(resp):
41 results = []
42
43 json = resp.json()
44
45 for result in json['feed']:
46
47 if not show_pro_recipes and result['proRecipe']:
48 continue
49
50 content = result['seo']['web']['meta-tags']['description']
51 description = result['content']['description']
52 if description is not None:
53 content = markdown_to_text(description['text'])
54
55 thumbnail = None
56 if result['display']['images']:
57 thumbnail = result['display']['images'][0]
58 elif result['content']['details']['images']:
59 thumbnail = result['content']['details']['images'][0]['resizableImageUrl']
60
61 url = result['display']['source']['sourceRecipeUrl']
62 if 'www.yummly.com/private' in url:
63 url = base_url + '/' + result['tracking-id']
64
65 results.append(
66 {
67 'url': url,
68 'title': result['display']['displayName'],
69 'content': content,
70 'thumbnail': thumbnail,
71 'metadata': gettext('Language') + f": {result['locale'].split('-')[0]}",
72 }
73 )
74
75 for suggestion in json['relatedPhrases']['keywords']:
76 results.append({'suggestion': suggestion})
77
78 return results