Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import logging
|
|
7 |
from typing import Dict, List
|
8 |
from datetime import datetime
|
9 |
from bs4 import BeautifulSoup
|
10 |
-
from serpapi import
|
11 |
from newsapi import NewsApiClient
|
12 |
|
13 |
# Set up logging
|
@@ -38,13 +38,14 @@ class RaindropSearchBot:
|
|
38 |
params = {
|
39 |
"q": query,
|
40 |
"num": num_results,
|
41 |
-
"api_key": self.serpapi_key
|
|
|
42 |
}
|
43 |
-
|
44 |
-
results =
|
45 |
|
46 |
if 'organic_results' in results:
|
47 |
-
return results['organic_results']
|
48 |
return []
|
49 |
|
50 |
except Exception as e:
|
|
|
7 |
from typing import Dict, List
|
8 |
from datetime import datetime
|
9 |
from bs4 import BeautifulSoup
|
10 |
+
from serpapi import google_search
|
11 |
from newsapi import NewsApiClient
|
12 |
|
13 |
# Set up logging
|
|
|
38 |
params = {
|
39 |
"q": query,
|
40 |
"num": num_results,
|
41 |
+
"api_key": self.serpapi_key,
|
42 |
+
"engine": "google" # Specify the search engine
|
43 |
}
|
44 |
+
|
45 |
+
results = google_search(params) # Use the correct function
|
46 |
|
47 |
if 'organic_results' in results:
|
48 |
+
return results['organic_results'][:num_results]
|
49 |
return []
|
50 |
|
51 |
except Exception as e:
|