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

Functions

 request (query, params)
 
 _web_result (result)
 
 _images_result (result)
 
 _news_result (result)
 
 response (resp)
 

Variables

dict about
 
str base_url = "https://api.yep.com"
 
str search_type = "web"
 
bool safesearch = True
 
dict safesearch_map = {0: 'off', 1: 'moderate', 2: 'strict'}
 

Detailed Description

Yep (general, images, news)

Function Documentation

◆ _images_result()

searx.engines.yep._images_result ( result)
protected

Definition at line 45 of file yep.py.

45def _images_result(result):
46 return {
47 'template': 'images.html',
48 'url': result['host_page'],
49 'title': result.get('title', ''),
50 'content': '',
51 'img_src': result['image_id'],
52 'thumbnail_src': result['src'],
53 }
54
55

Referenced by searx.engines.yep.response().

+ Here is the caller graph for this function:

◆ _news_result()

searx.engines.yep._news_result ( result)
protected

Definition at line 56 of file yep.py.

56def _news_result(result):
57 return {
58 'url': result['url'],
59 'title': result['title'],
60 'content': html_to_text(result['snippet']),
61 'publishedDate': datetime.strptime(result['first_seen'][:19], '%Y-%m-%dT%H:%M:%S'),
62 }
63
64

Referenced by searx.engines.yep.response().

+ Here is the caller graph for this function:

◆ _web_result()

searx.engines.yep._web_result ( result)
protected

Definition at line 37 of file yep.py.

37def _web_result(result):
38 return {
39 'url': result['url'],
40 'title': result['title'],
41 'content': html_to_text(result['snippet']),
42 }
43
44

Referenced by searx.engines.yep.response().

+ Here is the caller graph for this function:

◆ request()

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

Definition at line 24 of file yep.py.

24def request(query, params):
25 args = {
26 'client': 'web',
27 'no_correct': 'false',
28 'q': query,
29 'safeSearch': safesearch_map[params['safesearch']],
30 'type': search_type,
31 }
32 params['url'] = f"{base_url}/fs/2/search?{urlencode(args)}"
33 params['headers']['Referer'] = 'https://yep.com/'
34 return params
35
36

◆ response()

searx.engines.yep.response ( resp)

Definition at line 65 of file yep.py.

65def response(resp):
66 results = []
67
68 for result in resp.json()[1]['results']:
69 if search_type == "web":
70 if result['type'] != 'Organic':
71 continue
72 results.append(_web_result(result))
73 elif search_type == "images":
74 results.append(_images_result(result))
75 elif search_type == "news":
76 results.append(_news_result(result))
77 else:
78 raise ValueError(f"Unsupported yep search type: {search_type}")
79
80 return results

References searx.engines.yep._images_result(), searx.engines.yep._news_result(), and searx.engines.yep._web_result().

+ Here is the call graph for this function:

Variable Documentation

◆ about

dict searx.engines.yep.about
Initial value:
1= {
2 'website': 'https://yep.com/',
3 'official_api_documentation': 'https://docs.developer.yelp.com',
4 'use_official_api': False,
5 'require_api_key': False,
6 'results': 'JSON',
7}

Definition at line 9 of file yep.py.

◆ base_url

str searx.engines.yep.base_url = "https://api.yep.com"

Definition at line 17 of file yep.py.

◆ safesearch

bool searx.engines.yep.safesearch = True

Definition at line 20 of file yep.py.

◆ safesearch_map

dict searx.engines.yep.safesearch_map = {0: 'off', 1: 'moderate', 2: 'strict'}

Definition at line 21 of file yep.py.

◆ search_type

str searx.engines.yep.search_type = "web"

Definition at line 18 of file yep.py.