mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00:00
[fix] brave: content description also contains website URL (#5502)
there are other classes like 'site-name-content' we don't want to match, however only using contains(@class, 'content') would e.g. also match `site-name-content` thus, we explicitly also require the spaces as class separator
This commit is contained in:
@@ -301,7 +301,10 @@ def _parse_search(resp: SXNG_Response) -> EngineResults:
|
|||||||
content: str = ""
|
content: str = ""
|
||||||
pub_date = None
|
pub_date = None
|
||||||
|
|
||||||
_content = eval_xpath_getindex(result, ".//div[contains(@class, 'content')]", 0, default="")
|
# there are other classes like 'site-name-content' we don't want to match,
|
||||||
|
# however only using contains(@class, 'content') would e.g. also match `site-name-content`
|
||||||
|
# thus, we explicitly also require the spaces as class separator
|
||||||
|
_content = eval_xpath_getindex(result, ".//div[contains(concat(' ', @class, ' '), ' content ')]", 0, default="")
|
||||||
if len(_content):
|
if len(_content):
|
||||||
content = extract_text(_content) # type: ignore
|
content = extract_text(_content) # type: ignore
|
||||||
_pub_date = extract_text(
|
_pub_date = extract_text(
|
||||||
|
|||||||
Reference in New Issue
Block a user