34def response(resp):
35 results = []
36
37 json = resp.json()
38
39 for result in json['results']:
40 recipe = result['recipe']
41
42 if skip_premium and (recipe['isPremium'] or recipe['isPlus']):
43 continue
44
45 publishedDate = None
46 if recipe['submissionDate']:
47 publishedDate = datetime.strptime(result['recipe']['submissionDate'][:19], "%Y-%m-%dT%H:%M:%S")
48
49 content = [
50 f"Schwierigkeitsstufe (1-3): {recipe['difficulty']}",
51 f"Zubereitungszeit: {recipe['preparationTime']}min",
52 f"Anzahl der Zutaten: {recipe['ingredientCount']}",
53 ]
54
55 if recipe['subtitle']:
56 content.insert(0, recipe['subtitle'])
57
58 results.append(
59 {
60 'url': recipe['siteUrl'],
61 'title': recipe['title'],
62 'content': " | ".join(content),
63 'thumbnail': recipe['previewImageUrlTemplate'].replace("<format>", thumbnail_format),
64 'publishedDate': publishedDate,
65 }
66 )
67
68 return results