Hacer busquedas de google desde python

Tengo un proyectillo personal sobre calcular el posicionamiento de una web en google (dondesalgoengoogle.es, pero aune stá verde solo para uso interno). Como siempre en python hay ya muchas cosas hechas y esta no es un caso distinto. Lo estoy haciendo el django (por eso tanto post sobre él) y usando la librería de catonmat:

http://www.catonmat.net/blog/python-library-for-google-search/

Es bastante sencilla de utilizar:

from xgoogle.search import GoogleSearch, SearchError
try:
  gs = GoogleSearch("quick and dirty")
  gs.results_per_page = 50
  results = gs.get_results()
  for res in results:
    print res.title.encode("utf8")
    print res.desc.encode("utf8")
    print res.url.encode("utf8")
    print
except SearchError, e:
  print "Search failed: %s" % e

 

 

 

Marcar el enlace permanente.

Un comentario

  1. Greetings! This is my first visit to your blog! We are a group of volunteers and starting a new initiative in a community in the same niche. Your blog provided us valuable information to work on. You have done a outstanding job!

Deja una respuesta