forked from zaclys/searxng
[fix] handle missing url in twitter results
This commit is contained in:
parent
c706bea788
commit
28493d41a3
|
@ -55,10 +55,14 @@ def response(resp):
|
||||||
|
|
||||||
# parse results
|
# parse results
|
||||||
for tweet in dom.xpath(results_xpath):
|
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'))
|
url = urljoin(base_url, link.attrib.get('href'))
|
||||||
title = extract_text(tweet.xpath(title_xpath))
|
title = extract_text(tweet.xpath(title_xpath))
|
||||||
content = extract_text(tweet.xpath(content_xpath)[0])
|
|
||||||
|
|
||||||
pubdate = tweet.xpath(timestamp_xpath)
|
pubdate = tweet.xpath(timestamp_xpath)
|
||||||
if len(pubdate) > 0:
|
if len(pubdate) > 0:
|
||||||
|
|
Loading…
Reference in New Issue