๐Ÿ“ฆ wasuaje / searchgoogle

๐Ÿ“„ googlesearch2.py ยท 21 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21# -*- coding: utf-8 -*-
import sys
sys.path.append('xgoogle')

from xgoogle.search import GoogleSearch, SearchError
try:
  gs = GoogleSearch("wuelfhis asuaje")
  gs.results_per_page = 100
  results = []
  while True:
    tmp = gs.get_results()
    if not tmp: # no more results were found
      print "no more resutl"
      break
    results.extend(tmp)
    for rs in results:
      print "busqueda", unicode(rs).encode('utf8')
  # ... do something with all the results ...
except SearchError, e:
  print "Search failed: %s" % e