Skip to content

Commit

Permalink
Remove citations from wiki desc
Browse files Browse the repository at this point in the history
  • Loading branch information
amogusussy committed Jul 26, 2024
1 parent 5064577 commit a573719
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/text_engines/qwant.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import re
from src.text_engines.objects.fullEngineResults import FullEngineResults
from src.text_engines.objects.textResult import TextResult
from src.text_engines.objects.wikiSnippet import WikiSnippet
from urllib.parse import urlparse, urlencode, quote
from urllib.parse import urlparse, urlencode
from src import helpers


def sanitize_wiki(desc):
desc = re.sub(r"\[\d{1,}\]", "", desc)
return desc


# NOTE: Qwant engine made by amongusussy. Taken from https://github.com/Extravi/araa-search/pull/106
# Slightly modified to adapt different text results engine.
def search(query: str, page: int, search_type: str, user_settings: helpers.Settings) -> FullEngineResults:
Expand Down Expand Up @@ -76,7 +83,7 @@ def search(query: str, page: int, search_type: str, user_settings: helpers.Setti

wiki = WikiSnippet(
title = result['title'],
desc = result['desc'],
desc = sanitize_wiki(result['desc']),
link = result['source'],
image = wiki_image,
wiki_thumb_proxy_link = wiki_proxy_link,
Expand Down

0 comments on commit a573719

Please sign in to comment.