refac
This commit is contained in:
@@ -33,9 +33,14 @@ def search_duckduckgo(
|
||||
|
||||
# Use the ddgs.text() method to perform the search
|
||||
try:
|
||||
search_results = ddgs.text(query, safesearch='moderate', max_results=count, backend=backend)
|
||||
kwargs = {"safesearch": "moderate", "max_results": count}
|
||||
if backend and backend != "auto":
|
||||
kwargs["backend"] = backend
|
||||
results = ddgs.text(query, **kwargs)
|
||||
search_results = results if results is not None else []
|
||||
except RatelimitException as e:
|
||||
log.error(f'RatelimitException: {e}')
|
||||
search_results = []
|
||||
if filter_list:
|
||||
search_results = get_filtered_results(search_results, filter_list)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user