on master help sign in
[enh] use format to concatenate strings
5278fa6jibe-b
searx/engines/arxiv.py+6−4
@@ -48,14 +48,16 @@ def response(resp):
48
48
49 url = entry.xpath('.//id')[0].text
49 url = entry.xpath('.//id')[0].text
50
50
51+ content_string = '{doi_content}{abstract_content}'
52+
51− content = entry.xpath('.//summary')[0].text
53+ abstract = entry.xpath('.//summary')[0].text
52
54
53 # If a doi is available, add it to the snipppet
55 # If a doi is available, add it to the snipppet
54 try:
56 try:
55− doi = entry.xpath('.//link[@title="doi"]')[0].text
57+ doi_content = entry.xpath('.//link[@title="doi"]')[0].text
56− content = 'DOI: ' + doi + ' Abstract: ' + content
58+ content = content_string.format(doi_content=doi_content, abstract_content=abstract_content)
57 except:
59 except:
58− pass
60+ content = content_string.format(abstract_content=abstract_content)
59
61
60 if len(content) > 300:
62 if len(content) > 300:
61 content = content[0:300] + "..."
63 content = content[0:300] + "..."