summaryrefslogtreecommitdiff
path: root/searx/engines/twitter.py
diff options
context:
space:
mode:
authorAdam Tauber <adam.tauber@balabit.com>2015-08-25 13:12:51 +0200
committerAdam Tauber <adam.tauber@balabit.com>2015-08-25 13:12:51 +0200
commit28493d41a327128762c6286a625d219e4b0b4e2e (patch)
tree561d0219034385e3f396215e95c24da9f098bbf1 /searx/engines/twitter.py
parentc706bea788d46bae8cb5cd71bc57abf71f1cb998 (diff)
downloadsearxng-28493d41a327128762c6286a625d219e4b0b4e2e.tar.gz
searxng-28493d41a327128762c6286a625d219e4b0b4e2e.zip
[fix] handle missing url in twitter results
Diffstat (limited to 'searx/engines/twitter.py')
-rw-r--r--searx/engines/twitter.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/searx/engines/twitter.py b/searx/engines/twitter.py
index a0ee18a47..36efac186 100644
--- a/searx/engines/twitter.py
+++ b/searx/engines/twitter.py
@@ -55,10 +55,14 @@ def response(resp):
# parse results
for tweet in dom.xpath(results_xpath):
- link = tweet.xpath(link_xpath)[0]
+ try:
+ link = tweet.xpath(link_xpath)[0]
+ content = extract_text(tweet.xpath(content_xpath)[0])
+ except Exception:
+ continue
+
url = urljoin(base_url, link.attrib.get('href'))
title = extract_text(tweet.xpath(title_xpath))
- content = extract_text(tweet.xpath(content_xpath)[0])
pubdate = tweet.xpath(timestamp_xpath)
if len(pubdate) > 0: