Spaces:
Sleeping
Sleeping
:zap: [Enhance] GoogleSearcher: Add params of result_sum and safe
Browse files
networks/google_searcher.py
CHANGED
@@ -13,7 +13,7 @@ class GoogleSearcher:
|
|
13 |
self.enver.set_envs(proxies=True)
|
14 |
self.filepath_converter = QueryToFilepathConverter()
|
15 |
|
16 |
-
def send_request(self, result_num=10):
|
17 |
logger.note(f"Searching: [{self.query}]")
|
18 |
self.request_response = requests.get(
|
19 |
url=self.url,
|
@@ -35,10 +35,11 @@ class GoogleSearcher:
|
|
35 |
with open(self.output_path, "wb") as wf:
|
36 |
wf.write(self.request_response.content)
|
37 |
|
38 |
-
def search(self, query):
|
39 |
self.query = query
|
40 |
-
self.send_request()
|
41 |
self.save_response()
|
|
|
42 |
|
43 |
|
44 |
if __name__ == "__main__":
|
|
|
13 |
self.enver.set_envs(proxies=True)
|
14 |
self.filepath_converter = QueryToFilepathConverter()
|
15 |
|
16 |
+
def send_request(self, result_num=10, safe=False):
|
17 |
logger.note(f"Searching: [{self.query}]")
|
18 |
self.request_response = requests.get(
|
19 |
url=self.url,
|
|
|
35 |
with open(self.output_path, "wb") as wf:
|
36 |
wf.write(self.request_response.content)
|
37 |
|
38 |
+
def search(self, query, result_num=10, safe=False):
|
39 |
self.query = query
|
40 |
+
self.send_request(result_num=result_num, safe=safe)
|
41 |
self.save_response()
|
42 |
+
return self.output_path
|
43 |
|
44 |
|
45 |
if __name__ == "__main__":
|