mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	Merge pull request #1308 from allendema/add-yep-com-json
[enh] Add yep.com via json_engine
This commit is contained in:
		
						commit
						2455f1d06a
					
				
					 2 changed files with 32 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -16,6 +16,11 @@ paging = False
 | 
			
		|||
suggestion_query = ''
 | 
			
		||||
results_query = ''
 | 
			
		||||
 | 
			
		||||
cookies = {}
 | 
			
		||||
headers = {}
 | 
			
		||||
'''Some engines might offer different result based on cookies or headers.
 | 
			
		||||
Possible use-case: To set safesearch cookie or header to moderate.'''
 | 
			
		||||
 | 
			
		||||
# parameters for engines with paging support
 | 
			
		||||
#
 | 
			
		||||
# number of results on each page
 | 
			
		||||
| 
						 | 
				
			
			@ -88,6 +93,9 @@ def request(query, params):
 | 
			
		|||
    if paging and search_url.find('{pageno}') >= 0:
 | 
			
		||||
        fp['pageno'] = (params['pageno'] - 1) * page_size + first_page_num
 | 
			
		||||
 | 
			
		||||
    params['cookies'].update(cookies)
 | 
			
		||||
    params['headers'].update(headers)
 | 
			
		||||
 | 
			
		||||
    params['url'] = search_url.format(**fp)
 | 
			
		||||
    params['query'] = query
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -402,6 +402,30 @@ engines:
 | 
			
		|||
      require_api_key: false
 | 
			
		||||
      results: JSON
 | 
			
		||||
 | 
			
		||||
  - name: yep
 | 
			
		||||
    engine: json_engine
 | 
			
		||||
    shortcut: yep
 | 
			
		||||
    categories: general
 | 
			
		||||
    disabled: true
 | 
			
		||||
    paging: false
 | 
			
		||||
    page_size: 10
 | 
			
		||||
    content_html_to_text: true
 | 
			
		||||
    title_html_to_text: true
 | 
			
		||||
    search_url: https://api.yep.com/fs/1/?type=web&q={query}&no_correct=false
 | 
			
		||||
    results_query: 1/results
 | 
			
		||||
    title_query: title
 | 
			
		||||
    url_query: url
 | 
			
		||||
    content_query: snippet
 | 
			
		||||
    timeout: 12.0
 | 
			
		||||
    headers:
 | 
			
		||||
      'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8'
 | 
			
		||||
      'Sec-Fetch-Dest': 'document'
 | 
			
		||||
    about:
 | 
			
		||||
      website: https://yep.com
 | 
			
		||||
      use_official_api: false
 | 
			
		||||
      require_api_key: false
 | 
			
		||||
      results: JSON
 | 
			
		||||
 | 
			
		||||
  - name: currency
 | 
			
		||||
    engine: currency_convert
 | 
			
		||||
    categories: general
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue