on master help sign in
[fix] handle missing url in twitter results
commit28493d41a327128762c6286a625d219e4b0b4e2e authorAdam Tauber <adam.tauber@balabit.com> dateTue 25 Aug 2015, 13:12 (11 years ago) parentc706bea
1 file changed+6−2
searx/engines/twitter.py+6−2
searx/engines/twitter.py+6−2
@@ -55,10 +55,14 @@ def response(resp):
5555
5656 # parse results
5757 for tweet in dom.xpath(results_xpath):
58− link = tweet.xpath(link_xpath)[0]
58+ try:
59+ link = tweet.xpath(link_xpath)[0]
60+ content = extract_text(tweet.xpath(content_xpath)[0])
61+ except Exception:
62+ continue
63+
5964 url = urljoin(base_url, link.attrib.get('href'))
6065 title = extract_text(tweet.xpath(title_xpath))
61− content = extract_text(tweet.xpath(content_xpath)[0])
6266
6367 pubdate = tweet.xpath(timestamp_xpath)
6468 if len(pubdate) > 0: