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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['images']
 
bool paging = True
 
str base_url = 'https://www.pinterest.com'
 

Detailed Description

Pinterest (images)

Function Documentation

◆ request()

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

Definition at line 22 of file pinterest.py.

22def request(query, params):
23 args = {
24 'options': {
25 'query': query,
26 'bookmarks': [params['engine_data'].get('bookmark', '')],
27 },
28 'context': {},
29 }
30 params['url'] = f"{base_url}/resource/BaseSearchResource/get/?data={dumps(args)}"
31
32 return params
33
34

◆ response()

searx.engines.pinterest.response ( resp)

Definition at line 35 of file pinterest.py.

35def response(resp):
36 results = []
37
38 json_resp = resp.json()
39
40 results.append(
41 {
42 'engine_data': json_resp['resource_response']['bookmark'],
43 # it's called bookmark by pinterest, but it's rather a nextpage
44 # parameter to get the next results
45 'key': 'bookmark',
46 }
47 )
48
49 for result in json_resp['resource_response']['data']['results']:
50
51 if result['type'] == 'story':
52 continue
53
54 results.append(
55 {
56 'template': 'images.html',
57 'url': result['link'] or f"{base_url}/pin/{result['id']}/",
58 'title': result.get('title') or result.get('grid_title'),
59 'content': (result.get('rich_summary') or {}).get('display_description') or "",
60 'img_src': result['images']['orig']['url'],
61 'thumbnail_src': result['images']['236x']['url'],
62 'source': (result.get('rich_summary') or {}).get('site_name'),
63 }
64 )
65
66 return results

Variable Documentation

◆ about

dict searx.engines.pinterest.about
Initial value:
1= {
2 "website": 'https://www.pinterest.com/',
3 "wikidata_id": 'Q255381',
4 "official_api_documentation": 'https://developers.pinterest.com/docs/api/v5/',
5 "use_official_api": False,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 7 of file pinterest.py.

◆ base_url

str searx.engines.pinterest.base_url = 'https://www.pinterest.com'

Definition at line 19 of file pinterest.py.

◆ categories

list searx.engines.pinterest.categories = ['images']

Definition at line 16 of file pinterest.py.

◆ paging

bool searx.engines.pinterest.paging = True

Definition at line 17 of file pinterest.py.