gaur3009 commited on
Commit
9dad5aa
Β·
verified Β·
1 Parent(s): cc8d953

Update search.py

Browse files
Files changed (1) hide show
  1. search.py +2 -18
search.py CHANGED
@@ -1,22 +1,6 @@
 
1
  from googlesearch import search
2
- import random
3
 
4
  def search_google(query, num_results=5):
5
  """Search Google and return list of URLs."""
6
- try:
7
- # Randomize user agent to avoid blocking
8
- user_agent = random.choice([
9
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
10
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
11
- "Mozilla/5.0 (X11; Linux x86_64)"
12
- ])
13
-
14
- return list(search(
15
- query,
16
- num_results=num_results,
17
- advanced=False,
18
- user_agent=user_agent
19
- ))
20
- except Exception as e:
21
- print(f"Search error: {e}")
22
- return []
 
1
+ # search.py
2
  from googlesearch import search
 
3
 
4
  def search_google(query, num_results=5):
5
  """Search Google and return list of URLs."""
6
+ return list(search(query, num_results=num_results))