summaryrefslogtreecommitdiff
path: root/searx/engines/arxiv.py
diff options
context:
space:
mode:
authorjibe-b <user701@orange.fr>2017-09-27 16:01:31 +0200
committerNoémi Ványi <sitbackandwait@gmail.com>2017-11-01 11:54:38 +0100
commit5278fa666c193e5ccb30e7b5f8dddf1b053f97ca (patch)
tree9bbb4ec002226491205330ad61c6b6061b914fe0 /searx/engines/arxiv.py
parent3e3672e0790266fc7f2482fdd854d7789a915d4d (diff)
downloadsearxng-5278fa666c193e5ccb30e7b5f8dddf1b053f97ca.tar.gz
searxng-5278fa666c193e5ccb30e7b5f8dddf1b053f97ca.zip
[enh] use format to concatenate strings
Diffstat (limited to 'searx/engines/arxiv.py')
-rw-r--r--searx/engines/arxiv.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/searx/engines/arxiv.py b/searx/engines/arxiv.py
index cbeac0089..4b6440cbc 100644
--- a/searx/engines/arxiv.py
+++ b/searx/engines/arxiv.py
@@ -48,14 +48,16 @@ def response(resp):
url = entry.xpath('.//id')[0].text
- content = entry.xpath('.//summary')[0].text
+ content_string = '{doi_content}{abstract_content}'
+
+ abstract = entry.xpath('.//summary')[0].text
# If a doi is available, add it to the snipppet
try:
- doi = entry.xpath('.//link[@title="doi"]')[0].text
- content = 'DOI: ' + doi + ' Abstract: ' + content
+ doi_content = entry.xpath('.//link[@title="doi"]')[0].text
+ content = content_string.format(doi_content=doi_content, abstract_content=abstract_content)
except:
- pass
+ content = content_string.format(abstract_content=abstract_content)
if len(content) > 300:
content = content[0:300] + "..."