Spaces:
Runtime error
Runtime error
Update search.py
Browse files
search.py
CHANGED
@@ -1,6 +1,13 @@
|
|
1 |
-
# search.py
|
2 |
from googlesearch import search
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
def search_google(query, num_results=5):
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
1 |
from googlesearch import search
|
2 |
|
3 |
+
PREFERRED_DOMAINS = [
|
4 |
+
'amazon.in', 'flipkart.com', 'wikipedia.org',
|
5 |
+
'makemytrip.com', 'yatra.com', 'skyscanner.co.in'
|
6 |
+
]
|
7 |
+
|
8 |
def search_google(query, num_results=5):
|
9 |
+
raw_urls = list(search(query, num_results=num_results))
|
10 |
+
# Prioritize known trusted domains
|
11 |
+
preferred = [u for u in raw_urls if any(dom in u for dom in PREFERRED_DOMAINS)]
|
12 |
+
others = [u for u in raw_urls if u not in preferred]
|
13 |
+
return preferred + others
|