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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['science', 'scientific publications']
 
bool paging = True
 
int nb_per_page = 10
 
str api_key = 'unset'
 
str base_url = 'https://api.springernature.com/metadata/json?'
 

Detailed Description

Springer Nature (science)

Function Documentation

◆ request()

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

Definition at line 29 of file springer.py.

29def request(query, params):
30 if api_key == 'unset':
31 raise SearxEngineAPIException('missing Springer-Nature API key')
32 args = urlencode({'q': query, 's': nb_per_page * (params['pageno'] - 1), 'p': nb_per_page, 'api_key': api_key})
33 params['url'] = base_url + args
34 logger.debug("query_url --> %s", params['url'])
35 return params
36
37

◆ response()

searx.engines.springer.response ( resp)

Definition at line 38 of file springer.py.

38def response(resp):
39 results = []
40 json_data = loads(resp.text)
41
42 for record in json_data['records']:
43 published = datetime.strptime(record['publicationDate'], '%Y-%m-%d')
44 authors = [" ".join(author['creator'].split(', ')[::-1]) for author in record['creators']]
45 tags = record.get('genre')
46 if isinstance(tags, str):
47 tags = [tags]
48 results.append(
49 {
50 'template': 'paper.html',
51 'url': record['url'][0]['value'].replace('http://', 'https://', 1),
52 'title': record['title'],
53 'content': record['abstract'],
54 'comments': record['publicationName'],
55 'tags': tags,
56 'publishedDate': published,
57 'type': record.get('contentType'),
58 'authors': authors,
59 # 'editor': '',
60 'publisher': record.get('publisher'),
61 'journal': record.get('publicationName'),
62 'volume': record.get('volume') or None,
63 'pages': '-'.join([x for x in [record.get('startingPage'), record.get('endingPage')] if x]),
64 'number': record.get('number') or None,
65 'doi': record.get('doi'),
66 'issn': [x for x in [record.get('issn')] if x],
67 'isbn': [x for x in [record.get('isbn')] if x],
68 # 'pdf_url' : ''
69 }
70 )
71 return results

Variable Documentation

◆ about

dict searx.engines.springer.about
Initial value:
1= {
2 "website": 'https://www.springernature.com/',
3 "wikidata_id": 'Q21096327',
4 "official_api_documentation": 'https://dev.springernature.com/',
5 "use_official_api": True,
6 "require_api_key": True,
7 "results": 'JSON',
8}

Definition at line 12 of file springer.py.

◆ api_key

str searx.engines.springer.api_key = 'unset'

Definition at line 24 of file springer.py.

◆ base_url

str searx.engines.springer.base_url = 'https://api.springernature.com/metadata/json?'

Definition at line 26 of file springer.py.

◆ categories

list searx.engines.springer.categories = ['science', 'scientific publications']

Definition at line 21 of file springer.py.

◆ nb_per_page

int searx.engines.springer.nb_per_page = 10

Definition at line 23 of file springer.py.

◆ paging

bool searx.engines.springer.paging = True

Definition at line 22 of file springer.py.