summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2020-01-02 22:29:10 +0100
committerAdam Tauber <asciimoo@gmail.com>2020-01-02 22:29:10 +0100
commit2dc2e1e8f9c8ae0d28df56f42b2f4949d8611624 (patch)
tree85286d838d76dcd9edf306495155eeef371a4060 /searx/engines
parent2292e6e130dca104cb324197b63611a012e4ef3c (diff)
downloadsearxng-2dc2e1e8f9c8ae0d28df56f42b2f4949d8611624.tar.gz
searxng-2dc2e1e8f9c8ae0d28df56f42b2f4949d8611624.zip
[fix] skip invalid encoded attributes
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/flickr_noapi.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/searx/engines/flickr_noapi.py b/searx/engines/flickr_noapi.py
index 198ac2cff..e1abb378f 100644
--- a/searx/engines/flickr_noapi.py
+++ b/searx/engines/flickr_noapi.py
@@ -109,14 +109,22 @@ def response(resp):
else:
url = build_flickr_url(photo['ownerNsid'], photo['id'])
- results.append({'url': url,
- 'title': title,
- 'img_src': img_src,
- 'thumbnail_src': thumbnail_src,
- 'content': content,
- 'author': author,
- 'source': source,
- 'img_format': img_format,
- 'template': 'images.html'})
+ result = {
+ 'url': url,
+ 'img_src': img_src,
+ 'thumbnail_src': thumbnail_src,
+ 'source': source,
+ 'img_format': img_format,
+ 'template': 'images.html'
+ }
+ try:
+ result['author'] = author.encode('utf-8')
+ result['title'] = title.encode('utf-8')
+ result['content'] = content.encode('utf-8')
+ except:
+ result['author'] = ''
+ result['title'] = ''
+ result['content'] = ''
+ results.append(result)
return results