diff options
| author | Austin-Olacsi <138650713+Austin-Olacsi@users.noreply.github.com> | 2025-11-10 09:27:00 -0700 |
|---|---|---|
| committer | Bnyro <bnyro@tutanota.com> | 2025-11-10 20:37:01 +0100 |
| commit | 7a1b959646c45a81d3495148b1fa6c2da585eb59 (patch) | |
| tree | 0ce8cecc4152f4ab8729303b8b229e2ca2ab6ef7 /searx/engines | |
| parent | b9b46431bedb9bb493553a7ddd3611162a59a16e (diff) | |
[fix] hackernews contains HTML escape codes
Diffstat (limited to 'searx/engines')
| -rw-r--r-- | searx/engines/hackernews.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/engines/hackernews.py b/searx/engines/hackernews.py index 3b0dd2d87..8ee20f7d2 100644 --- a/searx/engines/hackernews.py +++ b/searx/engines/hackernews.py @@ -6,6 +6,7 @@ from urllib.parse import urlencode from dateutil.relativedelta import relativedelta from flask_babel import gettext +from searx.utils import html_to_text # Engine metadata about = { @@ -75,6 +76,7 @@ def response(resp): object_id = hit["objectID"] points = hit.get("points") or 0 num_comments = hit.get("num_comments") or 0 + content = hit.get("url") or html_to_text(hit.get("comment_text")) or html_to_text(hit.get("story_text")) metadata = "" if points != 0 or num_comments != 0: @@ -83,7 +85,7 @@ def response(resp): { "title": hit.get("title") or f"{gettext('author')}: {hit['author']}", "url": f"https://news.ycombinator.com/item?id={object_id}", - "content": hit.get("url") or hit.get("comment_text") or hit.get("story_text") or "", + "content": content, "metadata": metadata, "author": hit["author"], "publishedDate": datetime.fromtimestamp(hit["created_at_i"]), |