diff options
author | jazzzooo <38244149+jazzzooo@users.noreply.github.com> | 2023-09-12 07:23:24 +0000 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-09-12 11:31:43 +0200 |
commit | b189578b6b3a08af5ba6ab2b7d618bd0ebefc434 (patch) | |
tree | 0b07146b733ef32e4ae2f326321ce5127f11d904 | |
parent | f182abd6f8f1eac20d19c3e4b4c9800115f2a705 (diff) | |
download | searxng-b189578b6b3a08af5ba6ab2b7d618bd0ebefc434.tar.gz searxng-b189578b6b3a08af5ba6ab2b7d618bd0ebefc434.zip |
[fix] engine - brave
-rw-r--r-- | searx/engines/brave.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/searx/engines/brave.py b/searx/engines/brave.py index e9d4af762..f1fad6292 100644 --- a/searx/engines/brave.py +++ b/searx/engines/brave.py @@ -241,17 +241,17 @@ def _parse_search(resp): result_list.append({'answer': extract_text(answer_tag), 'url': url}) # xpath_results = '//div[contains(@class, "snippet fdb") and @data-type="web"]' - xpath_results = '//div[contains(@class, "snippet")]' + xpath_results = '//div[contains(@class, "snippet ")]' for result in eval_xpath_list(dom, xpath_results): - url = eval_xpath_getindex(result, './/a[@class="result-header"]/@href', 0, default=None) - title_tag = eval_xpath_getindex(result, './/span[@class="snippet-title"]', 0, default=None) - if not (url and title_tag): + url = eval_xpath_getindex(result, './/a[contains(@class, "h")]/@href', 0, default=None) + title_tag = eval_xpath_getindex(result, './/div[contains(@class, "title")]', 0, default=None) + if url is None or title_tag is None: continue - content_tag = eval_xpath_getindex(result, './/p[@class="snippet-description"]', 0, default='') - img_src = eval_xpath_getindex(result, './/img[@class="thumb"]/@src', 0, default='') + content_tag = eval_xpath_getindex(result, './/div[@class="snippet-description"]', 0, default='') + img_src = eval_xpath_getindex(result, './/img[contains(@class, "thumb")]/@src', 0, default='') item = { 'url': url, |