leandrocarneiro commited on
Commit
99c997b
1 Parent(s): e10d1c4

Update search_engine.py

Browse files
Files changed (1) hide show
  1. search_engine.py +2 -2
search_engine.py CHANGED
@@ -14,7 +14,7 @@ import constants
14
  def google_search_api(search_term, api_key, cse_id, **kwargs):
15
  service = build("customsearch", "v1", developerKey=api_key)
16
  res = service.cse().list(q=search_term, cx=cse_id, **kwargs).execute()
17
- return res['items']['link']
18
 
19
 
20
  def search_google(subject, sites):
@@ -26,7 +26,7 @@ def search_google(subject, sites):
26
  query = f"{subject} site:{site}"
27
  sites_searched = google_search_api(query, os.environ['GOOGLE_KEY'], os.environ['GOOGLE_SEARCH'], num=constants.num_sites)
28
  for s in sites_searched:
29
- results.append(s)
30
  #time.sleep(3)
31
  print(' Total de sites encontrados: ' + str(len(results)))
32
 
 
14
  def google_search_api(search_term, api_key, cse_id, **kwargs):
15
  service = build("customsearch", "v1", developerKey=api_key)
16
  res = service.cse().list(q=search_term, cx=cse_id, **kwargs).execute()
17
+ return res['items']
18
 
19
 
20
  def search_google(subject, sites):
 
26
  query = f"{subject} site:{site}"
27
  sites_searched = google_search_api(query, os.environ['GOOGLE_KEY'], os.environ['GOOGLE_SEARCH'], num=constants.num_sites)
28
  for s in sites_searched:
29
+ results.append(s['link'])
30
  #time.sleep(3)
31
  print(' Total de sites encontrados: ' + str(len(results)))
32