lost and found ( for me ? )

Python xgoogle : use google search engine

Here is how to use google search engine with Python xgoogle.
xgoogle is similar to pygoogle. I like both.

Reference

install xgoogle on Ubuntu 12.04.
#  apt-get install python-setuptools

# git clone https://github.com/pkrumins/xgoogle.git

# cd xgoogle/

# python setup.py build
# python setup.py install

sample script
# cat google_search_01.py
#!/usr/bin/env python

###
# usage: python google_search_01.py <keyword>
###

import sys
from xgoogle.search import GoogleSearch, SearchError

if len(sys.argv) == 2:
   try:
       gs = GoogleSearch(str(sys.argv[1]))
       gs.results_per_page = 100
       results = gs.get_results()
       print "search words: %s" % str(sys.argv[1])
       print ""

       for res in results:
           print res.title.encode("utf8")
           print res.desc.encode("utf8")
           print res.url.encode("utf8")
           print "---"
   except SearchError, e:
       print "%s" % e
else:
   print "usage: python google_search_01.py <keyword>"

search..
# python google_search_01.py 'lost-and-found for me narihiro'
search words: lost-and-found for me narihiro

lost and found ( for me ? ): how to install / set up Remote Desktop ...
desktop.html
http://lost-and-found-narihiro.blogspot.com/2012/12/how-to-install-set-up-remote-desktop.html
---
lost and found ( for me ? ): ubuntu 13.10: deploy wordpress and ...
-mysql.html
http://lost-and-found-narihiro.blogspot.com/2013/10/ubuntu-1310-deploy-wordpress-and-mysql.html
---
lost and found ( for me ? ): Python IDE: Pycharm on ubuntu 13.10
1310.html
http://lost-and-found-narihiro.blogspot.com/2013/10/python-ide-pycharm-on-ubuntu-1310.html

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.