.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.chefkoch Namespace Reference

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
bool paging = True
 
list categories = []
 
int number_of_results = 20
 
bool skip_premium = True
 
str base_url = "https://api.chefkoch.de"
 
str thumbnail_format = "crop-240x300"
 

Detailed Description

Chefkoch is a German database of recipes.

Function Documentation

◆ request()

searx.engines.chefkoch.request ( query,
params )

Definition at line 28 of file chefkoch.py.

28def request(query, params):
29 args = {'query': query, 'limit': number_of_results, 'offset': (params['pageno'] - 1) * number_of_results}
30 params['url'] = f"{base_url}/v2/search-gateway/recipes?{urlencode(args)}"
31 return params
32
33

◆ response()

searx.engines.chefkoch.response ( resp)

Definition at line 34 of file chefkoch.py.

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

Variable Documentation

◆ about

dict searx.engines.chefkoch.about
Initial value:
1= {
2 'website': "https://www.chefkoch.de",
3 'official_api_documentation': None,
4 'use_official_api': False,
5 'require_api_key': False,
6 'results': 'JSON',
7 'language': 'de',
8}

Definition at line 8 of file chefkoch.py.

◆ base_url

str searx.engines.chefkoch.base_url = "https://api.chefkoch.de"

Definition at line 24 of file chefkoch.py.

◆ categories

list searx.engines.chefkoch.categories = []

Definition at line 18 of file chefkoch.py.

◆ number_of_results

int searx.engines.chefkoch.number_of_results = 20

Definition at line 20 of file chefkoch.py.

◆ paging

bool searx.engines.chefkoch.paging = True

Definition at line 17 of file chefkoch.py.

◆ skip_premium

bool searx.engines.chefkoch.skip_premium = True

Definition at line 21 of file chefkoch.py.

◆ thumbnail_format

str searx.engines.chefkoch.thumbnail_format = "crop-240x300"

Definition at line 25 of file chefkoch.py.