pygoogle is a very basic Google search module for Python. It has a limitation of only 64 results. If you want more results, see xgoogle
Google's Search API returns 4 or 8 results per 'page'. So, if you want 40 results, you will need to request 4x10pages or 8x5pages. pygoogle uses 8 results per page (default, use rsz to change this to 4).
from pygoogle import pygoogle
g = pygoogle('quake 3 arena')
g.pages = 5
print '*Found %s results*'%(g.get_result_count())
g.get_urls()
you can use pygoogle at command line:
python pygoogle.py quake 3 arena
will show about 10 results (truncated):
*Found 4540000 results*
[id Software: Quake III Arena]
Welcome to the Arena, where high-ranking warriors are transformed into spineless mush. Abandoning every ounce of common sense and any trace of doubt,
http://www.idsoftware.com/games/quake/quake3-arena/
[id Software]
the PLAYSTATION®3 computer entertainment system and PC. ... DOOM, QUAKE and Enemy Territory have become staples of popular culture for generations of
http://www.idsoftware.com/
[Quake III Arena - Wikipedia, the free encyclopedia]
Quake III Arena (also known as Quake 3; abbreviated as Q3A or Q3), is a multiplayer first-person shooter computer and video game released on December 2,
http://en.wikipedia.org/wiki/Quake_III_Arena
method | return |
---|---|
search() | returns a dict of Title/URLs |
get_urls() | returns list of result URLs |
get_result_count() | returns the number of results |
display_results() | prints results (for command line) |
- Download both the files then run the following from the Terminal
- python setup.py build
- sudo python setup.py install