Skip to content

Commit

Permalink
Fixed googlesearch dependency issue
Browse files Browse the repository at this point in the history
Swapped the googlesearch package for the duckduckgo-search. It uses the ddg instant answer API and works very similarly to the googlesearch one.
  • Loading branch information
farrael004 committed Apr 3, 2023
1 parent 51e293f commit 6306a03
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
14 changes: 0 additions & 14 deletions requirements-alternative.txt

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ readability-lxml==0.8.1
requests
tiktoken==0.3.3
docker
googlesearch-python
duckduckgo-search
# Googlesearch python seems to be a bit cursed, anyone good at fixing thigns like this?
4 changes: 2 additions & 2 deletions scripts/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from file_operations import read_file, write_to_file, append_to_file, delete_file
from execute_code import execute_python_file
from json_parser import fix_and_parse_json
from googlesearch import search
from duckduckgo_search import ddg
cfg = Config()


Expand Down Expand Up @@ -103,7 +103,7 @@ def get_datetime():

def google_search(query, num_results=8):
search_results = []
for j in search(query, num_results=num_results):
for j in ddg(query, max_results=num_results):
search_results.append(j)

return json.dumps(search_results, ensure_ascii=False, indent=4)
Expand Down

0 comments on commit 6306a03

Please sign in to comment.