Download presentation
Presentation is loading. Please wait.
1
Participation Page: http://tw.rpi.edu/web/Courses/WebSci/2011/Participati onPage http://tw.rpi.edu/web/Courses/WebSci/2011/Participati onPage Direct Link to code snippet: http://tw.rpi.edu/media/latest/project1.zip Using the xgoogle library Dan Rotondo Web Science September 23 rd, 2011
2
A Python library for Google Search Avoids having to use the Google API Less limitations on number of search queries http://www.catonmat.net/blog/python- library-for-google-search/ http://www.catonmat.net/blog/python- library-for-google-search/
3
Gets the Google website with your search results Use’s Beautiful Soup to parse the HTML code (http://www.crummy.com/software/Beau tifulSoup/)http://www.crummy.com/software/Beau tifulSoup/ Returns the results in text format (utf8)
4
method get_results() – gets a page of results (a list of SearchResult objects) property num_results – number of search results found property results_per_page – sets/gets number of results per page property page – sets/gets the search page
5
SearchBase.py interfaces with xgoogle Must implement this class with any of your subclasses
6
import abc from SearchBase import SearchBase class YourClassName(SearchBase): [… your code here …] abc stands for Abstract Base Classes. If you’re interested in what they are: http://docs.python.org/library/abc.html http://docs.python.org/library/abc.html
7
Do not download xgoogle from their website!!! (it’s out of date) Do use the website as a way to familiarize yourself with the library Go over the SportsSearch.py example Have Fun!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.