on master help sign in
[enh] use format to concatenate strings
commit5278fa666c193e5ccb30e7b5f8dddf1b053f97ca authorjibe-b <user701@orange.fr> dateWed 27 Sep 2017, 16:01 (9 years ago) parent3e3672e
1 file changed+6−4
searx/engines/arxiv.py+6−4
searx/engines/arxiv.py+6−4
@@ -48,14 +48,16 @@ def response(resp):
4848
4949 url = entry.xpath('.//id')[0].text
5050
51− content = entry.xpath('.//summary')[0].text
51+ content_string = '{doi_content}{abstract_content}'
52+
53+ abstract = entry.xpath('.//summary')[0].text
5254
5355 # If a doi is available, add it to the snipppet
5456 try:
55− doi = entry.xpath('.//link[@title="doi"]')[0].text
56− content = 'DOI: ' + doi + ' Abstract: ' + content
57+ doi_content = entry.xpath('.//link[@title="doi"]')[0].text
58+ content = content_string.format(doi_content=doi_content, abstract_content=abstract_content)
5759 except:
58− pass
60+ content = content_string.format(abstract_content=abstract_content)
5961
6062 if len(content) > 300:
6163 content = content[0:300] + "..."